The standard control menus
Posted
#1
(In Topic #1322)
Regular

Is there any way to "get at" the standard popup menus for a control? What I want to do is, in the form code, manipulate just one of the menu items. An example being a simple textbox. Among the items is "Delete", now if the textbox contains a primary key I want to disable the Delete menu item. I don't want to have to re-implement the other menu items, Undo/Redo/Cut/Copy/Paste just the Delete.
Has anyone ever managed this?
b
Posted
Expert

I had the same issue where I wanted to display one of more pop-up menu items and disable the others.
I used this subroutine:
Code (gambas)
- TmpMnu.Enabled = InMode
- Else 'Set selected menus (by name) to the required mode.
Example of calling the subroutine:
Code (gambas)
This would disable the menu optioos 'Needs Edit' & 'Add Scene'
Cheers - Quin.
I code therefore I am
I code therefore I am
Posted
Guru

Posted
Guru

Possibly in a gambas control you could override a single menu method but i would not imagine a c-code toolkit one is possible.
I guess you know how to override the whole menu in the mouse events.
Posted
Regular

Following my example textbox. It has a popup menu that is there compliments of the GUI or something inside Gambas itself. I don't know.
If I try to set the form designer control popup menu to a menu that I have defined for the form, then the natural menu disappears and I have to create a) the whole menu and b) the implementation for each item. Let's just take Undo and Redo. The code to achieve that is already there inside the black box. However, if I make a popup menu for the form then if I want to have Undo/Redo items than I have to code handlers for them. I dont want to have to do that!
On the other hand, if I just want to disable the Paste item (for some ridiculous reason) then I am forced into the above - where I have to implement the whole damn menu (or just the parts of it I do want.)
What I want is to do
Code (gambas)
Pretty simple desire. Surely someone has come across this before. The sheer idea of having to code an Undo/Redo stack in the form is silly.
Posted
Guru

Maybe Benoit knows a way to hack into it but i can't imagine you can access the toolkit controls inner workings like that because they are inner workings.
Posted
Regular

Apparently in GTK this is simple.
In QT5 the problem is well known but un-resolved.
GTK provides access to internal popup menus as a gtk_menu_popup object (which doesn't work with wayland hahahah but who cares.)
There is approximately 2.13 galaxies of web hits regarding this re QT, but I have yet to find an answer. Hence my brain problem. I need a scotch, or two, or
cheers
b
Posted
Guru

If anyone knows how to do it or can provide a way to do it it'll be Benoit
1 guest and 0 members have just viewed this.

