Jump to content


- - - - -

[LVTN] JGCODE Preferences Dialog Library


34 replies to this topic

#21 jgcode

    LabVIEW Renegade

  • Premium Member
  • 2,348 posts
  • Location:Australia
  • Version:LabVIEW 2009
  • Since:2005

Posted 30 January 2012 - 09:44 PM

View PostYair, on 30 January 2012 - 03:17 PM, said:

One additional comment: I'm personally not a fan of providing the name of something in more than one place. If ignoring controls on the front panel is common (and I'm guessing it actually isn't very common), then I would prefer if the template included a for loop which iterates over every control reference given to it and extracts its Label.Text property to use as the filtering array.

Of course, since the default is to have no control, this code could be in a disable structure, or you could feed it one of the built-in controls, which I assume is meaningless, since it filters them anyway.

The interface is a string array, so the user can populate it however they want (I would do it like the above too).
However, I am happy with the template as this is really an edge use case I exposed.
I actually use it to filter the default template controls etc... (otherwise LabVIEW crashed when it tried to write the tag refs to disk using OpenG :)) but this is all done internally in the engine.

View PostShaunR, on 30 January 2012 - 03:45 PM, said:

...it doesn't really make any difference if you do add all controls since who expects a control on a preferences dialogue not to remember what you put in it?

One example I can think of is that it may have to do with localisation?
Using an Indicator to display a piece of text (e.g. like a decoration/title that's constant) as opposed to using Free Text.

#22 neil

    Very Active

  • Members
  • PipPipPip
  • 209 posts
  • Location:Surrey, UK
  • Version:LabVIEW 2011
  • Since:2004

Posted 30 January 2012 - 10:26 PM

Jon,

Dummy project is attached. I recreated it this evening.

In the JG CODE pallette there are only three VIs right? I downloaded the latest package (.20?), but cannot find any examples.

Am I doing something stupid?

Attached File(s)



#23 jgcode

    LabVIEW Renegade

  • Premium Member
  • 2,348 posts
  • Location:Australia
  • Version:LabVIEW 2009
  • Since:2005

Posted 30 January 2012 - 10:30 PM

View Postneil, on 30 January 2012 - 10:26 PM, said:

Jon,

Dummy project is attached. I recreated it this evening.

In the JG CODE pallette there are only three VIs right? I downloaded the latest package (.20?), but cannot find any examples.

Am I doing something stupid?


Thanks I will have a look
The examples should be at the location described in the VIPM Info (screenshot above) - are they not there?
Now with the engine encapsulated there are only two main VIs you will use, plus I included the dynamic call to the Pref Dialog in case someone wanted to make their own wrapper.

#24 jgcode

    LabVIEW Renegade

  • Premium Member
  • 2,348 posts
  • Location:Australia
  • Version:LabVIEW 2009
  • Since:2005

Posted 30 January 2012 - 10:51 PM

Hi Neil

The problem you are experiencing is that you are not providing a valid config path/location.
I have just used a meaningless placeholder in the template and running it generates any error which is causing the issue.

Attached Image: Required.png

Nevertheless, I will look into handling this case better.

Thanks for posting the code.

#25 jgcode

    LabVIEW Renegade

  • Premium Member
  • 2,348 posts
  • Location:Australia
  • Version:LabVIEW 2009
  • Since:2005

Posted 31 January 2012 - 12:25 AM

I have had a look at this - I can definitely make improvements regarding errors.
However, the Framework pops up errors on close, so regardless of where the error occurs in the Engine's state machine, the FP of the Page is still going to show (when I do the fix).
In the case of the invalid config with a basic Page (i.e. one generated from a template) it means the user will waste time changing data, then it won't save, then they will get an error at the end.
So I recommend prechecking that information before launching the dialog.
This is pretty much the only error due to external reasons that the engine will have to worry about (file io).
I could add it to the Preferences Dialog.vi, in that it could perform certain checks and if valid then launch dialog, if not then create and error.
Looking at the OpenG Valid Path.vi that would have passed the file path as ok in the above example so that doesn't really help - so I will need to look at this further.

Also I envisage that you could run the Engine in parallel with other code if you wanted to do stuff other than just save data to disk e.g. validate data etc...
You could do something that would look similar to in terms of parallelism (ignore the user event ref into the engine, the rendezvous etc... this image comes from a different context, but it was quick to post):

Posted Image

In this case you could handle the errors at the time they occur relative to that screen etc... in your own code

#26 jgcode

    LabVIEW Renegade

  • Premium Member
  • 2,348 posts
  • Location:Australia
  • Version:LabVIEW 2009
  • Since:2005

Posted 31 January 2012 - 10:10 AM

Ok v21 is up in the LAVA-CR
I updated the error handling in the Engine based on the feedback above in an attempt to make it more robust.
Additionally I added a Precheck Config File Path VI as a utility VI (and exposed it in the palette)
You can use your own, but it should eliminate most issues:

Attached Image: Precheck.png

The VI ensures the path is not empty; is not relative; and the folder where it is gonna be, has been created:

Attached Image: Precheck BD.png


Additionally I added the suggest method to filter to the example and removed the string array altogether from the template.vit.

Attached Image: Filter.png

My next task is to see if I can get this to build (rather than just be a tool in the IDE) - and handle relinking issues to <resource>.
I have added provisions in this code for this - but I contact the relevant authorities to see what I can do :)

#27 neil

    Very Active

  • Members
  • PipPipPip
  • 209 posts
  • Location:Surrey, UK
  • Version:LabVIEW 2011
  • Since:2004

