Jump to content

Force File Read on Load...


Recommended Posts

I have finally written my first app in labview. I'm tired, sleepy, hungry, kinda stinky too... but all that aside, i'm almost done, i'm under budget, i'm under in time, and everyone is happy... Almost.

there's 1 thing I have left to do, reading though code, i have yet to figure out how.

here's the principal idea... i'm open to suggestions.

I have a "Front Page" VI were 'everything happens' (Test is prefomed, etc etc.)

On another tab I would like to create a area to "create a part". The idea is each part has different parameters. So i need an "Edit" type screen so that a user can create a new part, edit a part, or delete a part. This, isn't too terrible. I can handle most of these operations.. but now what i DO need is on the front panel...

I would like to use a Combo Box/ Ring Menu selector, or something to allow the user to select a "part". but, i need to populate this ring menu by the list of file names in a directory (Parts that were created by the user).

So, say for example bobby makes 5 parts, which in turn created 5 files.

Part_Test1.prt

Part_Test2.prt

Big_Part3.prt

Huge_Part4.prt

Tiny_Part5.prt

I would like the VI to show in the ring menu selector or combo box "Part Test 1" ... "Tiny Part 5"...

just trying to figure out how to envolk something like this to happen when the VI loads.

<breath>

Thanks!!!!!

Link to comment
I would like to use a Combo Box/ Ring Menu selector, or something to allow the user to select a "part". but, i need to populate this ring menu by the list of file names in a directory (Parts that were created by the user).

...

Part_Test1.prt

...

To get the file names you can use the "List Folder" function found in File I/O>>Advanced File Functions. Use *.prt as the pattern.

I would like the VI to show in the ring menu selector or combo box "Part Test 1" ... "Tiny Part 5"...

You can do some simple string manipulation of the file names to get this.

post-1519-1169064815.gif?width=400

just trying to figure out how to envolk something like this to happen when the VI loads.

Just run the code to load the ring strings at the start of the VI. You can load the ring with a property node "Strings []". And keep an array of the file names that corresponds to that same array that you loaded the ring with.

David

Link to comment

Thats about what I was thinking, now the trickery...

How do i automatically have one of those items selected when the VI loads?

Say for example i create a "default" file... this file just keeps track of the last information that the user selected, say "Tiny Part 5".

When they reload the VI i want to make sure that Tiny Part 5 is loaded... and all the appropreate things that normally selecting that "Tiny Part 5" from the ring menu would load...

I can explain it better though some psuedo code

if firstload = true then

open default.prt

load defaults to controls

ring.text = part name

end if

thanks!

Link to comment
Thats about what I was thinking, now the trickery...

How do i automatically have one of those items selected when the VI loads?

Say for example i create a "default" file... this file just keeps track of the last information that the user selected, say "Tiny Part 5".

I thought there was something I was missing... Thanks for the clarification.

For the "if first load" step, you can use the "First Call?" block found under sychronization.

After that it seems that the solution depends on what the .prt files look like. You have to address the case that default.prt does not exist, and if it does exist it needs to point to the correct file. Then you can remove default.prt from the list of .prt files, but load the parameters from the correct file.

Is there some parameter in the .prt file that would allow a redirection to the correct file?

Another way might be to save a copy of the .prt file with some prefix (~Tiny_Part5.prt). This would require you to maintain just one file with the prefix.

Also you might save some settings in a separate file, such as an ini file. One of those settings would be "last part file".

Once you know what the correct file is, you have two tasks mentioned. You need to load the file settings to the controls and you need to set the ring to the proper index. It seems that you know how to do this.

Link to comment
I thought there was something I was missing... Thanks for the clarification.

For the "if first load" step, you can use the "First Call?" block found under sychronization.

After that it seems that the solution depends on what the .prt files look like. You have to address the case that default.prt does not exist, and if it does exist it needs to point to the correct file. Then you can remove default.prt from the list of .prt files, but load the parameters from the correct file.

Is there some parameter in the .prt file that would allow a redirection to the correct file?

Another way might be to save a copy of the .prt file with some prefix (~Tiny_Part5.prt). This would require you to maintain just one file with the prefix.

Also you might save some settings in a separate file, such as an ini file. One of those settings would be "last part file".

Once you know what the correct file is, you have two tasks mentioned. You need to load the file settings to the controls and you need to set the ring to the proper index. It seems that you know how to do this.

ah! I was just thinking about it a little too hard I guess... I never really thought about the "first call" control.

I am thinking like a c# programmer still where i'm thinking "what code launches first"... where... in this case it doesn't really matter.

for a file logistics, I'm probably just going to go to a default.ini file that will hold last part "selected" and a few other details about the software, which will have to load after i load the ring control will all the part names. Then I can use the default file to select the proper 'part' and load the controls with the approperate data.

Thanks! Makes more sense now

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