New dialog

From LabVIEW Wiki
Jump to: navigation, search

The New dialog provides access to create new VIs, Polymorphic VIs, Malleable VIs, LabVIEW Projects, LabVIEW Classes, LabVIEW Project Libraries, Custom Controls (see Control editor), Global Variables, Run-Time Menus, and XControls, all of which are generally referred to as LabVIEW Documents. VIs can be created from the New dialog using templates that create the VI with a common Design Patterns already established. Other toolkits, like QControls, add options to create other types of content to the New dialog. To access the New dialog from the Getting Started, Project Explorer, VI Front Panel, or VI Block Diagram windows, select File-->New... from the menu bar.

New dialog box

Dialog Parts

The main parts of the New dialog include:

  • Create New is a tree control that displays starting points for VIs and other LabVIEW documents. Select an item from one of the following categories and click the OK button to start building a VI or other LabVIEW document.
  • Description is a picture control that displays an image and a description of the component you selected in the Create New list.
  • Add to project is a checkbox that specifies if the new component should be added to the project you select in the Projects pull-down menu. If no project is available, LabVIEW disables this checkbox.
  • Projects is a drop-down combobox that specifies the project to which LabVIEW will add the selected component. This pull-down menu appears only if you have more than one project open.
    Note LabVIEW automatically selects and disables the Add to project checkbox. If no project is available, LabVIEW disables the OK button. If multiple projects are available, you can select the project to which you want to add the item from the Projects pull-down menu.
  • The OK button starts creation of the selected component.
  • The Cancel button dismisses the New dialog without creating the selected component.
  • The Help button launches the LabVIEW Help to the help article about the New Dialog Box.

LabVIEW Documents

The LabVIEW Documents available to create by default include:

  • VI—The items in this category create new VIs.
    • Blank VI—Creates a new, blank Virtual Instrument (VI).
    • Polymorphic VI—Creates a new, blank, Polymorphic VI.
    • From Template—Opens a front panel and block diagram with components you need to build different types of VIs. Click a template in the From Template category of the Create new tree to display the front panel in the Front Panel Preview section, to display the block diagram in the Block Diagram Preview section, and to display a description of the template in the Template Description text box.
      • Frameworks—Opens a front panel and block diagram with components and settings to build VIs for general purpose applications.
      • Instrument I/O—Opens a front panel and block diagram with components to communicate with an external instrument attached to the computer through a port, such as a serial or GPIB-enabled device.
      • Simulated—Opens a front panel and block diagram with components to simulate acquiring data from a device.
      • User—Opens a VI with components from a template that you created.
        • Browse—Opens a file dialog from which you can select a template.
  • Project—The items in this category create new projects.
    • Empty Project—Creates a project to manage VIs, support files, applications, and hardware configurations.
    • Project from Wizard—The items in this category interactively create projects based on details you provide about the intended application.
  • Other Files—Creates the tools you use to build other LabVIEW objects.
    • I/O Server—(DSC or Real-Time Module) Creates an I/O server to communicate with and manage input/output devices. These I/O servers read selected input items and write to the selected input items on demand. You must have a project open to create an I/O server.
    • Class—Creates a LabVIEW Class. LabVIEW classes are user-defined data types. LabVIEW classes are the basis for LabVIEW object-oriented programming.
    • Custom Control—Creates custom user interface components that vary cosmetically from built-in LabVIEW controls and indicators. You also can use this option to create type definitions.
    • Global Variable—Creates a container VI for Global variables that can be accessed from anywhere in the application.
    • Library—Creates a LabVIEW Project Library.
    • Run-Time Menu—Creates a Run-Time Menu.
    • XControl—Creates an XControl that combines built-in LabVIEW controls and indicators. Unlike custom controls, XControls have dynamic run-time and edit-time behavior that is defined by VIs that run in the background.
      Note This item is available only in the LabVIEW Professional Development System.

New Dialog Source Code

The New dialog is written in G and the VI for the dialog box is located in the LabVIEW directory at: [LabVIEW 20xx]\resource\plugins\lv_new.vi. However, the VI is password protected so the block diagram cannot be accessed and the VI cannot be edited.

Adding Templates to the New Dialog

Template VIs can be added to the New Dialog and will appear under the From Template item in the tree. To do this:

  1. Create a Template VI and save it to [LabVIEW 20xx]\templates\[Your folder]\[Your Template].vit.
  2. Define what text you want [Your Folder] to appear as in the tree by adding a text file at: [LabVIEW 20xx]\templates\[Your Folder].txt
  3. Add an Image to be displayed in the New Dialog when your template is selected.
    1. One for each VIT file
    2. Should be 250x250px in size
    3. Named [LabVIEW 20xx]\templates\[your folder]\[All Your VIT Files]*d.png
  4. Edit the Template VIs description. This is the text that will be displayed under the image in the New Dialog.

Adding Wizards to the New Dialog

You can add items to the New dialog without editing the source code. To do this you will need:

  • A VI that launches your Wizard, or VI Scripting code that creates the component
  • The path to where that VI will be installed (if installed by a Package or Installer)
  • A PNG image that represents your component. This is used in the Description in the dialog. Size should be 256 x 256 pixels.
  • A PNG image to be used as the icon in the Create New tree in the dialog. Size should be 16x16 pixels.
  • A description of the component to be used in the Description in the dialog
  • Generate a GUID for your component

After you have all these items, locate the LVNewDialog.xml file located in the LabVIEW directory at: [LabVIEW 20xx]\resource\plugins\NewDialogFiles\LVNewDialog.xml. To add a node to the XML file for your component you will need to read the file and find the GUID for the Other Files item in the tree. This becomes the <ParentGUID> in the node you will add.

