Jump to content
Sign in to follow this  
JDave

How do I open a blank VI?

Recommended Posts

Does anyone know how to programmatically open a blank VI?

The menubar will be hidden, so I can't use the menu shortcut. The hook VI lv_new_vi.vi doesn't exist to call. I didn't notice an Application invoke node method. But there must be some other way. (Probably as easy as Ctrl+N ;) ).

David

Share this post


Link to post
Share on other sites

QUOTE(dsaunders @ Sep 14 2007, 12:48 PM)

Does anyone know how to programmatically open a blank VI?

The menubar will be hidden, so I can't use the menu shortcut. The hook VI lv_new_vi.vi doesn't exist to call. I didn't notice an Application invoke node method. But there must be some other way. (Probably as easy as Ctrl+N ;) ).

David

There's an application scripting method 'New LabVIEW Document' which takes a numeric parameter and creates any one of the following: standard VI, global, control, polyVI, runtime menu, project, plus some templates of these types (I didn't try an exhaustive set of values). Unfortunately, it doesn't return a refnum to the created object.

I'm pretty sure there was also a 'New VI' primitive which created a new VI with various options for what kind, and returned a refnum for the created object. But it no longer appears in my Application Control palette. Must need a ReallySuperSecret... token (or legendary scripting license activation) to get to it now :(

Since none of this works in runtime, you were, of course, referring to creating a new VI while running the development environment, right? Why is the menubar of the calling VI necessarily hidden?

Dave

Share this post


Link to post
Share on other sites

QUOTE(David Boyd @ Sep 14 2007, 01:42 PM)

There's an application scripting method 'New LabVIEW Document' which takes a numeric parameter and creates any one of the following: standard VI, global, control, polyVI, runtime menu, project, plus some templates of these types (I didn't try an exhaustive set of values). Unfortunately, it doesn't return a refnum to the created object.

I'm pretty sure there was also a 'New VI' primitive which created a new VI with various options for what kind, and returned a refnum for the created object. But it no longer appears in my Application Control palette. Must need a ReallySuperSecret... token (or legendary scripting license activation) to get to it now :(

Since none of this works in runtime, you were, of course, referring to creating a new VI while running the development environment, right? Why is the menubar of the calling VI necessarily hidden?

Dave

Thanks, Dave. I should have put this in the scripting forum, apparently. Both those suggestions work great. Somehow I missed the Application Method.

The 'New VI' primitive is still on the palette, at least the OpenG palette. I verified it still works in 8.2.1.

As for the lack of menubar, I am creating a standalone toolbar. If all other VIs are shut down, the toolbar still stays up because it is a VI. I wanted the option to bring up a blank VI so the toolbar wouldn't be so lonely.

Share this post


Link to post
Share on other sites

QUOTE(dsaunders @ Sep 14 2007, 04:58 PM)

As for the lack of menubar, I am creating a standalone toolbar. If all other VIs are shut down, the toolbar still stays up because it is a VI. I wanted the option to bring up a blank VI so the toolbar wouldn't be so lonely.

Ah. For that, you may want the VI property 'Set Close If Lonely' to be set TRUE. This is a scripting property which must be set by the tool VI on itself each time it is invoked (it doesn't persist through a save on the tool VI). This is what allows the tool to be closed whenever LV detects that it's the last VI open. I used it on the Tunnel Wiring Wizard.

Also, there are scripting properties to set a VI as a 'system' VI, which is a mod that does persist when the VI is saved. This is a VI flag that causes the tool VI to be invisible to the hierarchy window (I think it has other effects, but I can't recall). Also set on the TWW, at least my original version.

Hope this helps.

Best regards,

Dave

Share this post


Link to post
Share on other sites

For posterity, an easy way to create a new VI is to just use Open VI Reference on an empty template VI. Then you can do Open FP, or whatever other operations you wish, with the new instance of the template VI you just created.

-D

Share this post


Link to post
Share on other sites

Join the conversation

You can post now and register later. If you have an account, sign in now to post with your account.

Guest
Reply to this topic...

×   Pasted as rich text.   Paste as plain text instead

  Only 75 emoji are allowed.

×   Your link has been automatically embedded.   Display as a link instead

×   Your previous content has been restored.   Clear editor

×   You cannot paste images directly. Upload or insert images from URL.

Sign in to follow this  

×
×
  • Create New...

Important Information

By using this site, you agree to our Terms of Use.