Re: EXTERNAL: Re: Two events when selecting a RadioButton



Hi Damon,

On Sat, 12 May 2012 15:18:38 -0400 you wrote:
> 
> > you check out the thread "Weird RadioButton behaviour" from back in
> > May, I was having troubles with it for slightly different reasons.
> I couldn't find that thread

It was on the gtk-list rather than the gtkmm-list :
http://mail.gnome.org/archives/gtk-list/2011-May/msg00003.html

> 
> > It's also fairly easy to tell the real click from the remote
> > deactivation, because in the former case the button will be active when
> > your function is called, and in the latter it won't.
> I haven't figured out how to separate them.  I found that for both of
> the two events get_active() returns true so this seems useless to me.
> Am I missing something?

Possibly I may have mistyped - I use "get_state", not "get_active".
I have an array of RadioButton instances, all attached to the same
callback function for signal_clicked, which looks like: 
void MyClass::ClickedCallBack ( unsigned int idx )
{
    if ( ModeButton[idx].get_state() )
    {
        printf ( "Mode %d selected\n", idx );
        // Now in this mode
        // blah blah
    }
    else
    {
        printf ( "Mode %d deselected\n", idx );
        // No longer in this mode
        // blah blah
    }
}

The callback is attached with:
    for ( cc=0; cc<NumButtons; cc++ )
        ModeButton[cc].signal_clicked().connect ( sigc::bind<int> ( 
                     sigc::mem_fun(*this, &MyClass::ClickedCallBack), cc ) );

That works for me on GTKmm-2


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