gnomecanvas and automatic resizing
"Jacques Le Normand" <[email protected]>
| Newsgroups | gmane.comp.lang.ocaml.lib.gtk |
|---|---|
| Message-ID | <[email protected]> |
Hello lablgtk,
I managed to fix my linking error by adding lablgnomecanvas.cma to my
compile line
However, now I have another problem; I'd like to add widgets to a gnome
canvas and have them resize automatically. Furthermore, I want to move my
widgets around the canvas
this is my first attempt:
(* compiled with ocamlc -I +lablgtk2 lablgtk.cma lablgnomecanvas.cma
gtkInit.cmo test.ml*)
open Gobject
let _ =
let source_window = GWindow.window () in
let buffer = GText.buffer () in
let view = GText.view ~buffer:buffer ~show:true () in
let canvas = GnoCanvas.canvas ~show:true ~packing:source_window#add () in
let item = GnoCanvas.widget ~widget:view ~width:100.0 ~height:100.0
canvas#root in
buffer#insert "some text";
source_window#show ();
source_window#maximize ();
GMain.Main.main ()
unfortunately, the size of the widget is fixed. I can resize it with
item#set [`HEIGHT 50.0], but there's no way of knowing the widget's natural
size (or is there?) this is my second attempt:
open Gobject
let _ =
let source_window = GWindow.window () in
let buffer = GText.buffer () in
let canvas = GnoCanvas.canvas ~show:true ~packing:source_window#add () in
let _ = GText.view ~buffer:buffer ~show:true ~packing:canvas#add () in
buffer#insert "some text";
source_window#show ();
source_window#maximize ();
GMain.Main.main ()
So now my widget (created with GText.view) resizes automatically, but I
can't move it around! in fact, canvas#root#get_items is empty! Is there any
way out of the conundrum?
--Jacques
_______________________________________________
Lablgtk mailing list
[email protected]
http://yquem.inria.fr/cgi-bin/mailman/listinfo/lablgtk