From Friday, April 19th (11:00 PM CDT) through Saturday, April 20th (2:00 PM CDT), 2024, ni.com will undergo system upgrades that may result in temporary service interruption.

We appreciate your patience as we improve our online experience.

LabVIEW

cancel
Showing results for 
Search instead for 
Did you mean: 

hiding and enabling button and controls

Properties remain unless you change them. You can change them programmatically via property nodes or at edit time by right-clicking on the control and select "advanced..enabled state..." in this case.

If you want to disable a control only while the FOR loop is running, you could do something like the following:

Make sure there is data dependency (e.g. with the error cluster) to ensure that the second node can only execute after the FOR loop is finished (and not concurrent with it, defeating the purpose).

Can you tell us a little bit more what you actually want to do? There are probably better ways than to constantly micromanage the enabled state.

 

 

 



Message Edited by altenbach on 02-17-2008 04:13 PM
0 Kudos
Message 11 of 14
(656 Views)

that does do what i was looking for, thank you

it is a lot of work to do though for the many controls i want to disable and uses alot of back panel real estate is used.

its frustarting, in most other OO, its just oo.disable, oo.enable.

 

my goal is simple, i do think you understand, you got the answer already..  im shooting for a user friendly interface.

if a control cant be used, ie, it resides outside the main loop, i want it to be greyed out.

This is just a way i alteat have always made applications, only current options are there for the user to see.

many of the controls, such as those that create while loops of large arrays, i have outside my main loop so they dont slow execution speed since they only need to run once.

Those variables controlling them are only options before execution begins

 

thanks

 

 

 



Message Edited by jimmyinCT on 02-17-2008 06:42 PM

Message Edited by jimmyinCT on 02-17-2008 06:43 PM

Message Edited by jimmyinCT on 02-17-2008 06:44 PM
0 Kudos
Message 12 of 14
(650 Views)


jimmyinCT wrote:

that does do what i was looking for, thank you

it is a lot of work to do though for the many controls i want to disable and uses alot of back panel real estate is used.

its frustarting, in most other OO, its just oo.disable, oo.enable.

That's basically what is happening in Altenbach's example.  OO is the block on the diagram that is intrinsically linked to the control.  Enable is the property.  In LV, because things can happen concurrently or in multiple threads, you need to define the wires so that the dataflow defines in which order the functions execute.  Without it, the computer will decide the order of the tasks.  In a text programming language, this is all determined by the order that the commands are typed.

my goal is simple, i do think you understand, you got the answer already..  im shooting for a user friendly interface.

if a control cant be used, ie, it resides outside the main loop, i want it to be greyed out.

This is just a way i alteat have always made applications, only current options are there for the user to see.

many of the controls, such as those that create while loops of large arrays, i have outside my main loop so they dont slow execution speed since they only need to run once.

Those variables controlling them are only options before execution begins

By "before execution begins" do you mean by pressing the run arrow on the toolbar?  Since this sounds like you want a user interface for a general computer user as opposed to an experienced LV user, you will probably want your actual code to begin running right away.  If you have control settings that need to be made for executing the heart of your code, you may want to program a GO button on your code so that LV will wait in a loop waiting for that to be pressed before continuing on to the heart of the code.  Though better programming architecture would use event structures to detect button presses.

thanks

Since you will have numerous controls to set the properties of, you may want to do it this way.  At the beginning of your code, build an array of references to each of the controls you would want to enable or disable.  You can pass that array of references into a For loop along with an array that defines the enabled status for each of the controls.  See below.




Message Edited by Ravens Fan on 02-17-2008 11:09 PM
Download All
0 Kudos
Message 13 of 14
(635 Views)

Hi Jimmy,

      It seemed you were (rightly) concerned about the complexity of your code - given the large number of expected FP controls(?)  If so, here's Ravens Fan's example - using a Cluster to bundle related FP items; note that the cluster background color has been changed to transparent to show the cluster need-not be visible to the user (the border can be made transparent too.)  Also, the two controls "stop" and "A or B" are not members of the Cluster.  Before you build a cluster with hundreds of controls, give us an idea of what the FP will look like.  It might be that the FP will be best organized with an array - perhaps an array of clusters...

Cheers!



Message Edited by tbd on 02-18-2008 12:15 AM
"Inside every large program is a small program struggling to get out." (attributed to Tony Hoare)
Download All
0 Kudos
Message 14 of 14
(625 Views)