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: 

"Prompt User" dialog default input text field

Solved!
Go to solution

I am trying to create a customised "Prompt User" input, where the dialog input text field will always have a default value displayed when the VI is called. I have a main VI, which calls a modified "Prompt User" VI. Below code is modified from the standard LV Prompt User. The "Default_Serial" control is wired to the connector pane as input.

EnterSerial.JPG

 

 

 

 

The main VI then looks like this.

mainVI.JPGBut it does not work. Can anybody help? 

 

 

 

 

 

Download All
0 Kudos
Message 1 of 8
(3,995 Views)

And in what way "doesn't it work"?

 

Why are you setting the value for a control through a value node, but also using an invoke node to Reinit All values to Default?  There is a race condition as to which will execute first.  But don't you think that you might be undoing what you are trying to do by setting a value for a control?

0 Kudos
Message 2 of 8
(3,990 Views)

I don't quite understand.. I didn't work as I expected because when I run the main VI, it "should" show "This is default serial number.." in the input field. The in actual fact the input field is empty.

Could you please suggest what I should do?

0 Kudos
Message 3 of 8
(3,988 Views)

Try removing the Default Values.Reinit All invoke node.  If that happens to run second, then it is just going to return your control back to the default value after you just set the value to something.

Message 4 of 8
(3,985 Views)

Can I use a flat sequence? I mean set the value of the control through value node, only after "Reninit"?

 

0 Kudos
Message 5 of 8
(3,984 Views)
Solution
Accepted by topic author splee

Just use the error wire so that it comes out of the Reinit node and goes into the Value node where you set the value.  That would be much simpler and you wouldn't need a sequence structure.

Message 6 of 8
(3,982 Views)

Thanks Raven. It works like magic!!

Why would the wiring of the error wire prevent race condition?

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

Dataflow!

 

A node can't run until it receives all the values on its inputs.  So it can't run until it gets a value on the error wire.  The error wire won't have a value until the Reinit node has completed.

 

Without any wires between the two, then you have a race condition.  Either node could wind up running first.

0 Kudos
Message 8 of 8
(3,973 Views)