General XMetaL Discussion
wksim October 27, 2011 at 12:17 am
Is it possible to call a macro with parametersOctober 27, 2011 at 12:17 amParticipants 1Replies 2Last Activity 11 years, 3 months ago
I am trying to add multiple menu items to the popup menu (CommandBarPopup), and would like to call the same macro but perform different actions within the macro depending on what menu item is selected.
More exact, I am trying to do what ElementList does from the popup menu. I added an “Insert” menu to the popup menu, and add sub menu items for all the elements that can be inserted into the current location where the mouse cursor is. I figured out how to add sub menu items for all the possible elements for the current location, but when I add the menu items, it seems I have to set the OnAction with a macro to call when the menu is clicked.
But I don't want to create all possible macros for different elements. Instead, I would like to call the same macro, but pass the element name to insert to the macro.
Is it possible to do this? Or is there a way to call an external application (such as custom ActiveXControl) when the menu is selected?
Thanks.Derek Read October 27, 2011 at 12:26 am
Reply to: Is it possible to call a macro with parametersOctober 27, 2011 at 12:26 am
The simple answer is no. But you have various other options.
You might wish to use this example for inspiration(or use it as is as it sounds similar to what you are trying to do): http://forums.xmetal.com/index.php/topic,738.0.html
Also, Ctrl+Shift+I opens and puts focus into the Element List. You can navigate in there using arrow keys and insert a selected element using Enter. If you have the Element List floating (not docked) you can press Ctrl+Shift+Enter (rather than just Enter) to both insert the element and dismiss the Element List (see “keyboard shortcuts” in the help).
We are looking at implementing an alternative “Insert Element” feature for the next release so you could also wait for that.wksim October 27, 2011 at 2:01 am
Reply to: Is it possible to call a macro with parametersOctober 27, 2011 at 2:01 am
I will look at the sample tomorrow in more details.
The Insert menu is one, and I am trying to add “Insert Before” and “Insert After” to the popup menu as if possible using the same logic. These options are more important and relevant to the client than the “Insert” menu. One of the difficulties that I have found from the client using the normal view is that, it is difficult to insert the sibling elements while they author as some elements do not have text but just contain elements. For these elements, there isn't a way to place the mouse cursor so that they can insert the elements using the Element List view.
Of course, we can argue to use the tags on view instead of normal view when they want to insert elements, but this is something that the client is asking if they can do most of the authoring from the normal view only.
- You must be logged in to reply to this topic.