discuss-gnustep
[Top][All Lists]
Advanced

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

Re: validateMenuItem: called too often?


From: Fred Kiefer
Subject: Re: validateMenuItem: called too often?
Date: Mon, 14 Feb 2005 19:26:01 +0100
User-agent: Mozilla/5.0 (X11; U; Linux i686; en-US; rv:1.7.2) Gecko/20040906

Dirk Lattermann wrote:

I just realized that validateMenuItem: (here for the Save... menu item with the saveDocument: action) is called every time the mouse enters or exits a TextField, a TableView, a Browser and several other UI items. This is an awful lot! Is it really needed? In which cases does it make sense to change the enabled-status of a menu item or pop up cell based on the mouse entering or exiting an UI item?


Looks like your question did get drowned in all that look and feel stuff :-)

The validation of menu items is triggered by [NSApplication run]. For each event, that isn't periodic or a mouse move, the main menu is validated. This is done to find out if a menu item should now be activate or deactivated based on the state of the application. Now what could be the cause of switching a menu item on (or off)? Almost anything! The mouse being over a different GUI item, as in your case, is just one possible example. With context sensitive menus, just think of menu items sending their action to the first responder, this flexibility is really needed. For text fields totally different menu items apply than for a button, and so on.

That said, it is questionable, if we should also validate all the sub menus of the main menu or just the visible ones. Another point is that there are new menu update protocolls for MacOSX 10.3, but this is unrelated to your problem.

Cheers
Fred




reply via email to

[Prev in Thread] Current Thread [Next in Thread]