Re: [gtk-list] gtk_toggle_button_get_state()



On Fri, 19 Jun 1998 julian.gosnell@nomura.co.uk wrote:

> 
> Forgive me if this is a silly question. I have had a good look through the
>  source and cannot find an answer.
> 
> where is gbool gtk_toggle_button_get_state() (or equivalent) ?
> 
> BTW. It appears that when I call gtk_toggle_button_set_state() I get a signal -
>  this puts me into a feedback loop. I do not have the same trouble with
>  gtk_entry_set_text. GTK should be consistent. When you alter a widget's state
>  programmatically you should pass a flag to indicate whether you need
>  notification of the change. Is there a short term solution to my problem - or
>  do I have to unregister my signal handler, set state and then reattach my
>  handler ?

the easiest way is probably to wrap the call like so:

static void
my_handler (GtkToggleButton *tb)
{
  gtk_signal_handler_block_by_func (GTK_OBJECT (tb), GTK_SIGNAL_FUNC (my_handler), NULL);
  gtk_toggle_button_set_state (tb, !tb->active);
  gtk_signal_handler_unblock_by_func (GTK_OBJECT (tb), GTK_SIGNAL_FUNC (my_handler), NULL);
}

> 
> Jules
> 

---
ciaoTJ



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