Dynamic menus/actions in Delphi -
I have an app with a submenu of each location with unique shortcuts so far this submenu is stable but often a new menu Need to add a location and assign a new shortcut. There is a Unit Client Data in the application, which has a Tutorial Manager in which the buttons, menus, and its submenu keep the necessary actions.
So I should be able to convert this submenu to respectively. All the places are in the database. I think action should be taken in the action manager in submenu.
Besides, there is a shortcut-editor for all actions, so each user can create their own personal shortcuts, those shortcuts are saved in a text file in the private file directory.
There are 3 places in it, which should be replaced.
- System modules Here, I can add, edit and delete locations in the database that will be in the submenu.
- Action Manager keeps all functions for this submenu, it also has shortcuts and can load / save shortcuts from a text file.
- The plan module uses submenu for these places, it must create submenu from the locations in the database and assign the correct shortcut to them.
I have started the implementation but I am not sure I am on the right track. It is important that the action in the ActionManager is in sync when the list of locations is edited in the data module. I'm not sure that I have designed the way to add, edit, and delete tasks in ActionManager in runtime.
Other comments and possible improvements are welcome!
Regards
Adding or removing actions on the runtime is a bit behind you have a new TContainedAction Create, then set up your ActionList property in your list. To delete it from the list, either set ActionList: = Zero , or. Action-free
Everything is done by action, not in the list. You can get actions from the list with the properties of the list actions, or you can calculate the list if you are using the Delphi version which supports the for..in loop .
You can get more information by investigating the source in Actnlist.pas. It is big and do not hesitate; Only 1162 lines for the D2009 version
Comments
Post a Comment