The first step in developing our run-time shortcut menu is to define the list of items in that menu. In our example, we are defining the shortcut menu of a graph. To do this, first place a stop button and a waveform graph on the front panel. Then, use the shortcut menu for that graph to select Advanced>>Run-Time Shortcut Menu>>Edit... as demonstrated here:Note: Controls or indicators with customized run-time shortcut menus that you add into an array shell use the shortcut menu of the array.Once this item is selected, LabVIEW will launch the Menu Editor. From this window, we select all of the items which will exist in the run-time shortcut menu. Because we are creating a new run-time menu, we select Custom from the Menu Type pull-down menu of the dialog box:
Next, right-click the Event structure and Add Event Case from the shortcut menu. In the Edit Events dialog box, select Waveform Graph (the graph on our front panel) from the Event Sources list and select Shortcut Menu Selection (User) from the Events list. LabVIEW triggers this event when the user makes a selection on the run-time menu.Click the OK button to close the dialog box. Now place a Case structure inside the Shortcut Menu Selection (User) case of the Event structure. We will use this case structure to determine which menu item was selected and then handle that particular item. Wire the Item Tag event data field to the selector terminal on the border of the Case structure and enter the tag name of the menu item (Export to Word) in the case selector label.Now we just write the LabVIEW code which exports an image of the graph into a Microsoft Word document. To do this, first create an invoke node for the waveform graph and call the Export Image method. This method creates a simplified image of a graph and is very useful for creating reports. Specifically, it modifies the colors of the image so that they will show up properly in other documents.Use this method to save an image of the graph to file and then use the New Report and Append Image to Report VIs (requires the Report Generation Toolkit for Microsoft Office) to create a report and append this image into it.Our application is now ready to run. Switch to the Front Panel and run the VI. Once it is running, access the run-time shortcut menu and notice it is what we created.Select the Export to Word menu item. Microsoft Word will launch a document and import a simplified image of this graph into the document.In this tutorial, we created a custom run-time short menu for a waveform graph. There are many other ways to create customized, professional user interfaces with LabVIEW. To learn more about customizing the LabVIEW user interface, see the other tutorials and example programs listed below.
Collaborate with other users in our discussion forums
A valid service agreement may be required, and support options vary by country.