Jump to content


Photo
- - - - -

[LVTN] JGCODE Preferences Dialog Library


  • Please log in to reply
51 replies to this topic

#21 jgcode

jgcode

    LabVIEW Renegade

  • OpenG
  • PipPipPipPipPipPip
  • 2,397 posts
  • Location:Australia
  • Version:LabVIEW 2009
  • Since:2005

Posted 30 January 2012 - 09:44 PM

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.

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

neil

    Extremely Active

  • Members
  • PipPipPipPip
  • 408 posts
  • Location:Surrey, UK
  • Version:LabVIEW 2012
  • 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 Files


CLA, CPI and CTM (Certified Tea Maker)

#23 jgcode

jgcode

    LabVIEW Renegade

  • OpenG
  • PipPipPipPipPipPip
  • 2,397 posts
  • Location:Australia
  • Version:LabVIEW 2009
  • Since:2005

Posted 30 January 2012 - 10:30 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?


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

jgcode

    LabVIEW Renegade

  • OpenG
  • PipPipPipPipPipPip
  • 2,397 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.

Required.png

Nevertheless, I will look into handling this case better.

Thanks for posting the code.

#25 jgcode

jgcode

    LabVIEW Renegade

  • OpenG
  • PipPipPipPipPipPip
  • 2,397 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

jgcode

    LabVIEW Renegade

  • OpenG
  • PipPipPipPipPipPip
  • 2,397 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:

Precheck.png

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

Precheck BD.png


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

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

neil

    Extremely Active

  • Members
  • PipPipPipPip
  • 408 posts
  • Location:Surrey, UK
  • Version:LabVIEW 2012
  • 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.
CLA, CPI and CTM (Certified Tea Maker)

#28 jgcode

jgcode

    LabVIEW Renegade

  • OpenG
  • PipPipPipPipPipPip
  • 2,397 posts
  • Location:Australia
  • Version:LabVIEW 2009
  • Since:2005

Posted 31 January 2012 - 11:29 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.


Thanks!

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

#29 crelf

crelf

    I'm a LAVA, not a fighter.

  • V I Engineering, Inc.
  • 5,742 posts
  • Version:LabVIEW 2012
  • 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 :)

post-181-1170858537.png


#30 jgcode

jgcode

    LabVIEW Renegade

  • OpenG
  • PipPipPipPipPipPip
  • 2,397 posts
  • Location:Australia
  • Version:LabVIEW 2009
  • Since:2005

Posted 31 January 2012 - 08:27 PM

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

mike_nrao

    More Active

  • Members
  • PipPip
  • 31 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

jgcode

    LabVIEW Renegade

  • OpenG
  • PipPipPipPipPipPip
  • 2,397 posts
  • Location:Australia
  • Version:LabVIEW 2009
  • Since:2005

Posted 07 February 2012 - 11:05 PM

<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

jgcode

    LabVIEW Renegade

  • OpenG
  • PipPipPipPipPipPip
  • 2,397 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:

Extend.png

The BD looks like this (from the example):

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:

palette.png

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

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:

Scrollbar.png

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

API 1.png

#34 wesramm

wesramm

    1 more post to go.

  • Members
  • 9 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

jgcode

    LabVIEW Renegade

  • OpenG
  • PipPipPipPipPipPip
  • 2,397 posts
  • Location:Australia
  • Version:LabVIEW 2009
  • Since:2005

Posted 17 May 2012 - 12:45 PM

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

#36 wesramm

wesramm

    1 more post to go.

  • Members
  • 9 posts

Posted 28 May 2012 - 09:20 AM

Thanks for the response. I'll have a look.

#37 Aristos Queue

Aristos Queue

    LV R&D: I write C++/# so you don't have to.

  • Premium Member
  • 2,620 posts
  • Location:Austin, TX
  • Version:LabVIEW 2011
  • Since:2000

Posted 28 May 2012 - 02:02 PM

JGCode: Have you tried this in LV 2012? Opening and running your example project, it is taking 24 seconds to launch the Preferences Dialog and between 5 and 10 seconds to switch pages within the dialog. No idea why. Just doing Tools>>Options within LV comes up within half a second (human counting, didn't bother actually benchmarking). (I would try installing into my LV 2011 to compare, but VI Package Manager won't talk to LV 2011 on my machine... keeps complaining about the VI Server security settings no matter how I set them... it's almost certainly my fault -- I've got my 2011 loaded with almost every module and who knows how many packages in an attempt to replicate a weird CAR report, but until I get that untangled, I don't have a 2011 to look at.)

#38 Aristos Queue

Aristos Queue

    LV R&D: I write C++/# so you don't have to.

  • Premium Member
  • 2,620 posts
  • Location:Austin, TX
  • Version:LabVIEW 2011
  • Since:2000

Posted 28 May 2012 - 02:18 PM

JGCode: I checked the Perforce logs... all changes to the Preferences Dialog in 2012 were in before the first beta, so you should be able to investigate this further on your machine. I have to go now. I may get another chance to look at this later this week, but probably not.

#39 jgcode

jgcode

    LabVIEW Renegade

  • OpenG
  • PipPipPipPipPipPip
  • 2,397 posts
  • Location:Australia
  • Version:LabVIEW 2009
  • Since:2005

Posted 29 May 2012 - 06:23 AM

JGCode: Have you tried this in LV 2012? Opening and running your example project, it is taking 24 seconds to launch the Preferences Dialog and between 5 and 10 seconds to switch pages within the dialog. No idea why.


It must be because of this code I wrote :P
24.png

No seriously, thanks for the info - I was able to easily debug the issue.
This API was written in 2009 and dynamically calls the <resource> VIs.
There was a connector pane change to optionsFrame_GetPageReadyNotifier.vi which stopped everything from working.
This is good as it may provide an opportunity to improve the error handling/logic of the API (although I will be refactoring it when 2012 is released).

JGCode: I checked the Perforce logs... all changes to the Preferences Dialog in 2012 were in before the first beta, so you should be able to investigate this further on your machine. I have to go now. I may get another chance to look at this later this week, but probably not.

As a side note - it actually worked in Beta 1 and not Beta 2 so it seems the changes were done for Beta 2.

Cheers!
-JG

#40 Aristos Queue

Aristos Queue

    LV R&D: I write C++/# so you don't have to.

  • Premium Member
  • 2,620 posts
  • Location:Austin, TX
  • Version:LabVIEW 2011
  • Since:2000

Posted 29 May 2012 - 02:44 PM

For the timing of the changes: I forgot that the date that we give the beta to you is a few days after we build the final version from our source code. Yes, the changes are only in Beta 2 -- they were submitted in the small window after we cut our final image but before it was actually released to you, and I compared against the actual release date.