Re: Shared scrollbar between 2 Text widgets



> But here is what might work - let each text widget have
> its own adjustment, only connect one of them to the scrollbar,
> then monitor changes on that adjustment, and change the
> other adjustment yourself.
> 
>      vscrollbar = gtk_vscrollbar_new (GTK_TEXT (text)->vadj);
>      gtk_signal_connect (GTK_OBJECT (GTK_TEXT (text)->vadj),
>                          "changed",
>                          GTK_SIGNAL_FUNC (changed_cb),
>                          GTK_TEXT (text2)->vadj);
> 
> void
> my_changed_cb (GtkAdjustment *adj1, GtkAdjustment *adj2)
> {
>   adj2->value = CLAMP (adj1->value, 0, adj2->upper - adj2->page_size);
>   gtk_signal_emit_by_name (GTK_OBJECT (adj2), "changed");
> }
> 

The idea of changed_cb is good...but the problem is still the same: the
application segfaults when inserting two much text in one of the text
widgets.
More, the two text widgets are no longer scrolling together anymore...
The vscrollbar is only connected to the text widget text (and not with
text and text2).



[Date Prev][Date Next]   [Thread Prev][Thread Next]   [Thread Index] [Date Index] [Author Index]