LabVIEW

cancel
Showing results for 
Search instead for 
Did you mean: 

Need UI suggestions / ideas adding to menus

Solved!
Go to solution

I'm an old hand at LabVIEW, but I have never used LabVIEW menus.

 

Here's what I ( and my customer) want to do:

 

Imagine a TAB control, with Page 1, Page 2, Page 3.

On page 1 is a chart, with maybe some blank space.

On page 2 is a set of channel selectors (ring ctls), numeric indicators, and string indicators, with blank space.

On page 3 is a set of channel selectors (ring ctls), and a set of slider numeric indicators.

 

For space reasons, I want to hide the tabs themselves. I want to right-click on the page that is showing, and have a menu offering "Show Chart", "Show Text", and "Show Sliders".  These operations would simply switch tabs to show this page or that page.

 

The thing is, I want to append (or maybe prepend) this to any menu that pops up already. 

In other words, if they click on  the chart, I want to offer the usual chart operations (clear chart, SWEEP mode, etc), IN ADDITION to my custom operations.

But if they click in the blank space, the menu would have just my custom operations.

 

Here's a JING showing a simplified version (the real thing will have many of these and be way more crowded, that's why I want to hide tabs).

 

http://screencast.com/t/qIjbTVbG

 

The TIME indicator updates on every MOUSE DOWN? event in the tab control, proving that this is one place it could be done (in spite of the HELP declaring that "Clusters are the only container objects for which you can generate events").

 

How far-fetched is this idea?  Ony other ideas on how to switch tabs with the tabs hidden?

Steve Bird
Culverson Software - Elegant software that is a pleasure to use.
Culverson.com


Blog for (mostly LabVIEW) programmers: Tips And Tricks

0 Kudos
Message 1 of 25
(3,284 Views)

Hi Steve,

 

Have you considered using a custom run-time menu? I have attached a quick example of using a custom menu to switch between the tabs on a control using an event structure with a Menu Selection event.

2011-12-06_113834.png

 

I have attached the VI and the custom menu. Hopefully that helps!

 

Regards,

 

0 Kudos
Message 2 of 25
(3,274 Views)

Yeah, but that requires a menu bar. None of the other windows in this project have one, so that would be out of place, and we're looking at saving space, particularly vertical space, as this window is intended for a 1920x1080 display, so pulling 50 pixels out of the vertical dimension is the wrong way to go.

 

I'm looking at showing the tabs on the SIDE of a tab control, rather than the top, but that wastes space too, so that's why I was looking at the pop-up menu idea.

 

(There wlil be 6, or maybe 9, of these tabs on the screen)

Steve Bird
Culverson Software - Elegant software that is a pleasure to use.
Culverson.com


Blog for (mostly LabVIEW) programmers: Tips And Tricks

0 Kudos
Message 3 of 25
(3,268 Views)

Your idea sounds do-able.

 

For any FP object that you want to extend, you would create a "Shortcut Menu Activation?" Event. Within the event, you can retrieve a MenuRef.

 

Using the Menu Palette, you use the Insert Menu Items function, each item has a displayed name and a tag.

 

You then add a Shortcut Menu Selection (User) Event for the FP object to handle the selection made by the user. The ItemTags that you assign in the are available to use as a case selector. Your example would simply set the Tab control's index value to switch to the panel you want.

 

I built a fancy tree control (as an XControl) a few years ago for an internal tool that presented a view of files on disk and the right-click menu was context sensitive the the extension of the filename selected. Look in the Facade and the FileView Set Context Menu.vi for the guts of what I did.

 

I always deleted the tree menu choices and then added my own. If you don't delete the items, then your options are appended to the end.

 

I've attached the files here as a ZIP. (LV8.6)

 

 

 

 


Now is the right time to use %^<%Y-%m-%dT%H:%M:%S%3uZ>T
If you don't hate time zones, you're not a real programmer.

