[Caml-list] lablgtk2 : connecting scroll bar adjustments to a view widget.
oandrieu at nerim.net
Tue Mar 28 12:17:39 CEST 2006
Erik de Castro Lopo [Tuesday 28 March 2006] :
> HI all,
> I posted this to the lablgtk list but received no reply. I'm hoping
> someone here might be able to answer this.
> I have a pair of view objects and I'd like to connect a GData.adjustment
> to them. I think this has something to do with this method:
> method set_scroll_adjustments :
> callback:(GData.adjustment option -> GData.adjustment option -> unit)
> -> GtkSignal.id
Not quite. Apparently this signal is not meant to be connected by
application code but is used by widget implementations.
> but I can't figure out how to use it. Anyone have a clue how to do
What you'd need is the gtk_widget_set_scroll_adjustments() function
(which will emit the set_scroll_adjustments signal you've
mentionned). Unfortunately this function is not wrapped in lablgtk.
All is not lost however, you can still use the GtkScrolledWindow
convenience widget to implement some "linked scrollbars" setup. You
simply need to tell the second scrollbar you create to reuse the
GtkAdjustment object of the first scrollbar. (Untested) Pseudo-code
| let pane = GPack.paned `HORIZONTAL ~packing () in
| let scroll_win_1 =
| ~packing:pane#add1 () in
| let scroll_win_2 =
| ~packing:pane#add2 () in
| let text_view_1 = GText.view ~packing:scroll_win_1#add () in
| let text_view_2 = GText.view ~packing:scroll_win_2#add () in
This is not exactly what you wanted (there are 2 scrollbars) ; you'd
need gtk_widget_set_scroll_adjustments() for a
for a more detailed description of how scrollable widgets are managed.
More information about the Lablgtk-list