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: 

Validate the parameter when the pane mouse down occurred.

Dear sir,

 

I have implemented the logic for parameter validation when click on pane using mouse down event. But in my logic the events are contradicting. Kindly solve my pane mouse down event for attached Main_draft.vi.

 

Thanks & Regards,

S Nagaraju

+91 9989554142

0 Kudos
Message 1 of 10
(3,286 Views)

I'm having a hard time figuring out what you're trying to do with all of these mouse and key events. You have a lot of unnecessary sequence strctures and you do a lot of key focusing and I'm not sure exactly what the point is other than to annoy the user in to putting in the correct values. Smiley Very Happy

 

If you use a pane mouse-down event, it's going to get triggered when the user clicks within the pane, even if the user clicks on an object that already has another event registered. Why don't you just create a Value Change event for the inputs and buttons? This would only trigger when the user attempts to push a button, or changes a value. You really shouldn't use mouse-down/key-down events when you're checking values because it's overkill.

 

Also, your application locks the user from stopping the program if they've entered in a wrong value. This doesn't make for a good user experience.

Cheers


--------,       Unofficial Forum Rules and Guidelines                                           ,--------

          '---   >The shortest distance between two nodes is a straight wire>   ---'


0 Kudos
Message 2 of 10
(3,228 Views)

Thanks for the replay James,

 

My task is to develop an interactive GUI, for that first i have to validate the parameters entered by the user. Parameters are should validate based on the user inputs. Let us the user entered the value in one control and he moves on to another control, he may use "Tab" or "Enter" on keyboard and may use mouse also. At that time the parameter should validate with respect to the event done by the user. In this case, if i use the value change event difficult to validate because i have a value corresponding to units. Initially i was started with value change event only but due to values with units i faced the difficulties to validate. That’s why i am using the mouse and key down events.

 

Here i am using the key focus property because if the entered value is invalid it should be highlighted.

 

If i introduce Pane mouse down event, event contradiction was happened.

 

Kindly help me to develop the user friendly GUI. And please implement the one example VI for my reference.

 

Thanks & Regards

S Nagaraju

+91 9989554142

0 Kudos
Message 3 of 10
(3,202 Views)

One alternative may be to not allow bad input to begin with by filtering keystrokes.  (Personally, I'd strangle the person who implemented this, though.)

Bill
CLD
(Mid-Level minion.)
My support system ensures that I don't look totally incompetent.
Proud to say that I've progressed beyond knowing just enough to be dangerous. I now know enough to know that I have no clue about anything at all.
Humble author of the CLAD Nugget.
0 Kudos
Message 4 of 10
(3,159 Views)

@billko wrote:

One alternative may be to not allow bad input to begin with by filtering keystrokes.  (Personally, I'd strangle the person who implemented this, though.)


I had a GPS that did this.  It was fine-ish for street names, but it even did it for street numbers.  Once, I wanted to go to 75 main street or something and it only let me input a 2 as the first digit because for some reason it decided that every address number began with a 2 on that street.

 

Moral of the story, If you're not careful, this can lead to a pretty annoying UI experience.  Strangling well deserved.

0 Kudos
Message 5 of 10
(3,144 Views)

@11532 wrote:

because if the entered value is invalid it should be highlighted.

 


Contrary to your other points, this is the perfect reason for a value change event. Everything you do with your mouse and key down events can be done in a value change event. You could even change the value back to it's previous value if the new value invalid and highlight it.

Cheers


--------,       Unofficial Forum Rules and Guidelines                                           ,--------

          '---   >The shortest distance between two nodes is a straight wire>   ---'


0 Kudos
Message 6 of 10
(3,131 Views)

Hi James,

 

As you said, i will use value change event. Let us consider the two controls Frequency (value) and Freq units (Hz, KHz, MHz & GHz) both events are edited with value change events. The default value of the both controls are 2200 and MHz. Internally whatever units are given by the user i will convert to MHz and my limits are 2200 to 18000. The user wants to change the frequency value 5 GHz. The user entered 2200 to 5 means that the value change event has been occurred. While change the units it will validate and shows the invalid frequency because it’s taken the units as MHz.

 

Find the enclosed VI for more clarity and solve the issue.

 

 

Thanks & Regards,

S Nagaraju

 

0 Kudos
Message 7 of 10
(3,100 Views)

The really simple solution here is to just leave the units as GHz and not let the user change that.  Since you are always in the 2.2GHz to 18GHZ range, it makes little since to input MHz or lower.  Counting 0s is a pain.


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
0 Kudos
Message 8 of 10
(3,075 Views)

But, our customer asking drop down box for units.

0 Kudos
Message 9 of 10
(3,044 Views)

Since it is a hard requirement, here is what I suggest:

 

Instead of using doing a verification of the frequency when you change the units, change the value in the frequency control.  For instance, if you currently have 5000 MHz and you change the units to GHz, change the value in the frequency control to 5.  So your underlying frequency has not changed, therefore it is known to be valid.

 

Note: my full VI is attached in the zip file in case you don't want to mess around with the snippet.


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
Download All
0 Kudos
Message 10 of 10
(3,031 Views)