The Daily CLAD

Community Browser
cancel
Showing results for 
Search instead for 
Did you mean: 

Re: The Daily CLAD - Coding Challenge #3 - Mouse Over Counter

SercoSteveB
Active Participant

Create a VI that includes the Buttons and Numerics shown below (or similar) that counts and displays, for each Button individually, the number of times the mouse has passed over the button.  

NOTE:  The mouse passing over a button is defined as the mouse pointer entering the bounds of a button and then leaving.  This should increment the count by one .

All counters should start at zero and should individually be reset to zero if the mouse remains within the bounds of a button for at least 5 seconds.  After a 5 second reset the counter should be incremented to 1 as the mouse leaves the bounds of the button.

 

The Daily CLAD - Coding Challenge #3 - Mouse Over Counter.png

 

 

Comments
SercoSteveB
Active Participant

Coding Challenge #3 - Possible Solution.png

crossrulz
Knight of NI

Started with Steve's code, but instead of having to keep track of time that the mouse entered, just set the timout to 5 second.  When the mouse leaves, set the timeout to -1 (wait forever).  This eliminates useless timeouts for the structure and reduces the amount of checking needed.Challenge 3.png


GCentral
There are only two ways to tell somebody thanks: Kudos and Marked Solutions
Unofficial Forum Rules and Guidelines
"Not that we are sufficient in ourselves to claim anything as coming from us, but our sufficiency is from God" - 2 Corinthians 3:5
SercoSteveB
Active Participant

A much cooler way of managing the time, nice one crossrulz.

SercoSteveB
Active Participant

This one was viewed quite a few times but there has not been much interest in doing this challenge.  Was it anything in particular that people didn't like about this one?  

ARL00000000000000
Member

Hi Steve,

 

Initially this one seems very simple, but I really enjoyed the tricks that you and crossrulz used to make the solution much more elegant than my first attempt.

 

I have a question about the control references. Should we close them when we exit the while loop, or does it not matter?

crossrulz
Knight of NI

General rule of thumb, you only need to close references you explicitly had to open.  In the case of references to front panel items, you do not need to close them.  They will be closed with the VI itself.


GCentral
There are only two ways to tell somebody thanks: Kudos and Marked Solutions
Unofficial Forum Rules and Guidelines
"Not that we are sufficient in ourselves to claim anything as coming from us, but our sufficiency is from God" - 2 Corinthians 3:5