Problems updating toggle button and check menu item



Hi,

I want to control a boolean parameter with a toggle button and a check menu
item.
So, if I used the toggle button the menu item has to be updated by code and
viceversa.
In the button's callback I use something like this:


 [...]
gtk_check_menu_item_set_active(GTK_CHECK_MENU_ITEM(tempGGL->_menu_light),
       tempGGL->_gglsurf->_GLParam._lighting);
[...]


Then I have this callback connected to the "activate" menu item's signal:

void GGLInterface::CB_Light_Enabled(GtkWidget* widget, gpointer data)
{

  GGLInterface* tempGGL = (GGLInterface*) data;
  GtkCheckMenuItem *tmp_widget = (GtkCheckMenuItem *) widget;

  if ((tempGGL != NULL) && GTK_WIDGET_REALIZED(tmp_widget)){

    tempGGL->_gglsurf->_GLParam._lighting = tmp_widget->active;

[...]

   //Sets the correct value to Light Enabled pixmap button
   tempPB->SetValue(&tempGGL->_gglsurf->_GLParam._lighting);
    }
  }
}


I want to pass the "if" condition only if the callback has been called
because the user has press the menu item and not because of the
"gtk_check_menu_item_set_active()" use in my toggle button's callback.

I've tried different things: GTK_WIDGET_REALIZED, GTK_WIDGET_HAS_FOCUS...
but I don't find the correct one.

Is there anyway to ask if the active state of the menu item's check box  has
been changed/set either by the user of the program or by code using
"gtk_check_menu_item_set_active"?


Thanks in advance





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