LabVIEW

cancel
Showing results for 
Search instead for 
Did you mean: 

Slow button navigation event response

Solved!
Go to solution

Hello,

I upload a demo interface to demonstrate a problem that I encounter.

 

I use a tab control and "OK Buttons" to change tabs.

The appearance of the "OK buttons" is changed by pasting images from Microsoft Visio, through Button's right click-> Advanced -> Customize.

The clicks on the "OK Buttons" are captured using the "Value Change" in an "Event Structure".

 

The problem is that sometimes an "OK Button" needs more than 1 click to work. In the original interface which has more decorations, the "OK Buttons" need many ....many... clicks to go to another tab.

 

What is more, the tabs are not clickable when the program is in "Run mode".

 

What should I change?

 

Thank you.

0 Kudos
Message 1 of 12
(4,717 Views)

Most likely your clicks miss the button. You should make the button the same size as the image. Also, make the button transparent and be sure it is in front of the image so that the click registers.  Note in the image below that I moved the arrow to reveal the underlying button. If you do not click where the button is, it does not activate the button.

 

Button and image.png

 

Why would you want an event structure inside a timed loop?  Use a regular while loop. Make sure you have a stop button and an event case for its value changed event.

 

Lynn

0 Kudos
Message 2 of 12
(4,704 Views)

Hello!

 

The button does not need to be the same size as the image behind which it is hided.

In the page 3 of the Tab Control, you can see a big image behind which the button has the regular size. If you click at a corner of the image, it works.

 

The Timed Loop is the loop that runs the program. If I use a while loop then the program runs every single possigle instance and has a great CPU usage.

That's why I use the Event Structure inside the Timed Loop.

 

If I put the Event Structure inside a While Loop which is out of the Timed Loop, then I see in my orignal interface that the performance is better, but there is still some latency.

 

So, which is the correct way to have the proper time performance at event handling of decorated buttons?

0 Kudos
Message 3 of 12
(4,688 Views)

Well, Lynn is typically right, so don't dismiss his advice.


@nikosfs wrote:

 

The button does not need to be the same size as the image behind which it is hided.

In the page 3 of the Tab Control, you can see a big image behind which the button has the regular size. If you click at a corner of the image, it works.


Whatever you are doing is just plain ugly. You should import at the same size.


nikosfs wrote:

The Timed Loop is the loop that runs the program. If I use a while loop then the program runs every single possigle instance and has a great CPU usage.

That's why I use the Event Structure inside the Timed Loop.


Thank statement makes no sense. The loop only spins when an event occurs and that would be the same with a plain old while loop. You don't wire a timeout on the event structure, so the timeout will never occur. Why would you use all the complications of a timed loop if never has control over the configured loop rate?

 


nikosfs wrote:

If I put the Event Structure inside a While Loop which is out of the Timed Loop, then I see in my orignal interface that the performance is better, but there is still some latency.


That makes little sense either. How do you measure "performance"? All the time loop is prevent successive events to ocur faster than 100ms apart. I doubt you'll be able to press that fast, especially since tabs are switched and the click position changes between tabs.


@nikosfs wrote:

So, which is the correct way to have the proper time performance at event handling of decorated buttons?


Well, do the suggested changes and see how things improve. Then post back.

0 Kudos
Message 4 of 12
(4,655 Views)

When I replace the Timed Loop with a While Loop, then the CPU usage of the LabView process is 50%.

How can I make the button transparent?

How do you explain the fact that the event is triggered when a click is occured at a point of the image that is not over the button that is hided behind?

0 Kudos
Message 5 of 12
(4,626 Views)

@nikosfs wrote:

When I replace the Timed Loop with a While Loop, then the CPU usage of the LabView process is 50%.


Please attach your code. If I take your code and right-click the wtimed loop...replace with while loop, wire a stop button to the termination condition, and run the VI, CPU use is negligible (as expected). You must be doing more than just that.

 


nikosfs wrote:

How can I make the button transparent?


What button? Please be more specific!

 


nikosfs wrote:

How do you explain the fact that the event is triggered when a click is occured at a point of the image that is not over the button that is hided behind?


That is normal behavior. No need to explain anything.
.

 

0 Kudos
Message 6 of 12
(4,621 Views)

I looked at the controls again. It seems that clicking within the bounds of the label does not activate the button but clicking anywhere else within the decal works.

 

Lynn

0 Kudos
Message 7 of 12
(4,616 Views)

@johnsold wrote:

I looked at the controls again. It seems that clicking within the bounds of the label does not activate the button but clicking anywhere else within the decal works.


Yes, exactly. Some labels are on top of the decals, thus excluding some areas from click detection.

0 Kudos
Message 8 of 12
(4,612 Views)

If the Labels are not at the top of the decals, they will not be visible. But if they are on top they exclude a clickable area. So?

 

If I make the buttons bigger than the images, I need to make them transparent, but I don't find how I can do that.

 

I attach the vi file again, this time with the while loop. It doesn't seem to occupy 50% of the CPU usage, but my original interface does it, having similar code.

 

0 Kudos
Message 9 of 12
(4,595 Views)
Solution
Accepted by nikosfs

@nikosfs wrote:

If the Labels are not at the top of the decals, they will not be visible. But if they are on top they exclude a clickable area. So?


Use the boolean text and hide the label


nikosfs wrote:

If I make the buttons bigger than the images, I need to make them transparent, but I don't find how I can do that.


You need to import the pictures into the button, not the decals. (see the button in page 2 I have modified in the attached VI. I did not hcange anything else....).


nikosfs wrote:

I attach the vi file again, this time with the while loop. It doesn't seem to occupy 50% of the CPU usage, but my original interface does it, having similar code.


You probably wired a zero to the timeout.

Also, for latch action buttons, terminals belong into the respective events. Note also the coercion. You enum diagram constant is of the wrong type.

 

 

0 Kudos
Message 10 of 12
(4,586 Views)