Jump to content

Set a default path when clicking path browse


Neil Pate

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...

Link to comment
  • 3 weeks later...
 

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
Link to comment
 

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 🙂

Link to comment
 

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.

Link to comment
 

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
Link to comment
 

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
Link to comment
  • 2 weeks later...
On 3/14/2019 at 10:07 PM, Neil Pate said:

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 🙂

Why would you need an Open Sourced LabVIEW for something like that? This was possible in the Control editor since LabVIEW 3!!! (Discloser: the Browse button in the Path control was not added before somewhere around version 6 to 8 but the principle worked in LabVIEW 3).

1) Place a path control on your front panel

2)  Right click on it and select Advanced->Customize  => The path control opens in the control editor

3) Right click on the browse button and select Advanced->Customize   => The browse boolean control opens in the control editor

4) Save this as your Browse Boolean.ctl file or whatever you want to call it.

5) Use as you wish and enjoy that it automatically adapts to the platform style for the system you run it on

Browse.ctl

Edited by Rolf Kalbermatter
  • Like 2
Link to comment
7 hours ago, Rolf Kalbermatter said:

Why would you need an Open Sourced LabVIEW for something like that? This was possible in the Control editor since LabVIEW 3!!! (Discloser: the Browse button in the Path control was not added before somewhere around version 6 to 8 but the principle worked in LabVIEW 3).

1) Place a path control on your front panel

2)  Right click on it and select Advanced->Customize  => The path control opens in the control editor

3) Right click on the browse button and select Advanced->Customize   => The browse boolean control opens in the control editor

4) Save this as your Browse Boolean.ctl file or whatever you want to call it.

5) Use as you wish and enjoy that it automatically adapts to the platform style for the system you run it on

Browse.ctl 3.95 kB · 3 downloads

There must be another step or perhaps an ini-key because customise is greyed out for the browse button on my installations.

Untitled.png.8a96a72c81d2325d134a836aba3d4373.png

Link to comment

I thought it was not relevant when trying out things as I did various trials to get this working (The Control Editor has "particular" behaviour and controls easily can get in a weird state where for instance some of the parts end up in places where they seem not selecatable anymore in the customize mode, they still are but the position where you need to click to select them doesn't match the position on the front panel where they really appear.)

2)  Right click on it and select Advanced->Customize (or double click) => The path control opens in the control editor

2.5) Change to Customize mode (click on the Allen key which then changes to a pincer)

3) Right click on the browse button and select Advanced->Customize  Double click on the Browse button => The browse boolean control opens in the control editor

For step 2) double click and step 3) you might need to have the option enabled to open the custom control editor on double click, which is one of the first things I always enable when installing a new LabVIEW version, right after disabling auto tool and auto wire routing 🤢.

Edited by Rolf Kalbermatter
Link to comment

Join the conversation

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

Guest
Unfortunately, your content contains terms that we do not allow. Please edit your content to remove the highlighted words below.
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.