Re: Problem with GBin.frame

Edouard <[email protected]>
Newsgroups gmane.comp.lang.ocaml.lib.gtk
Message-ID <1213004806.20521.11.camel@edouard-laptop>
Hello,

I think there are two solutions to your problem. First, you can remove
the width and height parameters when using GWindow.window. For example :

let fenetre = GWindow.window ~title:"Fenêtre" ()

but I suppose this is not what you want to do because the window will be
very small... so let's go to the second solution :

let _ =

  (* First, our well-sized window. *)
  let window = GWindow.window 
    ~width:800 
    ~height:640 
    ~title:"Fenêtre" () in
  window#connect#destroy GMain.quit;

  (* Then add a box so we can pack multiple widgets into the window. *)
  let container = GPack.vbox ~packing:window#add () in

  (* Then add the frame using the #pack method. *)
  let frame = GBin.frame
    ~border_width:10
    ~width:200
    ~height:50
    ~packing:(container#pack ~expand:false) () in
  window#show ();

  GMain.main ();

The ~expand:false parameters means "Do not expand as much as possible".
Now your frame does not fill the whole window anymore.

Hope this helps,
Ed.
lmpx.com only provides a reader for public news (NNTP) servers. It is not affiliated with the servers or forums shown here and is not responsible for the content of articles, which is written by their respective authors.