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: 

Control of deactivated control elements, bug or feature?

Hello community,

I came across that under certain circumstances it is possible to change even deactivated controls on the front panel of a LabVIEW application.

So I am wondering if this is a bug or a feature.

 

Say you have two boolean control elements which are checked inside a loop ("A" and "B"), don't care whether these "switch when released" or "latch when released".

Both of them deactivate and gray out all control elements of the front panel and start an operation which requires a significant amount of time.

After execution is finsihed the buttons become operative again.

These two controls can also be operated through hot-keys "F3" (for "A") and "F4" (for "B").

 

Let's say "A" has the input focus (i. e. through tab control).

Now you press "F4" and the operation connected with "B" will start.

The buttons "A" and "B" will be "Deactivated and Grayed Out".

But "A" will remain in focus which is clearly visible on the front panel.

And it is even possible to toggle its state, i. e. with using "space", which can be seen in a change of appearance on the front panel.

The change of state will be checked next time when the loop is executed.

 

This behaviour was observed on a Windows 7 machine using LabVIEW Professional Development System 2012 SP1 V12.0.1 (32-Bit)

 

My question is, why is it obviously possible to change control elements even when they are "Deactivated and Grayed Out"?

Why does the focus not change at all when hot-key control is used like in this case?

 

This could be related to the same background:

If you have a numeric or a string control and are putting in a different value on the front panel but not yet pressing "return" or switching to another front panel object so that it still remains in focus, and now you operate a boolean control through hot-keys, then the value of the previous control will NOT be updated before the value of the boolean control changes, and the previous control will remain in focus.

 

Regards,

Espelkamper

0 Kudos
Message 1 of 9
(3,089 Views)

Hi Espelkamper.

 

It sounds interesting. Could you add an example code where it is actually happening? So we can understand you better.

 

Thanks!

0 Kudos
Message 2 of 9
(3,045 Views)

Hi agomez.cr,

please find attached sample code where I have stripped down the actual project a little.

Here you can for example use tab control to highlight button A and then you can hit "F4".

During the delay it is possible to toggle button A although it is "Deactivated and Grayed Out".

You can also try this with button B highlighted.

My expectation is that changing the controls would not be possible as long as they are deactivated and grayed out.

 

And the second thing,

let's say the last delay value was "5000" (ms).

If you go to the "New delay time" and type in "1000" without using "enter" or clicking the mouse here, and now whenever you press "F2" or F3" or "F4" it should show "Chosen delay time" 5000 (ms).

This means the value for "New delay time" has not been updated and the focus remains with this control element.

This is also strange because I would have expected that the value of "New delay time" is updated before the value of whichever control linked to the hot-key control is updated.

 

Imagine you have a front panel with a dozen input fields which you navigate through using tab control to update the values.

And after putting in the last value you hit "F4" to start the next process.

Too bad because then the last value was not updated as one (or myself) might think.

 

Regards,

Espelkamper

0 Kudos
Message 3 of 9
(3,013 Views)

I agree that the behavior where a disabled button with focus can be toggled with the Enter key is weird. The behavior where the numeric value doesn't change because the numeric still has focus is normal. A numeric control does not update until it loses focus (nor do strings, unless they're set for "Update while typing.") I think you can fix both issues by checking the "Set focus on toggle" checkbox in the Key Navigation properties.

 

You might want to investigate using an event structure to handle your user interface.

Message 4 of 9
(2,997 Views)

Now I understand you.

 

I am not sure if this is exactly a bug or a feature. In some way, it seems to be natural that Labview doesn't update the value on a control while it's "in focus".

 

On the other hand, if you want to keep the tab and keys functionalities in your application, you can ensure that the user can't see this "mistake" by turning off the 'KeyFocus' property (wherever you require to) each time one of this process is started. In this way the user won't be able to hit space and change the state of the boolean again while one of the process is runing . 

 

Regards.

0 Kudos
Message 5 of 9
(2,986 Views)

Sorry for the delay, I was on a vacation for the last days.

Maybe I will with try this KeyFocus property.

And see if it helps.

But what I can't understand is why the focus is not switching automatically when hot-key control is used (which I think protects the value from being updated because there was no change in focus).

 

Regards,

Espelkamper

0 Kudos
Message 6 of 9
(2,920 Views)

I think it would be easier to try the solution proposed by nathand just checking the "Set focus on toggle" checkbox in the Key Navigation properties. The keyFocus property would be more like a programmatic approach (just in case you require it).

 

Regards!

Message 7 of 9
(2,901 Views)

In case it's not clear which option we're referring to, here's a screenshot of the checkbox you should enable to set focus on toggle:

SetFocusOnToggle.png

Message 8 of 9
(2,890 Views)

So I tried the proposed setting.

Great idea because now the behaviour is close to my expectation.

Thank you all for your help!

Regards,

Espelkamper

0 Kudos
Message 9 of 9
(2,842 Views)