Note It is advisable to make a backup of your LVNewDialog.xml before beginning to edit it. It is not impossible to restore if the file is corrupted but it would require a reinstall of LabVIEW if you did.

An example of the XML code for a node is as follows (shown here from the QControl Toolkit):

<Node>

<Name localize="yes">QControl</Name>
<GUID>%s</GUID>
<ParentGUID>%s</ParentGUID>
<ItemPath>/resource/plugins/QControl/New QControl.vi</ItemPath>
<ItemType>ProjectWizard</ItemType>
<Description localize="yes">This launches the QControl Creation Wizard to step you through the creation of a new QControl.</Description>
<ImagePath>/resource/plugins/QControl/QControl Class.png</ImagePath>
<MagicNumber></MagicNumber>
<Weight>-1</Weight>
<Version></Version>
<ChildOnly>1</ChildOnly>
<ProjectPossible>0</ProjectPossible>
<NDIconPath>/resource/plugins/QControl/QControl Class Icon.png</NDIconPath>

</Node>

Where the %s under the <GUID> tag should be replaced with your GUID you generated and the %s under the <ParentGUID> tag should be replaced with the GUID Other Files item. Replace the data in the Name, ItemPath, Description, ImagePath, and NDIconPath tags with the information about your component from above. Save the XML and restart LabVIEW to test.

In the case of the QControl Toolkit, editing the LVNewDialog.xml file and adding a node was done as a post-install step of the Package and removal of the node was done as a post-uninstall step of the Package.

LVNewDialog.xml Contents

The standard contents of the LVNewDialog.xml includes entries for the following items.

Name* Magic Number Description* GUID Parent GUID
VI 0 The items in this category create new VIs. 12852C5E-EF28-4C57-9918-A983E12B9000 0
Malleable VI -2 Creates a new, blank malleable VI (.vim). Use a malleable VI to perform the same operation on any acceptable data type instead of saving a separate copy of the VI for each data type. 95B1F587-6FFF-4639-8D89-969D20506165 12852C5E-EF28-4C57-9918-A983E12B9000
Polymorphic VI 4 Creates a new, blank polymorphic VI. 95B1F587-6FFF-4639-8D89-969D20506164 12852C5E-EF28-4C57-9918-A983E12B9000
From Template Opens a front panel and block diagram with components you need to build different types of VIs. 77E350A8-F9AA-43FF-85E2-454279EBB9A7 12852C5E-EF28-4C57-9918-A983E12B9000
User Opens a VI with components from a template that you created. C20AD50F-B51C-48F0-A234-C577B3205C7B 77E350A8-F9AA-43FF-85E2-454279EBB9A7
Browse... Opens a file dialog from which you can select a template. F38C0C3D-64E1-45E7-802A-B4F7500D1311 C20AD50F-B51C-48F0-A234-C577B3205C7B
From Wizard The items in this category interactively create VIs based on details you provide about the intended application. 0936A631-D3F8-4340-938F-FC842EAF7085 12852C5E-EF28-4C57-9918-A983E12B9000
Project The items in this category create new projects. 3F7CF7A8-5E4D-4EDC-AA25-FA4A326988EF 0
Empty Project 5 Creates a project to manage VIs, support files, applications, and hardware configurations. 2 3F7CF7A8-5E4D-4EDC-AA25-FA4A326988EF
Project from Wizard The items in this category interactively create projects based on details you provide about the intended application. 00770B31-E6B3-440E-BFED-6FA5AA81B661 3F7CF7A8-5E4D-4EDC-AA25-FA4A326988EF
Build Specifications The items in this category create build specifications that you can use within a project. 4E42E73D-E584-4A26-AB0A-928FB5C367B1 0
Other Files Creates the tools you use to build other LabVIEW objects. 8E4D36AD-F776-4C48-97C6-C1D85EFE889F 0
Custom Control 2 Creates custom user interface components that vary cosmetically from built-in LabVIEW controls and indicators. You also can use this option to create type definitions. A09C6440-BBD9-4508-9462-C3AAAD503B2A 8E4D36AD-F776-4C48-97C6-C1D85EFE889F
Global Variable 1 Creates a container VI for global variables that can be accessed from anywhere in the application. C26E7225-44A0-4CDD-8B16-BA9836DBD5A7 8E4D36AD-F776-4C48-97C6-C1D85EFE889F
Library Creates a project library. ABC740D6-F254-4BBC-5675-8858F35B820E 8E4D36AD-F776-4C48-97C6-C1D85EFE889F
Run-Time Menu 3 Creates a run-time menu. 9A27B830-B833-4959-855A-2CC53FD83489 8E4D36AD-F776-4C48-97C6-C1D85EFE889F
Type Definition -3 Creates type definitions to link all the instances of a custom control or indicator to a saved custom control or indicator file. Type definitions identify the correct data type for each instance of a custom control or indicator. A09C6440-BBD9-4508-9462-C3AAAD503B2A 8E4D36AD-F776-4C48-97C6-C1D85EFE889F
XControl Creates an XControl that combines built-in LabVIEW controls and indicators. 2E4BD3AC-4E04-45C9-B6C5AD138962C435 8E4D36AD-F776-4C48-97C6-C1D85EFE889F

*Displayed here in English. These will be in the language of the LabVIEW version installed.

Magic Numbers

The Magic Number refers to the LabVIEW document type as used in the New LabVIEW Document method.

The values and document types are as follows:

Value File Type
-3 Type Definition
-2 Malleable VI
0, Default VI
1 Global Variable
2 Custom Control
3 Run-time Menu
4 Polymorphic VI
5 Project
6 VI Template
7 Global Template
8 Control Template
9 Simulation Subsystem (requires Control Design and Simulation Module)
10 Statechart (requires Statechart Module)
11 Ladder Diagram (if supported - in LabVIEW 8.6 only)

See Also

External Links