Jump to content
Neil Pate

Set a default path when clicking path browse

Recommended Posts

Does anybody know if it is possible to configure the path control so that when a user clicks the browse button the file dialogue that pops up has a custom filename pre-populated? You can do this easily with the dialogue prim, but I cannot figure out how to do this with the path control. I thought perhaps there would be an event that is fired off on browse, but it does not appear so.

I suppose I could hide the browse button and replace it with a regular button...

Share this post


Link to post
Share on other sites

I don't think there's a way to do it. You'll need to make your own browse button.

Share this post


Link to post
Share on other sites

Can't you use property node=>Path Text=>Scroll Position instead?

 

Share this post


Link to post
Share on other sites

The bug I mentioned is not in the LabVIEW control, it manifests in the Windows file explorer dialogue that pops up.

Share this post


Link to post
Share on other sites
 

Just set the default value of the control.

Does this work at runtime in an exe? I never thought to try this, thanks for the suggestion.

The problem is I need to set the default value as soon as the browse button is pressed, not before. There is no event exposed that will trigger when the browse button is clicked.

Edited by Neil Pate

Share this post


Link to post
Share on other sites

You can try the mouse down event, then set the match pattern and start path. That fires before the browse window appears.

Edited by Gribo

Share this post


Link to post
Share on other sites

But mouse down fires off when the user clicks anywhere in the path, I am after just the browse button.

I ended up replacing the button with my own one and it all works ok, just a bit of a bodge.

Share this post


Link to post
Share on other sites

The next easiest alternative is to find the browse button's coordinates.

Share this post


Link to post
Share on other sites
 

The next easiest alternative is to find the browse button's coordinates.

Yup, and now we are way too deep in the rabbit hole. A standard boolean does pretty much exactly what I need it just does not have an icon on it.

As soon a NI open sources LabVIEW we will be able to fix things like this 🙂

Share this post


Link to post
Share on other sites
 

As soon a NI open sources LabVIEW we will be able to fix things like this 🙂

Well. You could make an XControl.

  • Haha 1
  • Sad 1

Share this post


Link to post
Share on other sites
 

This works, but it uses a private property.

I've added that property to a list I'm maintaining of private properties/methods/events to move to public/scripting in a future LabVIEW release.

  • Like 1

Share this post


Link to post
Share on other sites
 

And then I have two problems... 

If that scares you then I don't give you good odds on "fixing" the LabVIEW source when it's released :D

I've just written two XControls. (First time in about 6 years). They seem to be ok but some of the ways they work can be a bit unintuitive.

Share this post


Link to post
Share on other sites
 

I've just written two XControls. (First time in about 6 years). They seem to be ok but some of the ways they work can be a bit unintuitive.

Coincidentally I just wrote a couple as well. I agree they seem OK for simple things, but the whole question of when and how they wake up makes them less usable. The main reason I want an Xcontrol is that a lot of things are combined controls+indicators. For example I have an indicator with the current value and the setpoint and some other stuff, and a control for the setpoint -- but you can't bind to user events, so you have to pick a proper 'direction' for the control and use a property for the other way and you end up having to marshal data around anyway. I don't hate them as much as I once did, but I don't like them.

I think the q guy had it right, basically just grouping control references together and using standard functions to manipulate the group as one: https://sine.ni.com/nips/cds/view/p/lang/en/nid/214228

 

Edited by smithd

Share this post


Link to post
Share on other sites
 

Coincidentally I just wrote a couple as well. I agree they seem OK for simple things, but the whole question of when and how they wake up makes them less usable. The main reason I want an Xcontrol is that a lot of things are combined controls+indicators. For example I have an indicator with the current value and the setpoint and some other stuff, and a control for the setpoint -- but you can't bind to user events, so you have to pick a proper 'direction' for the control and use a property for the other way and you end up having to marshal data around anyway. I don't hate them as much as I once did, but I don't like them.

I think the q guy had it right, basically just grouping control references together and using standard functions to manipulate the group as one: https://sine.ni.com/nips/cds/view/p/lang/en/nid/214228

 

Yeah mine were a little more obvious that an xcontrol was really the only elegant half-way decent solution. One was a string control with markup and the other was a tab control that works like the native one should. So it was really about encapsulation.

Edited by ShaunR
  • Thanks 1

Share this post


Link to post
Share on other sites
 

If that scares you then I don't give you good odds on "fixing" the LabVIEW source when it's released :D

.

Wow, glad I have my fireproof jacket on this morning! 🤣

Share this post


Link to post
Share on other sites

Join the conversation

You can post now and register later. If you have an account, sign in now to post with your account.

Guest
Reply to this topic...

×   Pasted as rich text.   Paste as plain text instead

  Only 75 emoji are allowed.

×   Your link has been automatically embedded.   Display as a link instead

×   Your previous content has been restored.   Clear editor

×   You cannot paste images directly. Upload or insert images from URL.


×
×
  • Create New...

Important Information

By using this site, you agree to our Terms of Use.