Jump to content

[CR] UI Tools addon: Control class


Recommended Posts

index.php?app=downloads&module=display&section=screenshot&id=120

Name: UI Tools addon: Control class

Submitter: Francois Normandin

Submitted: 10 Jan 2010

Category: User Interface

LabVIEW Version: 2012

License Type: BSD (Most common)

UI Tools addon: Control class v1.4.0

Copyright © 2009-2015, François Normandin.

All rights reserved.

Author:François Normandin

Contact Info: Contact via PM on www.lavag.org

LabVIEW Versions:

Created and tested with LabVIEW 2012

Dependencies:

UI Tools >= 1.3.0.70

jki_lib_state_machine >= 2.0.0

OpenG Application Control Library >= 4.1.0.7

OpenG Array Library >= 4.1.1.14

OpenG Error Library >= 4.2.0.23

OpenG File Library >= 4.2.0.21

OpenG LabVIEW Data Library >= 4.1.0.12

OpenG Variant Configuration File Library >= 4.0.0.5

BitMan - Bitmap Manipulation Library >= 1.0.1.0

Description:

This package contains a class to quickly create controls programmatically based on templates.

Instructions:

After installing package with VIPM, refresh palettes if VIPM is not set to refresh automatically.

Use palettes.

On LabVIEW restart, a Tools Menu shortcut gives access to a Control Generator GUI (Tools >> UI Tools >> Control Generator)

Known Issues:

The control creator provided under "Tools" menu is not yet complete:

- It doesn't batch process controls yet.

- The "pure white" (xFFFFFF) is drawn as black (use FEFEFE instead... that's close, and I really don't know why!)

Acknowledgements:

Wojciech Golebiowski for his BitMan library (Bitmap Manipulation).

History:

v1.4.0: Removed a self-conflicting dependency on new installation

v1.3.0: Renamed package and moved templates to vi.lib to remove the need to rely on system files (outside of LabVIEW folder structure).

Upgraded source code to 2012. Older versions not supported anymore.

Changed the namespacing and added an incompatibility with previous versions of this package.

Integrated into the palette of UI Tools (base package on LVTN 1.3.0.59+)

Fixed issue with scaling factor for True decal button

v1.2.0: Migrated to VIP file type (from OGP)

v1.1.0: Added functionality for creating different decals for True and false states.

This release is untested with the rest of the package.

It is strictly aimed at providing a temporary solution to creating custom controls with different decals for True and False states.

The package works as standalone, but might introduce some bugs in the parent package "UI Tools".

Do no install unless you absolutely need the new functionality right away.

Keep the latest UI Tools Addon Control Class package at hand to fall back in case it breaks functionality.

v1.0.15: Added "Save to previous version"

Added "Drop on Front Panel" and tested to work in projects or outside projects.

Added some configuration file entries and more error checking.

v1.0.14: Initial release of the code. (8.6)

License:

Distributed under the BSD license.

Make sure you comply with the license of anyone who distributes icons on the web!

Support:

If you have any problems with this code or want to suggest features:

please go to www.lavag.org and Navigate to the discussion page.

Send me a personal message on LAVAG.org to get my attention faster.

Distribution:

This code was downloaded from the LAVA Code Repository found at www.lavag.org

============================

Click here to download this file

Link to comment

I've found some bugs on the initialization of the "Create Customized Controls" from the Tools menu.

1- I should have removed the config.ini file before I created the package... now you'll be swapped to an inexistant directory the first time you use it.

2- The VI won't close itself after you're done.

3- Batch processing doesn't work.

4- Save to an existing control palette not yet implemented.

5- Some problems with "Drop on existing FP", especially within a project.

6- Text color should not be "pure white" (FFFFFF) or it will appear black (don't know why yet). Use a slightly off-white (FFFFFE) for example.

Thing you should know:

a) you would have to populate the <lvdata>\Icon Source directory with your own set of icons. I've placed the Nuvola icons set in there on my computer. Otherwise, you can use the <lvdata>\glyphs icons, but those are not transparent (background).

