How to dynamically enable/disable menu actions on-demand

David Nolden david.nolden.kdevelop at art-master.de
Fri Apr 3 08:40:08 UTC 2009


Am Donnerstag 02 April 2009 22:04:55 schrieb Andreas Pakulat:
> Well, the problem with that is, you may end up showing that menu even if
> the user doesn't care about the action or even the menu. There are quite
> a lot of people out there I think that click on some menu to open it up
> and then notice that its the wrong one, moving the mouse along to check
> which is the right one. I'm doing that constantly if I'm not 100% sure
> where an action is. If you update each time the menu is shown, then
> you've got a _lot_ of ui blocking and showing menus will be incredibly
> slow.
>
> If updating the action each time the cursor moves, maybe that should be
> done with a timer, so its only updated once the cursor has stopped for
> at least a few msec (maybe even a second).
We've got to make sure that it never blocks. Small actions like "checking 
whether there is some declaration under the text cursor, do some checks on the 
declaration" or "check if current file is in a project" are cheap enough not 
to do any blocking.

The context-menu does have some problems with this, I find it very annoying 
that it takes so long to show up. I guess that's because of the VCS checks? We 
need to make those faster by caching the information somewhere. IMO it would 
be ideal anyway to configure the VCS stuff on a per-project basis, and do the 
checks max. once at each startup to update it.

Just by the way, although unrelated, I think we should also add those VCS menu 
entries into some place in the main menu, since I think it's wrong and 
inconsistent having stuff accessible only through the context-menu(No keyboard 
accelerators, low discoverability, etc.)

> Another alternative is to not do the watching and inform the user when
> he triggers an action that is missing some information (selection etc).
Yes that's better than nothing.

Greetings, David





More information about the KDevelop-devel mailing list