[Pythonmac-SIG] _menustocheck questions
Gordon Worley
redbird@rbisland.cx
Fri, 4 Aug 2000 00:12:30 -0400
I'm having some trouble with getting _menustocheck to work the way I
would like it to. Most everything in there seems to be fine, but the
selallitem item doesn't work (when the window with the
domenu_selectall callback is closed, the selectall menu remains
hilighted, even though there is no function to handle it). To make
sure I'm not messing up somewhere else, here is my makeusermenus
method:
def makeusermenus(self):
# Set up menu items which all applications should have.
# Apple Menu has already been set up.
# File menu
m =3D Wapplication.Menu(self.menubar, "File")
newitem =3D FrameWork.MenuItem(m, "New", "N", 'new')
openitem =3D FrameWork.MenuItem(m, "Open=8A", "O", 'open')
FrameWork.Separator(m)
closeitem =3D FrameWork.MenuItem(m, "Close", "W", 'close')
saveitem =3D FrameWork.MenuItem(m, "Save", "S", 'save')
saveasitem =3D FrameWork.MenuItem(m, "Save as=8A", None, 'save_as')
FrameWork.Separator(m)
quititem =3D FrameWork.MenuItem(m, "Quit", "Q", 'quit')
# Edit menu
m =3D Wapplication.Menu(self.menubar, "Edit")
undoitem =3D FrameWork.MenuItem(m, "Undo", 'Z', "undo")
FrameWork.Separator(m)
cutitem =3D FrameWork.MenuItem(m, "Cut", 'X', "cut")
copyitem =3D FrameWork.MenuItem(m, "Copy", "C", "copy")
pasteitem =3D FrameWork.MenuItem(m, "Paste", "V", "paste")
clearitem =3D FrameWork.MenuItem(m, "Clear", None, "clear")
FrameWork.Separator(m)
selallitem =3D FrameWork.MenuItem(m, "Select all", "A", "selectall")
FrameWork.Separator(m)
selallitem =3D FrameWork.MenuItem(m, "Add Item", "D", "add_item")
selallitem =3D FrameWork.MenuItem(m, "Edit Selection", "E", "edit_item"=
)
# Any other menus would go here
# These menu items need to be updated periodically;
# any menu item not handled by the application should be here,
# as should any with a "can_" handler.
self._menustocheck =3D [closeitem, saveitem, saveasitem,
undoitem, cutitem, copyitem, pasteitem,
clearitem, selallitem]
selectall doesn't have a can_selectall function anywhere, but adding
one doesn't seem to help. Then, to make matters worse, when I try to
add items (using several different methods, like adding the callback
name, the callback name in quotes, the callback name with item
appended...) to _menustocheck it just gets errors when run
(specifically, a NameError). I tried looking around at the IDE's
code, but it wasn't much help. From FrameWork it seemed like the
items in _menustocheck should be the callback names, but that didn't
work either.
So, I want to know how _menustocheck works. The code didn't help
this time, so could someone please explain it to me?
BTW, sorry if I'm getting anoying the past few days. I usually don't
have so many questions to ask one after another. ;-)
--
Gordon Worley
http://www.rbisland.cx/
mailto:redbird@rbisland.cx
PGP: C462 FA84 B811 3501 9010 20D2 6EF3 77F7 BBD3 B003