Re: Question about scrollbars
- From: "Sebastian Geerken" <S Geerken ping de>
- To: gtk-app-devel-list gnome org
- Subject: Re: Question about scrollbars
- Date: 1 Mar 2001 21:54:33 +0100
On Thu, Mar 01, 2001 at 09:22:34AM -0800, Paolo Costabel wrote:
Sebastian Geerken wrote:
Hi.
I'm using a GtkLayout in a GtkScrolledWindow, and the area size as
well as the adjustment values of the GtkLayout are changed quite
often by the program itself. However, I need to catch adjustment
changes by *the user* (by using the scrollbars), and distinguish them
from changes caused by my program.
Currently, I connect a callback to the "value_changed" signal of the
adjustments, and keep track where changes come from, by
increasing/decreasing a counter before/after my program may affect
the adjustments. A zero value of this counter should indicate an user
caused change. But this turned out to be quite tricky, and I did not
get it working in all cases. So I ask if there is a more direct way
to notice changes of the scrollbars.
[...]
I usually use a global flag when I change a value in the code, like
this:
program_change = TRUE;
gtk_adjustment_value_changed(adj);
program_change = FALSE;
and in the signal
if(program_change)
{
/* do something */
}
else
{
/* user changed the scrollbar */
}
[...]
Yes, this is what I currently do (I think a counter is a bit safer
that a flag), but I ask whether there is a simpler way, because the
blocking gets quite complicated, and, as I wrote, it is still buggy.
(I guess there are thousands of side effects?) So I thought of a way
to make it simpler than to workaround and search for bugs.
Unfortunately, there are no signals from GtkRange to Gtk[VH]Scrollbar
(not GtkAdjustment) for this.
Sebastian
[
Date Prev][
Date Next] [
Thread Prev][
Thread Next]
[
Thread Index]
[
Date Index]
[
Author Index]