Hello...
Is there a way to trigger default right-click menu behavior after you've taken control of a component with "Wants Mouse Notifications"?
Basically what I'm trying to do is add a left-click menu on part of my module without blocking the default right-click menu. Is this possible in any way?
JK
Dropdown menus
-
- Posts: 69
- Joined: Thu Jun 04, 2020 2:08 am
- honki-bobo
- Posts: 306
- Joined: Sat Nov 09, 2019 1:18 pm
Re: Dropdown menus
Hey Jeremy,
I guess what you are looking for is the " int ShowDropDownMenu(String[] options, int currentlySelectedIndex, VoltageComponent showMenuUnderThisObject)" method of the VoltageModule object.
Once you get the hang of it, it is actually quite convenient.
You'll need a String[] that holds the menu items, e.g., an int to hold the selected index, e.g. and a VoltageComponent you want to attach the menu to, e.g.
In the "Notify" method add the following to the Button_Changed case:
Hope this helps.
Have a merry Christmas and happy holidays!
I guess what you are looking for is the " int ShowDropDownMenu(String[] options, int currentlySelectedIndex, VoltageComponent showMenuUnderThisObject)" method of the VoltageModule object.
Once you get the hang of it, it is actually quite convenient.
You'll need a String[] that holds the menu items, e.g.
Code: Select all
private String[] waveforms = {"sin", "tri", "sqr", "saw", "rmp"};
Code: Select all
private int menuSelection = 0;
Code: Select all
private VoltageButton menuButton;
Code: Select all
if (component == menuButton) {
menuSelection = this.ShowDropDownMenu(waveforms, menuSelection, menuButton);
if (menuSelection == 0) {
//do something
} else {
// do something else
} // ... and so on
}
Have a merry Christmas and happy holidays!
Re: Dropdown menus
I think what JK is after is a means of calling up the default VM right-click menu rather than just a custom menu.
I have a similar problem with trying to create programmatically operable toggle buttons from normal buttons. My code works but it disables VM's right-click menu for some reason.
How some events are dispatched in VM is a bit of a mystery but it would be handy to be able to call up the right-click menu from our own code so that we can replicate "normal" behaviour.
I have a similar problem with trying to create programmatically operable toggle buttons from normal buttons. My code works but it disables VM's right-click menu for some reason.
How some events are dispatched in VM is a bit of a mystery but it would be handy to be able to call up the right-click menu from our own code so that we can replicate "normal" behaviour.