caml-list - the Caml user's mailing list
 help / color / mirror / Atom feed
* lablgtk2 : connecting scroll bar adjustments to a view widget.
@ 2006-03-28  7:21 Erik de Castro Lopo
       [not found] ` <20060324222122.621a4d5e.ocaml-erikd@mega-nerd.com>
  0 siblings, 1 reply; 3+ messages in thread
From: Erik de Castro Lopo @ 2006-03-28  7:21 UTC (permalink / raw)
  To: caml-list

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

but I can't figure out how to use it. Anyone have a clue how to do
this?

TIA,
Erik
-- 
+-----------------------------------------------------------+
  Erik de Castro Lopo
+-----------------------------------------------------------+
"Attacks by Microsoft Chairman Bill Gates on the GNU General
Public License, under which much open source and free software is
distributed, have been driven by a fear that the GPL creates a
domain of software that Microsoft cannot privatize and control"
   -- Richard Stallman


^ permalink raw reply	[flat|nested] 3+ messages in thread

* Re: [Caml-list] lablgtk2 : connecting scroll bar adjustments to a view widget.
       [not found] ` <20060324222122.621a4d5e.ocaml-erikd@mega-nerd.com>
@ 2006-03-28 10:17   ` Olivier Andrieu
  2006-03-30  8:38     ` Erik de Castro Lopo
  0 siblings, 1 reply; 3+ messages in thread
From: Olivier Andrieu @ 2006-03-28 10:17 UTC (permalink / raw)
  To: Erik de Castro Lopo; +Cc: caml-list, lablgtk

 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
 > this?

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
follows:
,----
| let pane = GPack.paned `HORIZONTAL ~packing () in
| 
| let scroll_win_1 = 
|   GBin.scrolled_window 
|     ~packing:pane#add1 () in
| let scroll_win_2 = 
|   GBin.scrolled_window
|     ~vadjustment:scroll_win_1#vadjustment
|     ~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
one-scrollbar-two-textviews setup.

cf. http://developer.gnome.org/doc/API/2.0/gtk/GtkScrolledWindow.html#desc 
for a more detailed description of how scrollable widgets are managed.

-- 
   Olivier


^ permalink raw reply	[flat|nested] 3+ messages in thread

* Re: [Caml-list] lablgtk2 : connecting scroll bar adjustments to a view widget.
  2006-03-28 10:17   ` [Caml-list] " Olivier Andrieu
@ 2006-03-30  8:38     ` Erik de Castro Lopo
  0 siblings, 0 replies; 3+ messages in thread
From: Erik de Castro Lopo @ 2006-03-30  8:38 UTC (permalink / raw)
  To: caml-list

Olivier Andrieu wrote:

> Not quite. Apparently this signal is not meant to be connected by
> application code but is used by widget implementations. 

Yes,  Jacques Garrigue explained this on the lablgtk list.

> 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.

Ah ha.

> 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
> follows:
> ,----
> | let pane = GPack.paned `HORIZONTAL ~packing () in
> | 
> | let scroll_win_1 = 
> |   GBin.scrolled_window 
> |     ~packing:pane#add1 () in
> | let scroll_win_2 = 
> |   GBin.scrolled_window
> |     ~vadjustment:scroll_win_1#vadjustment
> |     ~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
> one-scrollbar-two-textviews setup.

Hmm, fortunately I am much more proficient in C than I am in Ocaml
so my best bet is write a widget in C that fits my needs in exactly
and then wrap that in Ocaml.
 
> cf. http://developer.gnome.org/doc/API/2.0/gtk/GtkScrolledWindow.html#desc 
> for a more detailed description of how scrollable widgets are managed.

Thanks again. I'll check it out.

Cheers,
Erik
-- 
+-----------------------------------------------------------+
  Erik de Castro Lopo
+-----------------------------------------------------------+
"Being completely naked during the act of coitus annuls the marriage."
-- Rashad Hassan Khalil, a former dean of Al-Azhar University's 
   faculty of Sharia (or Islamic law)


^ permalink raw reply	[flat|nested] 3+ messages in thread

end of thread, other threads:[~2006-03-30  8:38 UTC | newest]

Thread overview: 3+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2006-03-28  7:21 lablgtk2 : connecting scroll bar adjustments to a view widget Erik de Castro Lopo
     [not found] ` <20060324222122.621a4d5e.ocaml-erikd@mega-nerd.com>
2006-03-28 10:17   ` [Caml-list] " Olivier Andrieu
2006-03-30  8:38     ` Erik de Castro Lopo

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).