Is there a way to stop the standard contextual menu of a TextField from showing up?
I made my own menu, but without the automatically added “Copy, Cut, Paste, etc” items.
But after selecting on of the items of my own menu, the menu closes, to make room for the system’s contextual menu.
I tried several things, including call base.close in the ConstructContextualMenu event. But I figure that that’s not the way of stopping it from showing up.
Any ideas?
As I mentioned, I work on a mac.
And this is what I see:
I have a simple panel containing several property fields for some media related project.
When I right-click the language field a popup menu opens.
But when I select a language the system’s contextual menu opens. I think this problem can be solved using Axel’s solution.
When I right-click the file field the actual ContextualMenu is being constructed with three items.
But underneath these items some weird stuff is being appended.
The thing is, Axel’s solution works. But I still find it weird that the System appends stuff to the base Menuitem.
The language field is editable in this example. The final product will have it set to read-only, of course… that explains the “Cut, Copy and Paste” items being added. The file field is read-only.
In the file field, I used the ConstructContextualMenu event.
In the language field, I use the MouseDown event. I added the IsContextualClick value to see if I right clicked.
I created my own menu which I opened using the menu.PopUp method.
I check the result of that method to see the item I clicked.
I finished the MouseDown event with Return True (like Axel suggested). That actually helped.
So, I think I will change all my fields of all the property panels to use the MouseDown event.
But still, it puzzles me that stuff is being added in the base MenuItem, of the ConstructContextualMenu event. Not that I will go for that solution anymore. But it would be nice to have some basic editing option like “Cut, Copy and Paste” on fields with user-editable fields, like a name field. But of course, I can code those items into my own menus, if I need them.
Of course, a Popup-Control will help. But I don’t like the look of it in my UI-design.