cancel
Showing results for 
Search instead for 
Did you mean: 
cancel
Showing results for 
Search instead for 
Did you mean: 

Community Tip - You can subscribe to a forum, label or individual post and receive email notifications when someone posts a new topic or reply. Learn more! X

Catching Events with ACL

ptc-3115379
1-Visitor

Catching Events with ACL

Hello again . Sinceit went so good last time, I'm inventing new problems to solve. Joking, the company in the current project is doing that . The problem stats as follows. Within XML Documents we have a dialog that appears on the right click, the contained menu entries are calling the extensions that I am currently working on. As the menu entries can be valid or invalid ( one extension works on a subtree starting with LIST, the other one does not work on lists, for example. ) I have the task to find a way to make the menu entries greyed out my the currently marked content in the document. So far the plan for battle. I know how to get the currently marked selection, or the point where the cursor resides, I have found out how to enable and disable the entries in the EditPopup-menu, and I have an idea how to model the logic for deciding which menu item can be active on which selection. Just one part is missing. In order to process all that, I need an event, and I thoughtabout catching the right click event, do some preprocessing and modifying to the menu and then let the menu appear, and as you can image : I have no clue how to catch the right click event. I have read so far through some parts of the Documentation, found function calls to define callbacks but none seems to be usable for mouse events, and I have found a W3C MouseEvent Interface within the Arbortext programming guide, but so far stillno idea about how to do this. So I am asking here : Has anyone done this before ? Thank you - again - for your help ! greetings ! roland
2 REPLIES 2

Roland, I'd avoid remapping keys to solve this, as that can be problematic, if for no other reason than the fact that there are at least 4 ways to invoke the context menu (right click, middle click, shift-F10 and menu key - if your keyboard has it, to the right of the space bar). I think the "-active" option to the menu_add command should do what you want, as it allows you to specify an expression to evaluate just before the menu is displayed. If the expression evaluates to non-zero, the item is selectable, otherwise it is grayed out. If you're not using menu_add to create your menu items, I think there are corresponding options for other methods. Check the documentation for your method for details. -Brandon

Hello, Well, using the key mapping seemed the last way to solve this, I've tried it out and as predicted - it is problematic. I searched for the current key mappings for the right mouse button - M2 or M3 - and found an alias-definition to the function "ContextMenuClick" ( if I remember it correct, its been a few days ) . During startup I remapped M3 to a separatly defined Function, that just should call a java-static and after thats finished, should call the ContextMenuClick. That works for exaclty one right click, after that the function ContextMenuClick just vanishes and doesn't exist any more. Thats a fairly strange effect, without it I could have used the remapping way ( would also need to remap the mentioned other keys ), even if it is a dirty way. But unfortunately, epic solved that for me . I can also invoke the Context menu by calling "menu" in ACL, but that call fires a lot of error messages. For now, this task is suspended, as for the current work bundle there is no more time left 😕 . I will see how that issue will continue. Thanks for your help ! greetings ! roland
Announcements

Top Tags