Glad I could help on this.
Interestingly, that exposes a missing bit about my action handling:
Ctrl-S is disabled in the menubar and toolbar interface, but I don't
disable it when you try the keyboard shortcut.  I'll have to disable
the keyboard shortcut if the menu item is unavailable.
I'd suggest for now not bothering with disabling menu and toolbar items - just do it like Emacs, and map the relevant menu, toolbar, and keystroke events to the "save file" function, and let it figure out what do do (in this case, forward to "save file as").

Later, create an MVC-style model object that knows about the current state of the buffer (and whatever else it needs to) and exposes Boolean methods like "can save", "can delete selection", etc.; then treat the menu/toolbar items as "views" on the object. They get notified of a change of state, and use the methods to decide whether to enable themselves. I've found that this kind of approach makes it much simpler to ensure that all and only the right UI items are enabled at any time.

--

Don Dwiggins
Advanced Publishing Technology

Reply via email to