LabVIEW

cancel
Showing results for 
Search instead for 
Did you mean: 

How to create an event form clicking the browse button from a path

I am trying to trigger an event based on a user clicking the browse button (path on the front panel), i'm new to event structure and can't figure out how to do this.  Does anyone have some old example code that they could share?

 

 

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

What are yo trying to do? The way I can think of to find the browse button would be to use the position info. Like this:

 

Example.png

You know how big the control is so you would have to figure out where the browse button is inside of that coordinate world.

Tim
GHSP
0 Kudos
Message 2 of 8
(3,175 Views)

If you right click on the event structure, add event case, you can select your path control from the list and set the event to 'Value Change'.

 

Niatross_0-1583930306038.png

 

This will trigger the event when the user changes the value of the path, either by typing or using the system file dialog which appears when you press the browse button.

 

If you need to specifically register a click on the browse button rather than just a value change this won't suffice, but I can't see a reason why you would want that. If that is the case I suggest you share more about what you are trying to achieve because I suspect that there is a better way of doing it.

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

Check for a Mouse Down? filter event on the path control.  If the Coords of the click is outside of the control itself, the button was clicked. 

This example checks for the button on the right of the path control.

Example_VI_BD.png

 

aputman
0 Kudos
Message 4 of 8
(3,131 Views)

@aeastet wrote:

What are yo trying to do? The way I can think of to find the browse button would be to use the position info. Like this:

 

Example.png

You know how big the control is so you would have to figure out where the browse button is inside of that coordinate world.


I used to make placeholder cases exactly like what you have there, with the dialog box - until one day I accidentally made a state machine whose state kept calling itself and I couldn't abort the VI because the message box kept getting in the way.  Now I use the beep.vi so I can hear that it went through the loop.  It's a lot easier to stop a runaway train that way.  😉

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.
Message 5 of 8
(3,130 Views)

Not if you are programming with sound canceling headphones on. 😁

Tim
GHSP
Message 6 of 8
(3,122 Views)

I can't really see a use for launching something off the clicking of the browse button.  It should do just one thing: open the file dialog box.  I think the OP meant to take some action after something has been selected.  You can always send the results of the folder/file selection to the something that you want to open.  It's pretty easy; it's been explained up above.

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

@aeastet wrote:

Not if you are programming with sound canceling headphones on. 😁


Hah!  Didn't think of that.  Excellent point.  🙂

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.
Message 8 of 8
(3,112 Views)