LabVIEW

cancel
Showing results for 
Search instead for 
Did you mean: 

more descriptive text in 2 button dialog

Good day one and all,

I am probably approaching this wrong, but what I am trying to do is make it so an operator enters a 4 digit serial number before the test is allowed to proceed. I am using the 2 button dialog and get the dialog box to pop up with the inputted serial number. Long term intent is to make this whole vi a sub vi that I can use on multiple test programs as they are developed.

Questions: Is there a way to add text to this dialog. Currently it simply displays XXXX (where XXXX is the 4 digit number I entered on the front panel), and the 2 buttons. I would like it to display, "Is XXXX correct ?" or some such similar dialog.

Second question: After entering the 4 digit number and confirming that it is the cor
rect number, the entry box for the serial number disappears off the front panel. Why does this happen ?

Thanks for any assistance anyone feels inclined to offer.
0 Kudos
Message 1 of 9
(3,657 Views)
To answer the first question, you can simply use the "Concatenate Strings" function and build whatever text string you would like displayed. So you would have 3 terminal "Concatenate Strings" function with a string constant of 'Is ' on the first terminal, your serial number on the second terminal and ' correct?' on the third. (all without the quotes, that's just to show spaces) This will build the string you want.

As for the second question, I've never seen a control disappear on it's own. You can hide front panel objects using property nodes, but they should not do it by themselves. It's hard to guess what's happening without seeing your code. The only thing I can suggest is to delete the control and replace it. It may be corrupted somehow, but this do
esn't even seem vary likely.

Ed


Ed Dickens - Certified LabVIEW Architect
Lockheed Martin Space
Using the Abort button to stop your VI is like using a tree to stop your car. It works, but there may be consequences.
Message 2 of 9
(3,657 Views)
Well, the text on the dialog is just a string. You can build any string you want, e.g. wire your number to "format into string" first, using Is %04d correct ? as format specifier, and wire the output to the two button dialog.

If the entry box disappears from the front panel, somebody must have programmed it this way. Look for a property node setting with visible set to "false". (right-click on the control, the select "find property nodes").

Are you modifying somebody elses program?
0 Kudos
Message 3 of 9
(3,657 Views)
Thank you Ed,
That pointed me in the right direction on the strings.
I've attached the code, though I'm a bit embarrassed as I'm very new to this and I'm picking up where someone else left off, so there are a lot of "holes" - some I see, some I surely don't. I simply don't understand what the property nodes are doing in this vi.
0 Kudos
Message 4 of 9
(3,657 Views)
Thank you for your suggestion. I'm not familiar with the use of the syntax you recommend, but I will give it some time and see what I come up with.

Yes, I am picking up where a former engineer left off and am not clear on why he did everything he did. This is obviously not my primary area of knowledge, but you do what you have to these days.

Again, thank you very much for your assistance.
0 Kudos
Message 5 of 9
(3,657 Views)
The Visable attribute of a property node is what hides the control on the front panel. A 'False' on the Visable attribute will hide the control. There is a String Length function reading the serial number length as it is entered, as soon as the length = 4, the 'Not Equal' function will output a False to the Visable property node hiding the control on the front panel.

For help on property nodes, right click on the attribute itself (Visable in this case) and select 'Help for Visable'. This will open the help to the page for that attribute and tell you what it does.

The Value node outside the loop on the left is clearing the string control by writing an empty string to Value attribute.

I've modified you VI to what I think you want
it to do. The number lenght is read until it is 4 characters, then opens the dialog for conformation and either stops and outputs the number, or clears the control so it can be re-entered. It's setup to used as a sub-vi so you can just drop it on the diagram where you need it.

Ed


Ed Dickens - Certified LabVIEW Architect
Lockheed Martin Space
Using the Abort button to stop your VI is like using a tree to stop your car. It works, but there may be consequences.
0 Kudos
Message 6 of 9
(3,657 Views)
Thank you again.

I'll give the vi a good look over. I appreciate the tip on the right click as well, seems there are a million little details like that, if you don't know the right spot, you'll never know something is available or can be accessed in thatmanner.
0 Kudos
Message 7 of 9
(3,657 Views)
Well, your code sure looks like beginners work and it is ever worse to leave it to another beginner to clean it up a bit ;-). Don't despair, you'll quickly get the hang of it!

The "value write" at the beginning clears the entry box in case there are some leftovers in it from an earlier run.

The entire diagram is overly complicated, e.g. the feedback node is a kludge to fix a wiring loop that would otherwise break the code. Also there is no time control in the loop. Basically, it checks the input and rewrites the property nodes inside the loop as fast as the machine can handle it (thousands of times per second), bogging down everything else. Personally, I also don't like the hiding of the control. If it should not be changed later, disable it. It
is nice if the operator can check the serial number even at a later point in time.

Think about the task as you would explain it to someone, it is much simpler that your code would suggest:
(1) Check the entry field until the length is four.
(2) Once this happens, verify input with popup.

I would use a simple event structure as in the attached example. Modify as needed. You might add some extra input checking, e.g. remove leading and trailing spaces and check for disallowed characters.
Message 8 of 9
(3,657 Views)
Quickly get the hang of it ? Not too sure about that, but time in the saddle will at least give me some experience.

Originally there was an indicator for the serial number, but when I cropped this out of the main program, I neglected to take that with it. The example you give does the job much neater of course, event structures I haven't even begun to look at yet.

Thanks a million.
0 Kudos
Message 9 of 9
(3,657 Views)