LabVIEW

cancel
Showing results for 
Search instead for 
Did you mean: 

How to generate a popup message when user entered out of range data.

Solved!
Go to solution

In brief,  I need to give below 100 decimal input data as input string like "99".

 If I give "121" as input string then need to display pop up a message as check data,

If i give "92" , "91", "1","12","93"
then it is valid data no need to give pop up message.Only have to provide pop up message when invalid data entered by user and not to be display pop up when endtered within range data.

0 Kudos
Message 1 of 8
(3,889 Views)

Hi l12,

 

some pseudocode:

IF NOT(InRangeAndCoerce(input, limits) THEN
  OneButtonDialog(Warning)
ENDIF

(IF-THEN-ELSE is a case structure, the rest are simple LabVIEW functions.)

 

You might use a numeric control instead of your string and set its input range to just the allowed values. Much easier than to check values afterwards…

Best regards,
GerdW


using LV2016/2019/2021 on Win10/11+cRIO, TestStand2016/2019
0 Kudos
Message 2 of 8
(3,885 Views)

Actually, If I need to expects 3 inputs from user, but user has provides only one,or two instead of three then I need to display a pop up message like" please enter all input  ".

The same above how can I achieve for different aspects in my .vi file.

Please suggest me a solution.

0 Kudos
Message 3 of 8
(3,880 Views)
Solution
Accepted by topic author l12ec937

Hi i12,

 

If I need to expects 3 inputs from user, but user has provides only one,or two instead of three then I need to display a pop up message like" please enter all input  ".

Some pseudocode:

IF ArraySize(array of input values) <> 3 THEN
  OneButtonDialog("Please enter all input!")
ENDIF

Seems rather simple to me…

Best regards,
GerdW


using LV2016/2019/2021 on Win10/11+cRIO, TestStand2016/2019
0 Kudos
Message 4 of 8
(3,872 Views)
Solution
Accepted by topic author l12ec937

In fact, it's a VERY BAD idea to create pop-ups if the user is mistaken.
YOU MUST deprive the user of making mistakes.
In your case, as GerdW correctly noted, you must specify an input range for numeric controls.
In addition, if the "next" button is used, it must be disabled, if the data is not all.

disable.png


It is even better to set the default values for all input fields, then the user will have to enter less data.

0 Kudos
Message 5 of 8
(3,856 Views)

@Artem.SPb wrote:

In fact, it's a VERY BAD idea to create pop-ups if the user is mistaken.
YOU MUST deprive the user of making mistakes.
In your case, as GerdW correctly noted, you must specify an input range for numeric controls.
In addition, if the "next" button is used, it must be disabled, if the data is not all.

disable.png


It is even better to set the default values for all input fields, then the user will have to enter less data.


I wouldn't say it's a VERY BAD way of doing it, but using reactive methods to correct input errors dropped out of fashion at about the time DOS did.  As mentioned, it's best to prevent the user from entering bad input whenever possible in the first place.  If you can do that (and it's not always the case), you don't have to develop code to deal with bad data.

 

For instance, if an instrument command is 0 for local and 1 for remote, the so-so choices are:

  1. String control, check for valid strings, and
  2. Integer Value, check for range.

The best way is an enumerated control with Local = 0 and Remote = 1, with digital display enabled, and with the label being the parameter being set.  Now the user can only select valid choices, saving us lots of coding effort.  (Furthermore, the label gives the user feedback on which parameter is being adjusted, and the item name + digital display ensures that they know what they are setting it to.)

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 6 of 8
(3,834 Views)

@billko wrote:

I wouldn't say it's a VERY BAD way of doing it, but using reactive methods to correct input errors dropped out of fashion at about the time DOS did.


In my opinion, this is not just a "fashion".
Usability experts and psychologists say that when the program "scolds" the user (and the pop-up error message is just such a case), the user finds himself stupid and guilty. He does not scold the programmer or program, but blames himself for the error and loses the desire to work with the program.
And I do not want users of my programs to consider themselves stupid and lose interest in the work 🙂

0 Kudos
Message 7 of 8
(3,821 Views)

@Artem.SPb wrote:

@billko wrote:

I wouldn't say it's a VERY BAD way of doing it, but using reactive methods to correct input errors dropped out of fashion at about the time DOS did.


In my opinion, this is not just a "fashion".
Usability experts and psychologists say that when the program "scolds" the user (and the pop-up error message is just such a case), the user finds himself stupid and guilty. He does not scold the programmer or program, but blames himself for the error and loses the desire to work with the program.
And I do not want users of my programs to consider themselves stupid and lose interest in the work 🙂


I always just assumed I was stupid and uninterested in my work; I had no idea I was being coerced!  😉

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 8 of 8
(3,811 Views)