01-02-2009 04:57 AM
Dear All,
Is there any way to Remove Run time menu of a particular control during the execution of a program?
i have a radio control in which i have 2 radio buttons. The run time menu of both, the control and the radio buttons is different.
After certain period, i want to remove the run time from the radio buttons.
Thanks,
Ritesh
01-02-2009 05:51 AM
Hi there
I can't find a way to remove/disable the runtime menu of a control at runtime. Maybe you could add an additional (boolean) control besides the other controls (e.g. marked with an "?" decal), attach the rtm to these boolean controls and then show/hide or enable/disable these booleans instead.
01-02-2009 06:43 AM
hi chrisger,
thanks for your post, but i couldn't get the idea you posted.
could you pls post an example demonstrating ur idea.
Thanks,
Ritesh
01-02-2009 06:54 AM
See attachment...
01-02-2009 07:13 AM - edited 01-02-2009 07:16 AM
There is a very simple way to disable a RunTime menu : the only condition is that you must first build a custom menu for the control.
Then you can use an event loop as shown on the picture below to delete (or not) dynamically the menu upon activation.
01-02-2009 07:32 AM
That's cool! Kudos for that.
01-03-2009 06:27 AM
Hey Guys,
Thanks alot.
But i am kinda stuck in some other problem related to menu Selection.
I have a Radio Button Control and inside i have 1 radio buttton.
at times i just want to delete the menu items of Radio Button Control and not the Radio Button inside the control.
its just not giving the desired O/P..
pls have a look at my VI, and let me know if dere's a work around.
Thanks,
Ritesh
01-03-2009 12:04 PM - edited 01-03-2009 12:13 PM
ritesh024 a écrit:I have a Radio Button Control and inside i have 1 radio buttton.
at times i just want to delete the menu items of Radio Button Control and not the Radio Button inside the control.
This is going to be tricky. To be honest, I think there is a bug in the way the popup menus are handled by LabVIEW. At first, I thought that there was no solution to your problem, but I ultimatelly found a workaround. Here we go :
Step 1 - Register for the "shortcut menu activation" events of the radiobuttons ;
Step 2 - create a static empty popup menu for the RB housing control ;
Step 3 - create static popup menus for all the RS radio buttons ;
Step 4 - If a popup menu is not required for the housing control (RB) or if a radiobutton has been activated while a housing control popup menu was required, then do nothing (ie use the empty static popup menu). This is tricky because you have to check which control has been activated : instead of looking at the control name (if you had to change it you would be obliged to modify the diagram !), the trick is to wait for a "shortcut menu activation" event, and to use the "subObj" reference to get the name of the activated object : this is an empty string when the housing control is activated, otherwise, it's the name of the radiobutton.
else, if the housing control has been activated, insert the menu items in the popup menu.
Step 5 - Create an event case to manage the radiobuttons "shortcut menu activation" events : delete dynamically the radiobutton menus if they are not required.
I hope there is a more obvious solution. Try the attached VI.
01-03-2009 03:06 PM - edited 01-03-2009 03:07 PM
Another option would be to just use a filtering mouse down event and discard right-clicks if RTMs should be disabled.
Here's a simple example that globally disables/enables the RTM for the radio button control. You could make it more selective by taking the "coords" event output into consideration. From the coordinates, you can easily calculate which part of the control was right-clicked and discard accordingly. Modify as needed.
.
01-03-2009 03:23 PM - edited 01-03-2009 03:24 PM
altenbach a écrit:Another option would be to just use a filtering mouse down event and discard right-clicks if RTMs should be disabled.
Here's a simple example that globally disables/enables the RTM for the radio button control. You could make it more selective by taking the "coords" event output into consideration. From the coordinates, you can easily calculate which part of the control was right-clicked and discard accordingly. Modify as needed.
Hum... Disabling the RTM for the whole control is not the problem. Filtering the "Shortcut menu activation ?" event is even more straight forward.
Here, the challenge is to have the RTMs for the radio buttons inside still actives while the RTM for the housing control is programmatically enabled or disabled.