Problem with GPack.layout adjustments
Closed this issue · 1 comments
vrotaru commented
Here is the layout
definition from gPack.ml
let layout ?hadjustment ?vadjustment ?layout_width ?layout_height =
Layout.make_params []
?hadjustment:(may_map GData.as_adjustment hadjustment)
?vadjustment:(may_map GData.as_adjustment hadjustment)
?width:layout_width ?height:layout_height ~cont:(
pack_container ~create:(fun p -> new layout (Layout.create p)))
It looks wrong because the vadjustment
parameter is never used, but hadjustment
is used twice. I've tried to create a simple example to see what happens and something is wrong even if not exactly what I was expecting.
let main () =
let _local = GMain.init () in
let window = GWindow.window ~title: "Layout Demo" ~width: 450 ~height: 450 () in
ignore@@ window#misc#connect#destroy ~callback: GMain.quit;
let sw = GBin.scrolled_window ~packing: window#add () in
let layout = GPack.layout
~hadjustment: sw#hadjustment ~vadjustment: sw#vadjustment
~layout_width: 600 ~layout_height: 600
~packing: sw#add () in
let a = GMisc.label ~text: "A" () in
layout#put a#coerce ~x: 20 ~y: 20;
let b = GMisc.label ~text: "B" () in
layout#put b#coerce ~x: 500 ~y: 500;
window#show ();
GMain.main ()
let _ = main ()
What happens when I compile and run this code is that the vertical scrolling works and horizontal scrolling doesn't.
However if I scroll horizontally and then vertically then it jumps to to the correct position.
Hope this helps