Re: emitting a signal for refeshing entries



>A parameter can vary form 1 to 100 and I want the spinbutton to show 
>this value from this parameter when it changes in the program not only 
>by interaction. I now how to set it from within the software, but I 
>would like to ahve all callback function that react on "expose" events 
>to be activated at once.

reading this more carefully, this is a perfect candidate for using a
GtkAdjustment. Just create it with the relevant parameters:

	       initial value
	       lower bound
	       upper bound
	       small step size
	       page step size

then when you create the spinbutton attach it to this adjustment.

in your code, when you want to change the value, set the value of the
adjustment and the spin button will change. connect to the
adjustment's "value_changed" signal if you want to know when the
spinbutton or your code has changed the value.

be careful to avoid feedback loops. write things like:

   gfloat adjuster_value = gtk_adjustment_get_value (GTK_ADJUSTMENT(adjuster));

   if (adjuster_value != parameter_value) {
        gtk_adjustment_set_value (GTK_ADJUSTMENT(adjuster),
        parameter_value);
   }

this assumes that you have the parameter stored elsewhere in the
program (i.e. it can't actually be a GtkAdjustment itself).

--p



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