From Friday, April 19th (11:00 PM CDT) through Saturday, April 20th (2:00 PM CDT), 2024, ni.com will undergo system upgrades that may result in temporary service interruption.

We appreciate your patience as we improve our online experience.

LabVIEW

cancel
Showing results for 
Search instead for 
Did you mean: 

Create a new menu from custom action

Solved!
Go to solution

I want to create a textbox with autocomplete, showing up as a menu with matches, where the user can select which word to select.

Like the picture below but the matching words showing up instead of the current right click alternatives I used to show what I wanted to achieve.

It is possible to create a custom menu that I can show when and where I want and how would I do that?

0 Kudos
Message 1 of 8
(2,884 Views)

Hi j,

 

It is possible to create a custom menu that I can show when and where I want and how would I do that?

Sure you can create custom menus for controls!

LabVIEW comes with a lot of example VIs, there are also examples explaining the usage of custom menus…

 

Hint: you want to use Menu functions and probably the event structure to act on user actions!

Best regards,
GerdW


using LV2016/2019/2021 on Win10/11+cRIO, TestStand2016/2019
0 Kudos
Message 2 of 8
(2,882 Views)

@jkarlsson84 wrote:

I want to create a textbox with autocomplete, showing up as a menu with matches, where the user can select which word to select.


Sounds to me like a combo box... At least functionally. For a user a combo box might be more intuitive then a menu.

0 Kudos
Message 3 of 8
(2,857 Views)

Some parts of the combobox would do except the user has to perform a separate click to show all the alternatives. I also need the control to be able to handle input of mathematical functions to be used with the parse formula(Var1 + Var2) and the combobox as of my knowlage only handles 1 name.

 

 

 

 

0 Kudos
Message 4 of 8
(2,832 Views)

@GerdW wrote:

Hi j,

 

It is possible to create a custom menu that I can show when and where I want and how would I do that?

Sure you can create custom menus for controls!

LabVIEW comes with a lot of example VIs, there are also examples explaining the usage of custom menus…

 

Hint: you want to use Menu functions and probably the event structure to act on user actions!


I can modify and act on the menu that appears when the user right clicks on a ctrl but I have never found how to create/ show a menu myself. The information I have found on editing menus does not give any more information than modifying the existing menu and the main menu.

 

I would like to show the menu after every keystroke / key down event in the string control, if the user has started to write a variable name.

Could you point me in the right direction how to show the menu after a key down event

0 Kudos
Message 5 of 8
(2,828 Views)

Hi j,

 

I would like to show the menu after every keystroke / key down event in the string control, if the user has started to write a variable name. Could you point me in the right direction how to show the menu after a key down event

So you don't want a "menu", but you want an additional window to open and present some items.

 

To show an additional window in LabVIEW you need to use an additional VI.

You can do any communication between your mainVI and that subVI you like to!

Best regards,
GerdW


using LV2016/2019/2021 on Win10/11+cRIO, TestStand2016/2019
0 Kudos
Message 6 of 8
(2,819 Views)
Solution
Accepted by jkarlsson84

@jkarlsson84 wrote:

Some parts of the combobox would do except the user has to perform a separate click to show all the alternatives. I also need the control to be able to handle input of mathematical functions to be used with the parse formula(Var1 + Var2) and the combobox as of my knowlage only handles 1 name.


You can update the items in the combo box while you are typing (set update while typing to true, and catch the value change event).

 

I think showing a menu while typing is not going to work. The menu will take focus so key input is blocked, and the menu will disappear while typing in the control. (The combo box has the same problem).

 

I'd make a listbox with suggestions, and update it while typing.

0 Kudos
Message 7 of 8
(2,816 Views)

The result should be an xControl with variable name sugestion and some function for parsing the formula string as well. As mentioned a menu might be the wrong choice sense it will steal the key focus as mentioned.

I will start by implementing it with an list indicator alongside with the string ctrl. If I have the timeI will trye to make the list floating in the future

0 Kudos
Message 8 of 8
(2,807 Views)