EuGTK - CheckAll, UncheckAll
- Posted by Jerry_Story Nov 02, 2010
- 1363 views
-- This is supposed to put a check mark on all 25 food groups in the menu bar. function onMenu_CheckAll(atom ctl) for fg = 1 to length(MenuG) do -- But this checks those that are unchecked, and unchecks those that are checked. -- And it seems to trigger an event for each one; that is my guess why it takes a long time. set(MenuG[fg],"activate",1) SelectedGroups[fg] = 1 end for update_foods() return(0) end function constant ev_CheckAll = call_back(routine_id("onMenu_CheckAll")) connect(MenuG_CheckAll,"activate",ev_CheckAll) -- This is supposed to uncheck all 25 food groups. function onMenu_UncheckAll(atom ctl) for fg = 1 to length(MenuG) do set(MenuG[fg],"activate",0) -- This does the same as above. SelectedGroups[fg] = 0 end for update_foods() return(0) end function constant ev_UncheckAll = call_back(routine_id("onMenu_UncheckAll")) connect(MenuG_UncheckAll,"activate",ev_UncheckAll)
Question 1: Is set_active supposed to toggle between active and inactive? Then what is the purpose of the 1 or 0? And that's not what the documentation says.
http://www.pygtk.org/docs/pygtk/class-gtkcheckmenuitem.html#method-gtkcheckmenuitem--set-active
Question 2: Is there any way to use
set(MenuG[fg],"activate",1) and set(MenuG[fg],"activate",0)
without triggering an event?