b) Not saving control to disk will save it to a temporary folder. (thus saving it to disk before adding it to a front panel)

On the roadmap:

1- Add a "Save for previous version" option when creating the controls.

2- ...

Link to comment
  • 2 weeks later...

bugs:

1- I should have removed the config.ini file before I created the package... now you'll be swapped to an inexistant directory the first time you use it.

2- The VI won't close itself after you're done.

3- Batch processing is not implemented work.

4- Save to an existing control palette not yet implemented.

5- Some problems with "Drop on existing FP", especially within a project.

6- Text color should not be "pure white" (FFFFFF) or it will appear black (don't know why yet). Use a slightly off-white (FFFFFE) for example.

7- Adding control to an unsaved project file returns an undealt error.

On the roadmap:

1- Add a "Save for previous version" option when creating the controls. DONE

2- Batch processing

3- Better error handling

An a small demo. (sorry no sound: couldn't risk waking up the lady:P)

<object width="1010" height="578"> <param name="movie" value="http://content.screencast.com/users/normandinf/folders/Jing/media/56068fce-b3d2-4b2e-933f-960b956a613a/jingswfplayer.swf"></param>'>http://content.screencast.com/users/normandinf/folders/Jing/media/56068fce-b3d2-4b2e-933f-960b956a613a/jingswfplayer.swf"></param> <param name="quality" value="high"></param> <param name="bgcolor" value="#FFFFFF"></param> <param name="flashVars" value="thumb=http://content.screencast.com/users/normandinf/folders/Jing/media/56068fce-b3d2-4b2e-933f-960b956a613a/FirstFrame.jpg&containerwidth=1010&containerheight=578&content=http://content.screencast.com/users/normandinf/folders/Jing/media/56068fce-b3d2-4b2e-933f-960b956a613a/2010-01-23_1652.swf"></param> <param name="allowFullScreen" value="true"></param> <param name="scale" value="showall"></param> <param name="allowScriptAccess" value="always"></param> <param name="base" value="http://content.screencast.com/users/normandinf/folders/Jing/media/56068fce-b3d2-4b2e-933f-960b956a613a/"></param>'>http://content.screencast.com/users/normandinf/folders/Jing/media/56068fce-b3d2-4b2e-933f-960b956a613a/"></param> <embed src="http://content.screencast.com/users/normandinf/folders/Jing/media/56068fce-b3d2-4b2e-933f-960b956a613a/jingswfplayer.swf" quality="high" bgcolor="#FFFFFF" width="1010" height="578" type="application/x-shockwave-flash" allowScriptAccess="always" flashVars="thumb=http://content.screencast.com/users/normandinf/folders/Jing/media/56068fce-b3d2-4b2e-933f-960b956a613a/FirstFrame.jpg&containerwidth=1010&containerheight=578&content=http://content.screencast.com/users/normandinf/folders/Jing/media/56068fce-b3d2-4b2e-933f-960b956a613a/2010-01-23_1652.swf" allowFullScreen="true" base="http://content.screencast.com/users/normandinf/folders/Jing/media/56068fce-b3d2-4b2e-933f-960b956a613a/" scale="showall"></embed> </object>

  • Like 1
Link to comment

François, could you please save your tools (and possibly control packages) in as low version as possible? I'm still with 8.2 and I know that many people still do something in 7.0 (only packages would be usable for them, because of LVOOP).

Besides that I would like to see the code and find out the reason of "pure white" bug (which is propably BitMan's fault, so mine :) )

Link to comment

François, could you please save your tools (and possibly control packages) in as low version as possible? I'm still with 8.2 and I know that many people still do something in 7.0 (only packages would be usable for them, because of LVOOP).

Besides that I would like to see the code and find out the reason of "pure white" bug (which is propably BitMan's fault, so mine :) )

That's on my radar, but I don't have 8.2 installed at home. I'll see when I can find some extra time after work if I can do it. As mentioned somewhere, I don't see any problems backsaving for 8.2. Just didn't have time to do it and test. As for 7.0, I won't. I've added a "Save for Previous" to the control class, but it goes back as far back as 8.2. I promise to take a look. I'd hate that you can't play with it...

If someone were to find a tweak on how to create a 7.0 binary from the 8.x control, that would be something. :ph34r:

Link to comment

François, could you please save your tools (and possibly control packages) in as low version as possible? I'm still with 8.2 and I know that many people still do something in 7.0 (only packages would be usable for them, because of LVOOP).

Besides that I would like to see the code and find out the reason of "pure white" bug (which is propably BitMan's fault, so mine :) )

I've used OpenG Package builder for these... I think I can have the source code saved for 8.2 and then package them. It should work without having to install 8.2. Give a a few days to find out.

For the "pure white", it's not a bug with BitMan because the preview is OK. It's most likely in my ultimate call to create the control. I set the text color in a property node, but for an unknown reason, pure white results in black. I don't want to call it a LV bug yet because I haven't been thorough in my search for an explanation...

** EDIT: Well, it's definitely a LV Bug... :unsure:

No need to do it programmatically, it ends up black when I select (255,255,255) color.

Link to comment

** EDIT: Well, it's definitely a LV Bug... :unsure:

No need to do it programmatically, it ends up black when I select (255,255,255) color.

<object id="scPlayer" width="582" height="356"> <param name="movie" value="http://content.screencast.com/users/normandinf/folders/Jing/media/05eb9001-fa99-4657-90ff-8d9fc5f07731/jingswfplayer.swf"></param>'>http://content.screencast.com/users/normandinf/folders/Jing/media/05eb9001-fa99-4657-90ff-8d9fc5f07731/jingswfplayer.swf"></param> <param name="quality" value="high"></param> <param name="bgcolor" value="#FFFFFF"></param> <param name="flashVars" value="thumb=http://content.screencast.com/users/normandinf/folders/Jing/media/05eb9001-fa99-4657-90ff-8d9fc5f07731/FirstFrame.jpg&containerwidth=582&containerheight=356&content=http://content.screencast.com/users/normandinf/folders/Jing/media/05eb9001-fa99-4657-90ff-8d9fc5f07731/pure%20white%20bug.swf"></param> <param name="allowFullScreen" value="true"></param> <param name="scale" value="showall"></param> <param name="allowScriptAccess" value="always"></param> <param name="base" value="http://content.screencast.com/users/normandinf/folders/Jing/media/05eb9001-fa99-4657-90ff-8d9fc5f07731/"></param>'>http://content.screencast.com/users/normandinf/folders/Jing/media/05eb9001-fa99-4657-90ff-8d9fc5f07731/"></param> <embed src="http://content.screencast.com/users/normandinf/folders/Jing/media/05eb9001-fa99-4657-90ff-8d9fc5f07731/jingswfplayer.swf" quality="high" bgcolor="#FFFFFF" width="582" height="356" type="application/x-shockwave-flash" allowScriptAccess="always" flashVars="thumb=http://content.screencast.com/users/normandinf/folders/Jing/media/05eb9001-fa99-4657-90ff-8d9fc5f07731/FirstFrame.jpg&containerwidth=582&containerheight=356&content=http://content.screencast.com/users/normandinf/folders/Jing/media/05eb9001-fa99-4657-90ff-8d9fc5f07731/pure%20white%20bug.swf" allowFullScreen="true" base="http://content.screencast.com/users/normandinf/folders/Jing/media/05eb9001-fa99-4657-90ff-8d9fc5f07731/" scale="showall"></embed> </object>

In version 1.5 of "Improved Icon Editor", the change log mentions a bug when selecting (255,255,255)... It seems the workaround was to shift it to (254,254,254). That's what I'll do for next version.

Link to comment
  • 1 month later...

I've managed to find some time to create a small example video about creating customized controls on the fly.

It's not complete in the sense that I don't show how to create your own backgrounds for customized buttons, but rather show how to use this add-on to create controls on the fly and add them to your front panels.

When I find more time, I'll make new videos on customizing your button styles and also how it can be made to add these controls directly in your user.lib control palette.

In the video, I generate an error message. You'll see that it has something to do with the fact that my project was not saved. This is an unhandled error state that I'll deal with in a future version.

You can download the Nuvola icon theme shown in this presentation here.

<object id="scPlayer" width="1015" height="682"> <param name="movie" value="http://content.screencast.com/users/normandinf/folders/Jing/media/9066199a-c28a-44b9-a679-864d0366254d/jingswfplayer.swf"></param>'>http://content.screencast.com/users/normandinf/folders/Jing/media/9066199a-c28a-44b9-a679-864d0366254d/jingswfplayer.swf"></param> <param name="quality" value="high"></param> <param name="bgcolor" value="#FFFFFF"></param> <param name="flashVars" value="thumb=http://content.screencast.com/users/normandinf/folders/Jing/media/9066199a-c28a-44b9-a679-864d0366254d/FirstFrame.jpg&containerwidth=1015&containerheight=682&content=http://content.screencast.com/users/normandinf/folders/Jing/media/9066199a-c28a-44b9-a679-864d0366254d/CustomControlsOnTheFly.swf"></param> <param name="allowFullScreen" value="true"></param> <param name="scale" value="showall"></param> <param name="allowScriptAccess" value="always"></param> <param name="base" value="http://content.screencast.com/users/normandinf/folders/Jing/media/9066199a-c28a-44b9-a679-864d0366254d/"></param>'>http://content.screencast.com/users/normandinf/folders/Jing/media/9066199a-c28a-44b9-a679-864d0366254d/"></param> <embed src="http://content.screencast.com/users/normandinf/folders/Jing/media/9066199a-c28a-44b9-a679-864d0366254d/jingswfplayer.swf" quality="high" bgcolor="#FFFFFF" width="1015" height="682" type="application/x-shockwave-flash" allowScriptAccess="always" flashVars="thumb=http://content.screencast.com/users/normandinf/folders/Jing/media/9066199a-c28a-44b9-a679-864d0366254d/FirstFrame.jpg&containerwidth=1015&containerheight=682&content=http://content.screencast.com/users/normandinf/folders/Jing/media/9066199a-c28a-44b9-a679-864d0366254d/CustomControlsOnTheFly.swf" allowFullScreen="true" base="http://content.screencast.com/users/normandinf/folders/Jing/media/9066199a-c28a-44b9-a679-864d0366254d/" scale="showall"></embed> </object>

Edit: Sorry if sound isn't great. I think it's my microphone that is giving me some problems.

  • Like 1
Link to comment
  • 6 months later...

Hi Francois,

First I'd like to say that the Control Generator Tool is the best thing since slice bread - it saves sooo much time - Kudos^infinity.

I'm not sure though if the tool can create a VISTA1 style button with different images for the TRUE/FALSE states + keep the Hoover effect?

I created a VISTA1 button using the Control Generator and then tried to add another image for the other state in the LabVIEW Control Editor, however it seemed to distort the cross image and I lost the Hoover effect.

Am I just doing this wrong or should I instead use your Control.lvclass tools to do this programmatically?

Chris

P.S. I tried to attach the suspect control, but it kept on hanging my IE 8 interface - sorry.

Link to comment

Hi Francois,

First I'd like to say that the Control Generator Tool is the best thing since slice bread - it saves sooo much time - Kudos^infinity.

I'm not sure though if the tool can create a VISTA1 style button with different images for the TRUE/FALSE states + keep the Hoover effect?

Thanks for the kind words.

I hadn't thought of this use case when I put up the Control Generator Tool.

I created a VISTA1 button using the Control Generator and then tried to add another image for the other state in the LabVIEW Control Editor, however it seemed to distort the cross image and I lost the Hoover effect.

Am I just doing this wrong or should I instead use your Control.lvclass tools to do this programmatically?

I haven't tried, but I suspect that you get a distorted image because the button image you introduce is not the same size and something gets resized. I didn't create these buttons with vectorial images, so they don't resize well. The Hoover effect loss might just be that you customize the button by pasting directly over the "depressed button" and this would overwrite the hoover state. The Vista1 buttons are created from a 6-state system button template (72x72 pixels) and the hoover state is the 4th state (if I remember correctly).

So for this to work manually without distortion and keeping the hoover effect, as quickly as possible, you would need to:

1- Create a button with your False state decal.

2- Create a second button with your True state decal.

3- Open the second button with the "Customize Control" editor (the usual Right-click Advanced >> Customize...)

4- Hit the "Switch to Customize Mode" button. Right-click on your button and select one of the depressed state picture (true state). Copy to clipboard. Close this button... you can even delete it from disk.

5- Open the first button with the "Customize Control" editor (the usual Right-click Advanced >> Customize...)

6- Now copy the clipboard image on all three states that represent depressed states.

7- Apply changes and voilà, you have a new True state decal with the same size (no distortion) and with hoover effect.

I have made a video but I seem to have a nasty microphone problem and without audio, you might just as well follow the above mentioned steps.

Well here it is anyway:

<object width="425" height="344">

<param name="movie" value="

<embed src="

type="application/x-shockwave-flash" width="425" height="344"></embed>

</object>

However, you surely want to do it programmatically. At the moment, it can't be done because the "Preview Control States" VI messes with the button states even if you change them using the Properties VI provided with the API (I'd definitely call that a bug in my implementation). I was able to do the modifications in a few minutes to the existing class. It requires adding a True State Icon, modifying the Read and Write Icon PNG VIs and modifying the Load Icon & Preview Control States VIs. I'll prepare a new version soon and post it here. Stay posted and thanks for the feature suggestion.

Link to comment

Hi Francois,

Thanks for the detailed explanation. I added a few steps to get the Hoover effect in both boolean states, but it's still a bit confusing on what the six picture items represent. It will be so much easier doing this in your Control Generator, so I eagerly looked forward to the next revision - thanks for the help. I have (hopefully) attached what the final button looks like.

Hi Francois,

Thanks for the detailed explanation. I added a few steps to get the Hoover effect in both boolean states, but it's still a bit confusing on what the six picture items represent. It will be so much easier doing this in your Control Generator, so I eagerly looked forward to the next revision - thanks for the help. I have (hopefully) attached what the final button looks like.

Damn it - still can't attach anything - lets try again

Vista1_Tick-Cross.ctl

Link to comment

Alright Chris,

here is a temporary package. I won't put it in the Code Rep yet because it's saved in 2009 and I'd like to port it to 8.6 to keep compatibility with the last package in CR.

I've tested the Control Generator in the Tools menu: no changes that I could see. It seems to work as expected. Then there's an extra VI that I didn't include in the package but that you can find here below.

lava_lib_ui_tools_control_class_addon-1.1.0.3.vip (>= LV 2009)

Use this VI as an example for creating controls with different pictures for True and False. It's hardwired to use the Vista1 template.

Create Different Decals for True False.vi

Hope this helps you.

Link to comment

Hi Francois,

Thanks for all that effort, but I seem to be having some problems installing this new version (1.1.0.1) over my current version of 1.0.15-1 using VI Package Manager 2010.

When I finish installing the new package (all OK) and then select the Control Generator from the Menu it goes looking for the BitMap.lvclass - which I think? this new version removed from my LabVIEW directory. I've got the zipped up BitMan Library do I just stick this whole lot into the <userlib> folder?

Chris.

Link to comment

When I finish installing the new package (all OK) and then select the Control Generator from the Menu it goes looking for the BitMap.lvclass - which I think? this new version removed from my LabVIEW directory. I've got the zipped up BitMan Library do I just stick this whole lot into the <userlib> folder?

BitMan is already packaged and ready to downlad at:

  • Like 1
Link to comment

Hi Francois,

Thanks for all that effort, but I seem to be having some problems installing this new version (1.1.0.1) over my current version of 1.0.15-1 using VI Package Manager 2010.

When I finish installing the new package (all OK) and then select the Control Generator from the Menu it goes looking for the BitMap.lvclass - which I think? this new version removed from my LabVIEW directory. I've got the zipped up BitMan Library do I just stick this whole lot into the <userlib> folder?

Chris.

Unzipping in user.lib would work. My error was that previously to VIPM 2010, I used OpenG Builder to add the BitMan files as a post install step. Forgot to port it to my new vip file.

I asked Vugie yesterday if he was willing to make a VIPM package out of BitMan to add it as a dependency and he did it already. Again, I'll add this in a new package as soon as possible, with the correct dependencies.

In the meantime, install BitMan's package and you should be fine. (or unzip from your archive into user.lib)

Link to comment

I just installed it, and it seems to delete some of the Bitman files. It's fixable by installing Bitman again afterwards, but I expect this shouldn't happen.

Yes, I used to check for the installed BitMan and install it if not already there. At this point, if you installed BitMan using UI Tools v1.0.15, it would be uninstalled when you upgrade. That's an error I did yesterday when I built this temporary package. I'll fix that now that BitMan has been made as a package and will deprecate the other packages. I was afraid I had missed something, so that's why I didn't commit the code to CR. Stay put, I'll have a fix soon.

Link to comment

Hi Francois,

Something weird is happening......

I've installed the latest BitMan Library Version 1.0.1.0 through VI Package Manager and then I installed your latest version of the Control Class (1.1.0.3), but then I when run the Control Generator it starts looking for VI's in the \user.lib\BitMan\Built-In-Filters\etc... directory and then comes up with a broken run arrow, but there are no Errors in the Error List - how can that be?

If I re-install version 1.0.15-1 (what I had orginally - it boots up OK again).

I also tried mass-compling the user.lib directory, but that didn't seem to help much.

Any ideas on what I'm doing wrong?

Chris

Link to comment

Something weird is happening......

It works OK on my work computer.

You know what, let me check tonight on my home computer... that's where I usually build my packages. I've put a question on VIPM's forum about an auto-dependency that I've never seen before... it might be a symptom of the weird stuff you see (or not). Anyway, yet another reason not to put this in CR. Sorry that you have to be my beta-tester!

Link to comment

No problems - I would do almost anything to help get this working ;)

Chris

Hi Chris,

I don't run into such a problem at home either. It might be a good idea to close LabVIEW when upgrading from 1.0.15 to 1.1.3. Just in case that the code was copied but an old version of "Control Generator" or BitMan VIs were still in memory from a previous call. This shouldn't happen with normal dependencies, but this is a rather unusual transition. Prior to VIPM 2010, it was impossible to install a package built into a lvlib (namespacing issues), so it had to be added with OpenG Builder. Now that it works great in VIPM 2010, I think the way to go is either to include the BitMan code in my package with a different namespacing, thus copying twice the code if you already have BitMan in your user.lib ==> I don't like that use case; or the following procedure (just this once, for the transition between the OGP to VIP package):

- Uninstall UI Tools: Control addon 1.0.x (*.ogp)

- Make sure BitMan is removed from user.lib (unless it's been installed with the package from Vugie)

- Close LabVIEW

- Install BitMan's package (unless already installed)

- Install UI Tools: Control addon 1.1.x (*.vip)

- Open LabVIEW

See if the linkage is OK.

As mentioned, I don't have this problem either on XP or Win7 with multiple LV versions installed. It must be that some code from the LabVIEW 2009/Project folder gets loaded in memory and keeps an old version in memory somehow. I think these VIs (in Tools menu) are loaded in memory into a separate application reference. Could that be it?

Link to comment

Hi Francois,

Yeah that more or less did the job. I must have installed the good Bitman package from Vugie over a corrupt version. So I removed the Bitman package and deleted some remnants still left in the user.lib and then removed your latest packages and then re-installed both again and it all worked fine. I even noticed the Mass Compile option in VI Package Manager - it's amazing what you can find out if you read the Help file :rolleyes:

So now when you run the Control Generator program it always pops a File Dialog window asking to "Select a single PNG file or choose a source directory for batch processing", is this something needed for the new two image VISTA1 buttons, because otherwise the screen looks exactly the same as the older version I can't figure out how I'm supposed to add the second image?

Chris.

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.