Posted 31 January 2012 - 11:19 AM

:thumbup1: :beer_mug:

Great works, thanks for pointing out the PEBKAC error :-)

Installed the new version, and the examples are there also.

Quite keen to give this a whirl in my next application, so if you need any help testing it out just let me know.

#28 jgcode

    LabVIEW Renegade

  • Premium Member
  • 2,348 posts
  • Location:Australia
  • Version:LabVIEW 2009
  • Since:2005

Posted 31 January 2012 - 11:29 AM

View Postneil, on 31 January 2012 - 11:19 AM, said:

:thumbup1: :beer_mug:

Great works, thanks for pointing out the PEBKAC error :-)

Installed the new version, and the examples are there also.

Quite keen to give this a whirl in my next application, so if you need any help testing it out just let me know.


Thanks!

I appreciate the (testing) gesture - I will be sure to hit you up!

#29 crelf

    I'm a LAVA, not a fighter.

  • V I Engineering, Inc.
  • 5,535 posts
  • Version:LabVIEW 2011
  • Since:1993

Posted 31 January 2012 - 03:54 PM

Kudos on the package Jon - now I can deprecate our internal reuse package: and that makes me very happy :)
Posted Image

#30 jgcode

    LabVIEW Renegade

  • Premium Member
  • 2,348 posts
  • Location:Australia
  • Version:LabVIEW 2009
  • Since:2005

Posted 31 January 2012 - 08:27 PM

View Postcrelf, on 31 January 2012 - 03:54 PM, said:

Kudos on the package Jon - now I can deprecate our internal reuse package: and that makes me very happy :)


Thanks Crelf (I think I had a Skype fail)

If you have any feedback based on your experiences to make this better please post :)

#31 mike_nrao

    Active

  • Members
  • Pip
  • 23 posts
  • Location:Flagstaff AZ
  • Version:LabVIEW 2011
  • Since:2002

Posted 07 February 2012 - 10:59 PM

It's neat and clean that you took the event structure out of the preference dialog page VI, BUT now how would one add functionaly to their preferences VI. As an example, I'd like a drop down box to select a category, then a second drop down box to dynamically modify its items accordingly. Another example: Browse for path to csv file, which populates a table of numbers (in this case, it's only the data in the table that I care to store to file, not the path, since I don't want to perform the file access later). Does this framework allow such behavior?

<update>
You already answered my question above I think where you said 'Also I envisage that you could run the Engine in parallel with other code'. I see now that it's possible.

Edited by mike_nrao, 07 February 2012 - 11:00 PM.


#32 jgcode

    LabVIEW Renegade

  • Premium Member
  • 2,348 posts
  • Location:Australia
  • Version:LabVIEW 2009
  • Since:2005

Posted 07 February 2012 - 11:05 PM

View Postmike_nrao, on 07 February 2012 - 10:59 PM, said:

<update>
You already answered my question above I think where you said 'Also I envisage that you could run the Engine in parallel with other code'. I see now that it's possible.


No probs.

Please post any examples you do (if you can) - would love to see

Don't forget you could always cut and paste the engine code and start from there.

#33 jgcode

    LabVIEW Renegade

  • Premium Member
  • 2,348 posts
  • Location:Australia
  • Version:LabVIEW 2009
  • Since:2005

Posted 10 February 2012 - 04:08 PM

v1.0.0.27 in the LAVA-CR includes the following features:

Following up to mike_nrao's comment I have included a basic example of how to extend a Page and run code in parallel to the engine.
To "do stuff" as opposed to just being static:

Attached Image: Extend.png

The BD looks like this (from the example):

Attached Image: Extend BD.png

New VIs that allow you to interact with the Framework (wraps dynamic calls).
You can set the cursors and enable/disable the Ok button and FP Close X:

Attached Image: palette.png

In the <example> I have included a simple screen to demonstrate what these VIs do:

Attached Image: Interact.png

I have added support for horizontal scrollbars.
Only vertical scrollbars were supported in the original Framework, but I have extended it to work with both:

Attached Image: Scrollbar.png

I have added a Polymorphic API for launching the Dialog.
It wraps loading from a folder:

Attached Image: API 1.png

#34 wesramm

    2 more posts to go.

  • Members
  • 8 posts

Posted 17 May 2012 - 10:27 AM

I started down the road of using this as it allows me to make a much more modern looking configuration engine for a large project. And, I'll be honest when I say that I LOVE reusable code. Makes my life easy!!

However, have you anticipated the need to populate the front panel controls when you load the pages? I didn't see this implemented, and am wondering if I am just missing something.

If you had this capability, where the page FP controls could be populated with the last values in the cfg file, it would make this the way to go.

Thanks,

Wes

#35 jgcode

    LabVIEW Renegade

  • Premium Member
  • 2,348 posts
  • Location:Australia
  • Version:LabVIEW 2009
  • Since:2005

Posted 17 May 2012 - 12:45 PM

View Postwesramm, on 17 May 2012 - 10:27 AM, said:

I started down the road of using this as it allows me to make a much more modern looking configuration engine for a large project. And, I'll be honest when I say that I LOVE reusable code. Makes my life easy!!

However, have you anticipated the need to populate the front panel controls when you load the pages? I didn't see this implemented, and am wondering if I am just missing something.

If you had this capability, where the page FP controls could be populated with the last values in the cfg file, it would make this the way to go.

Thanks,

Wes


Hi Wes

Yes, that use case is handled by and encapsulated in the 'Engine'.
If you run the examples included with the package you should see it in action.

Cheers
-Jon