LabVIEW

cancel
Showing results for 
Search instead for 
Did you mean: 

Can I add Boolean programmatically?

Can I add a new boolean by clicking a boolean ?

I'll be appreciated if you attach a sample code.

Thank you.

0 Kudos
Message 1 of 6
(2,245 Views)

You can change the visibility of an existing booleans or add new elements to a booleans array.

 

You can add booleans using scripting, but that's editing.

 

Can you explain what you are trying to do?

0 Kudos
Message 2 of 6
(2,209 Views)

I'll pick a point of screen with mouse and then a new booleans will appear at the point.

The point is that  I need to add more than 100 booleans.

How can I do that?

0 Kudos
Message 3 of 6
(2,194 Views)

Can you explain the purpose? A boolean is just a logic value. Do you want to add a boolean control or indicator?

 

Adding a boolean to the front pane is pretty useless unless that boolean has a function and is wired to the rest of the code. You cannot change code while running.

 

Maybe all you need is a 2D picture indicator where you would draw things as a function of mouse click.

 

Or you could have a 2D array of booleans (Array container transparent, FALSE state transparent, TRUE state looking like the boolean you want.)

0 Kudos
Message 4 of 6
(2,186 Views)

@RingRoller wrote:

How can I do that?


Check out the example browser for VI-Scripting. You should find scripts like these:

https://forums.ni.com/t5/LabVIEW/Create-Control-From-Reference/td-p/1539816?profile.language=en

http://zone.ni.com/reference/en-XX/help/371361R-01/lvhowto/scripting_adding_objects/

 

However, as @altenbach wrote, these can only be used for editing. Most of them cannot be used on running VIs. For example, check this function: http://zone.ni.com/reference/en-XX/help/371361R-01/lvscript/vi_create_from_data_type/

In the "Remarks" section, look for "Settable when the VI is running" and "Available in Run-Time Engine".

 

If You could expand on why, when and where You want to create these 100 booleans, You may get advice for other solutions.

0 Kudos
Message 5 of 6
(2,184 Views)

@altenbach wrote:

Or you could have a 2D array of booleans (Array container transparent, FALSE state transparent, TRUE state looking like the boolean you want.)


Here's an invisible 2D array where clicking while the VI is running can make the boolean element appear and disappear.

0 Kudos
Message 6 of 6
(2,181 Views)