"You are what you don't automate"
Inplaceness is synonymous with insidiousness

0 Kudos
Message 4 of 25
(3,260 Views)

For any FP object that you want to extend, you would create a "Shortcut Menu Activation?" Event. Within the event, you can retrieve a MenuRef.

 

OK, so THAT's what I was missing.  I saw the examples dealing with adding menu items, but they all start on a menu bar.  I didn't see how  to get a reference to the shortcut menu - it's not available anywhere except within this event, apparently.

 

And that means I have to have an event case for each chart, each channel selector, each value indicator, each units string, and each slider.

The plan is for 12 overall tabs, each with 6 areas, each area with one chart (page 1) , 20 chan selectors + 20 value indicators + 20 units indicators  (page 2), and 10 chan selectors + 10 units indicators + 10 sliders (page 3).

That's 91 items in each area, 546 items on each major tab, and 6552 items overall. 

Isn't an EVENT structure with 6500+ event cases going to choke LaVIEW?

I'd have to resort to scripting just to code the dang thing.

 

But... how do I handle the blank-space case?  If they right-click outside one of the controls/indicators, I still want to display a menu.

 

The MOUSE DOWN? event gives me a hook, as it happens whether you click on an item within the tab, or not, but I don't see a way to bring up the menu, or attach to the existing one.

 

Steve Bird
Culverson Software - Elegant software that is a pleasure to use.
Culverson.com


Blog for (mostly LabVIEW) programmers: Tips And Tricks

0 Kudos
Message 5 of 25
(3,251 Views)

I don't have a hard solution for you, but there are a few things to play with:

 

  1. The Mouse Down? event allows you to modify which button was pressed on the mouse.  This allows you to generate a menu activation with a normal click (change button from 1 to 2)
  2. You can generate menu activation and mouse down events on the pane.  The mouse down events on the pane will fire through controls.
  3. The menu activation events will NOT fire through the blank portions of a tab control, even if redirected from mouse down events.

Hope this helps.  I don't currently have time to do more.

0 Kudos
Message 6 of 25
(3,246 Views)
Solution
Accepted by topic author CoastalMaineBird

If I understand you correctly, then all you need is something like this:

 

Add_Events.png

 

This registers both the activation and selection events for all the controls and handles them in a single case.

 

There's a boolean in the background of each page which is used to capture those events and the rest have their regular events. If you want to filter the regular options the BG boolean has, you can customize its shortcut menu manually or programmatically to remove them or filter it from the list of controls and handle it separately. You have to make sure those booleans fill the page if you resize it, but you can do that in code easily enough.


___________________
Try to take over the world!
Message 7 of 25
(3,224 Views)

THAT seems like a clear, elegant solution !

A background, invisible (or perhaps decorative) boolean catches all clicks that don't land on something else.

Lots of things I didn't realize, because I've never worked with menus:

1... a boolean can have a shortcut menu.

2... the MenuRef is available within the event case.

3... I can deal with the menu dynamically (as the click happens), rather than staticly.

 

Kudos to you, sir!

Steve Bird
Culverson Software - Elegant software that is a pleasure to use.
Culverson.com


Blog for (mostly LabVIEW) programmers: Tips And Tricks

0 Kudos
Message 8 of 25
(3,209 Views)

Don't forget to accept tst's answer as the solution. Smiley Wink


Now is the right time to use %^<%Y-%m-%dT%H:%M:%S%3uZ>T
If you don't hate time zones, you're not a real programmer.

"You are what you don't automate"
Inplaceness is synonymous with insidiousness

0 Kudos
Message 9 of 25
(3,197 Views)

If it indeed solves the issue, I certainly will.  I need to implement it first.

Steve Bird
Culverson Software - Elegant software that is a pleasure to use.
Culverson.com


Blog for (mostly LabVIEW) programmers: Tips And Tricks

0 Kudos
Message 10 of 25
(3,184 Views)