Browse thread
[Caml-list] Why I cannot open a graph with a specific title
-
Andy Yang
- Matt Gushee
- Christophe TROESTLER
[
Home
]
[ Index:
by date
|
by threads
]
[ Message by date: previous | next ] [ Message in thread: previous | next ] [ Thread: previous | next ]
[ Message by date: previous | next ] [ Message in thread: previous | next ] [ Thread: previous | next ]
Date: | 2004-06-28 (21:01) |
From: | Matt Gushee <mgushee@h...> |
Subject: | Re: [Caml-list] Why I cannot open a graph with a specific title |
On Mon, Jun 28, 2004 at 12:57:34PM -0700, Andy Yang wrote: > > I found that with the following code is OK: > > open Graphics;; > let _ = open_graph "";; > > However, if I set a title for a widnow > > open Graphics;; > let _ = open_graph "hello";; > > Ocaml will report "Fatal error: exception > Graphics.Graphic_failure("Cannot open display hello"). > > open_graph has a signature string -> unit. Yes, and did you read what the manual says about that string? The string is not supposed to be the window title. On X11, it's the the name of an X display and/or a geometry specification. I'm not sure what it's supposed to be on Win32 platforms. Nonetheless, the behavior of open_graph leaves something to be desired. For example, # open_graph " 400x600" (* Note the leading space. *);; - : unit = () # open_graph "400x600";; Exception: Graphics.Graphic_failure "Cannot open display 400x600". So the function distinguishes a display name from a geometry spec by whether there is a leading space? Yech. Maybe the signature should be open_graph : ?display:string -> ?geometry:string -> unit -> unit And at least one of the following should work: # open_graph "0";; Exception: Graphics.Graphic_failure "Cannot open display 0". # open_graph "0.0";; Exception: Graphics.Graphic_failure "Cannot open display 0.0". # open_graph "localhost:0.0";; Exception: Graphics.Graphic_failure "Cannot open display localhost:0.0". # open_graph "127.0.0.1:0.0";; Exception: Graphics.Graphic_failure "Cannot open display 127.0.0.1:0.0". # open_graph "localhost:0";; Signal 13 bash-2.05a$ Brilliant. P.S. When asking questions of this sort, it would be helpful if you gave some information about your system, e.g. the platform and version of OCaml--especially with libraries like Graphics that have platform-dependent features. -- Matt Gushee When a nation follows the Way, Englewood, Colorado, USA Horses bear manure through mgushee@havenrock.com its fields; http://www.havenrock.com/ When a nation ignores the Way, Horses bear soldiers through its streets. --Lao Tzu (Peter Merel, trans.) ------------------- To unsubscribe, mail caml-list-request@inria.fr Archives: http://caml.inria.fr Bug reports: http://caml.inria.fr/bin/caml-bugs FAQ: http://caml.inria.fr/FAQ/ Beginner's list: http://groups.yahoo.com/group/ocaml_beginners