Re: [gtk-list] Re: [ repeat message] toggle button: clicked ==toggled, and vice versa



The problem I think is that applications (and esp
derived classes) have already written been which do not
fundamentally distinguish between `click' and `toggle'.

You really need to modify your callbacks
to ignore the emission you are causing -- probably
by setting a variable somewhere, although I think

	if (gtk_signal_n_emissions_by_name(button, "clicked") != 0)
		return;

in your toggle callback *might* suffice.  (Haven't tested it though...)


block_by_name or block_by_id seem dangerous
as gtk+ internally depends on all kinds of signal
emissions not getting blocked.




On Tue, 18 Jan 2000 u07ih@abdn.ac.uk wrote:

> A simple way to do it (but possibly not a viable method for your program,
> depending on the setup), is to have a global variable (say changing)
> and when you are about to set the toggle button programatically set changing to
> TRUE, and in your callback the first thing it does, is check changing's value,
> and if it is TRUE, just returns instantly.
> 
> iain
> > 
> > Pardon the remailing, but I would really appreciate some feedback on this
> > from the GTK folk. I am happy to do the work to fix this problem, but its 
> > not worth it if its not going to be accepted into the mainstream GTK+.
> > 
> > --p
> > 
> > ------- Forwarded Message
> > 
> > Date:    Sun, 16 Jan 2000 08:22:37 -0500
> > From:    Paul Barton-Davis <pbd@Op.Net>
> > To:      gtk-list@redhat.com
> > Subject: [gtk-list] Re: how to set toggle/radio buttons without "clicked"
> > 
> > >    You can use
> > >        gtk_signal_handler_block_by_func(GtkObject *, GtkSignalFunc *,
> > >gpointer)
> > >    (the func and the data pointer must be equal to the correponding
> > >gtk_signal_connect()
> > >    parameters)
> > >
> > >    Or
> > >        gtk_signal_handler_block_by_data(GtkObject *, gpointer)
> > >    (the data parameter must be the same as in the gtk_signal_connect()
> > >call)
> > 
> > Yes, but as I think you understand, this also involves knowing the
> > specific signal connection(s) I want to block. I can't know that.
> > 
> > All I really want is a way to set a button to be "active" without
> > making it appear that there was user interaction.
> > 
> > The error, I think, is that toggle buttons have 2 signals, but anytime
> > you generate 1, you also generate the other. It seemed to me from
> > reading the docs that one could connect to "toggled" instead of
> > "clicked", and would then *every* change to the button
> > state. Alternatively, one could connect to "clicked", and see only
> > those changes caused by a mouse click.
> > 
> > Instead, the function that handles a pure toggle causes "clicked" to
> > be sent. This seems like a mistake to me. The button has not been
> > clicked, its been toggled, and so you're sending the wrong signal ...
> > 
> > "clicked" should be reserved for the completion of a button release
> > event. 
> > 
> > Comments ?
> > 
> > >    BTW, it should be nice to have a
> > >        gtk_signal_handler_xxx_by_name(GtkObject *, const gchar *)
> > >    where xxx is disconnect, block, unblock or pending.
> > 
> > Yes, indeed it would. Owen, etc: if someone writes this (these?) will
> > you accept them into GTK ?
> > 
> > - --p
> > 
> > 
> > 
> > 
> > 
> > 
> > - -- 
> > To unsubscribe: mail -s unsubscribe gtk-list-request@redhat.com < /dev/null
> > 
> > 
> > 
> > ------- End of Forwarded Message
> > 
> > -- 
> > To unsubscribe: mail -s unsubscribe gtk-list-request@redhat.com < /dev/null
> > 
> > 
> 
> -- 
> To unsubscribe: mail -s unsubscribe gtk-list-request@redhat.com < /dev/null
> 
> 



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