Jump to content

[LVTN] JGCODE Preferences Dialog Library


jgcode

Recommended Posts

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

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

Link to comment

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:

post-10325-0-24577000-1328888853_thumb.p

The BD looks like this (from the example):

post-10325-0-14513200-1328888851_thumb.p

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:

post-10325-0-62193700-1328888938.png

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

post-10325-0-50848500-1328889994_thumb.p

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:

post-10325-0-94421200-1328888857_thumb.p

I have added a Polymorphic API for launching the Dialog.

It wraps loading from a folder:

post-10325-0-30193900-1328888849_thumb.p

Link to comment
  • 3 months later...

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

Link to comment

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

Link to comment
  • 2 weeks later...

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

  • Like 1
Link to comment

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.

Link to comment

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

post-10325-0-16318900-1338271452.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

Link to comment

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.

Link to comment
  • 4 weeks later...

Preference Page:

General model (no password): "LabVIEW 2011\resource\dialog\PreferencesDialog\PreferencePages\pageTemplate.vit"

Example (no password): "LabVIEW 2011\resource\dialog\PreferencesDialog\PreferencePages\prefPage_NISearch.vi"

Hi lordexod, I am not sure what your post is referring to?

Can you go into detail.

Cheers

Link to comment

If I were to want to place a single typdef'd cluster on one of the pages, but write just the individual items from the cluster to the ini file all under the same section, is there an easy way to accomplish this? I want to maintain my typedef and not break things apart on the page, but it currently writes the entire control into the section which makes it difficult to use the OpenG read INI or Section Cluster VI's (though perhaps I'm missing something). I've looked at your example readfromdisk.vi, but it's pretty much what I've already tried. The workaround is to place the cluster into another cluster when reading and then pull the desired cluster back out and that makes me cringe.

Link to comment
If I were to want to place a single typdef'd cluster on one of the pages, but write just the individual items from the cluster to the ini file all under the same section, is there an easy way to accomplish this? I want to maintain my typedef and not break things apart on the page, but it currently writes the entire control into the section which makes it difficult to use the OpenG read INI or Section Cluster VI's (though perhaps I'm missing something). I've looked at your example readfromdisk.vi, but it's pretty much what I've already tried. The workaround is to place the cluster into another cluster when reading and then pull the desired cluster back out and that makes me cringe.

I guess that's a side-effect you are getting from mixing your data and view (which LabVIEW makes it easy to do).

Wrapping your typedef in a cluster is the correct approach and is how the framework works.

It will allow for scalability if you want to add elements (that may not belong in the typedef in the future) to your page (or section).

Not sure if there is any other way but pls post if you come up with anything cool.

Cheers

-JG

Link to comment

I guess that's a side-effect you are getting from mixing your data and view (which LabVIEW makes it easy to do).

Wrapping your typedef in a cluster is the correct approach and is how the framework works.

It will allow for scalability if you want to add elements (that may not belong in the typedef in the future) to your page (or section).

Not sure if there is any other way but pls post if you come up with anything cool.

Cheers

-JG

True, especially in this use case. I see your point about it being correct in terms of the framework. I'll mull it over and post if I come up with anything interesting.

  • Like 1
Link to comment
  • 1 month later...

Hi all,

I'm looking to use this Preferences Dialog Library and wanted to ask some questions about it.

Is it possible to run the preferences popup in a sub panel instead? My guess is that you can't because it is called within "the engine" ?

I don't understand what all of the global variables are for? Where do you write to them and what is the need for them?

For example, in the readFromDisk.vi, we specify the sections we would like to read, where can I add a global variable like the example has?

Why can’t you view the block diagram for appVars.vi?

Apologies for my blunt questions, I’m just getting straight to the point :D

Thanks for the code JG :worshippy:

Lewis

Link to comment

Hi Lewis

Is it possible to run the preferences popup in a sub panel instead? My guess is that you can't because it is called within "the engine" ?

Yes, that is how the framework essentially works

You could call the Preference Pages in your own subpanel (they are just VIs) - but you would have to handle the synchronization built into the Engine/Page VIs tho

Why can’t you view the block diagram for appVars.vi?

AppVars is a Global Variable, a Global Variable does not have a block diagram

I don't understand what all of the global variables are for? Where do you write to them and what is the need for them? For example, in the readFromDisk.vi, we specify the sections we would like to read

The Global Variables are used for Application Variables in the example only - you can change this to whatever you like. However, I prefer Globals over constants for this use case so I can edit them all in one location when developing e.g. AppVars.vi)

Link to comment

Hey,

Thanks JG.

I can understand the benefit of global variables here. I have never really used them before which is why I didn't know why the Block Diagram was missing.

I have always been taught to avoid them although I understand they have their use case.

"You could call the Preference Pages in your own subpanel (they are just VIs) - but you would have to handle the synchronization built into the Engine/Page VIs tho"

At the moment, I don't want to call each individual page in a sub panel (if that is what you meant). I would like to load resource\dialog\PreferencesDialog\PreferenceDialog.vi into a subpanel. For example, on my top level VI, I could have a Tab with a sub panel to handle all of the configuration. How could I implement this? At the moment I can see you call PreferenceDialog.vi by reference in the Preferences Dialog - Dynamic__jgcode_lib_preferences_dialog.vi

Some guidance would be appreciated :)

Link to comment
  • 1 month later...

I managed to get this working in a build application.

  • Use a conditional case structure to load the NI Resource file in an executable:
    post-2399-0-62353000-1350408685_thumb.pn
  • Place the Option VIs outside of the exe (otherwise I got an error 13)
    post-2399-0-80801900-1350409153_thumb.pn
  • Place all of the dependencies inside of the executable (previous step would add a lot of files to the build result from within %resource%)
    post-2399-0-06448700-1350408987_thumb.pn
  • You get the path by adding the VIs as a static VI members
    post-2399-0-29322600-1350408761.png

After those steps you can use the Preferences dialog in an executable. However it is slow. Really slow.

And sometimes the framework will not load the data properly. Not sure why. However the timing (and complexity of the structure seems the culprit).

Ton

Link to comment
  • 9 months later...

Dears,

1st of all: thx JG! nice code!

 

it seems that the bug described earlier

(see JGs post May 29th '12:

[...]

There was a connector pane change to optionsFrame_GetPageReadyNotifier.vi which stopped everything from working.
[...])

is still in (Version 1.0.0.27, using LV2012)

 

had to correct the vi-typedef in

 vi.libJGCODEpreferences_dialog_jgcode_lib_preferences_dialog.llbGet Page Ready Notifier - Dynamic__jgcode_lib_preferences_dialog.vi

to be typed to

resourcedialogPreferencesDialogoptionsFrame_GetPageReadyNotifier.vi

 

regards

peegee

 

(Detailed descrition:

In the Preference Dialog Engine FGV, in the setup event, there's a call of
vi.libJGCODEpreferences_dialog_jgcode_lib_preferences_dialog.llbGet Page Ready Notifier - Dynamic__jgcode_lib_preferences_dialog.vi

In there is a dynamic call to the vi referenced in the global
vi.libJGCODEpreferences_dialog_jgcode_lib_preferences_dialog.llbApplication Config - Global__jgcode_lib_preferences_dialog.vi
in
GET_PAGE_NOTIFIER_PATH
which is set to
resourcedialogPreferencesDialogoptionsFrame_GetPageReadyNotifier.vi

To get the vi-reference for this dynamic call, a wrong type is given: the boolean output is missing.
This caused the first load each page to take about ten seconds.
correcting the type definition gave nice, fast behaviour.

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.