LabVIEW

cancel
Showing results for 
Search instead for 
Did you mean: 

Can String Indicator/Control be created at run-time???

Solved!
Go to solution

I have an appln in which i need to create a certain number of string indicator(s)/control(s) based on a particular numeric selection made by the user. One thing that I can do is that create the max number of controls & use the Visible Property Node to show only the selected no. of controls. But by doing this my appln would become very complex. So if anyone could suggest me how it can be at run-time as this will save memory also.

Thanx in advance

0 Kudos
Message 1 of 13
(4,615 Views)

Controls cannot be created at run-time. You've already identified the only method that will work for you - to create all your controls in advance and make them visible/invisible as required.

 

If you handle all these control references in an array, then your code shouldn't get unnecessarily complicated.

Thoric (CLA, CLED, CTD and LabVIEW Champion)


Message 2 of 13
(4,612 Views)

Jalpa wrote:

I have an appln in which i need to create a certain number of string indicator(s)/control(s) based on a particular numeric selection made by the user. One thing that I can do is that create the max number of controls & use the Visible Property Node to show only the selected no. of controls. But by doing this my appln would become very complex. So if anyone could suggest me how it can be at run-time as this will save memory also.

Thanx in advance


 

Custom GUI graphic question are besy handled if you post a mock image illustrating your desired results.

 

Lacking images of what you want...

 

Thoric's reply re your approach is valid.

 

"Creating controls on the fly" is possible but it is not trivial (been ther done that).

 

Ben

Retired Senior Automation Systems Architect with Data Science Automation LabVIEW Champion Knight of NI and Prepper LinkedIn Profile YouTube Channel
Message 3 of 13
(4,596 Views)
Solution
Accepted by topic author Jalpa

Agree with Ben and Thoric, you can't create controls at Run-Time easily.

 

How to handle your situation - it depends from your final goals - you can create enough strings, then turn on/off with visible property, or may be reorganize your application - use tables/multicolumn list boxes instead of strings, use arrays of strings, etc.

 

Anyway, one possible way for creating controls in runtime in attachment. Here XControl with linked list used and with this VI you can "create" boolean buttons dynamically. This idea useful when you don't know initially - how many buttons you needed in your application (I started with this for dynamic creation of the ToolBar). You can replace Button with String in this example. May be this will be helpful for you.

 

Andrey.

 

Message 4 of 13
(4,580 Views)

Andrey - I'm having trouble getting your attached example to work. It loads fine, with no broken run arrow, but achieves nothing when the front panel buttons are selected. I'm no expert in XControls, so is it possible I need to turn on an option somewhere before the XControl will work?

(LV 8.6, WinXP SP3)

Thoric (CLA, CLED, CTD and LabVIEW Champion)


0 Kudos
Message 5 of 13
(4,567 Views)

Close all other your projects. Open only attached example. Then it should work.

(FYI: problem located in Root_XControl.xctl:Create_New_Button.vi)

 

Andrey.

 

Message 6 of 13
(4,562 Views)

Ah yes, I see it:

 

Very nice code though! Thanks for sharing it with us Smiley Happy

Message Edited by Thoric on 04-17-2009 01:56 PM
Thoric (CLA, CLED, CTD and LabVIEW Champion)


0 Kudos
Message 7 of 13
(4,554 Views)

Thanks. This code not completely my code. Thanks for one of NI Engineers (don't remember who is author exactly)

http://decibel.ni.com/content/docs/DOC-1209

 

Andrey.

 

0 Kudos
Message 8 of 13
(4,543 Views)

Thanx Andrey

 

This is exactly what I was looking for "creating controls/indicators at run-time. I'l go through the links which demonstrate how XControls can be created coz finally I want to create a customized control at run-time, so will try to export the customized control to XControl.

0 Kudos
Message 9 of 13
(4,444 Views)

You need to change your accepted solution. Now you can really create control/indicators at run time See this

 

http://forums.ni.com/ni/board/message?board.id=170&thread.id=443761

Tushar Jambhekar
tushar@jambhekar.com

Jambhekar Automation Solutions
LabVIEW Consultancy, LabVIEW Training
Rent a LabVIEW Developer, My Blog

0 Kudos
Message 10 of 13
(4,187 Views)