Bab Posted December 5, 2007 Report Share Posted December 5, 2007 I am wondering why I can’t find the „colors“ property for the control class objects? If I want to update a Front Panel and switch from the default LabVIEW colors, I need to use the pencil tool and edit all the “parts” of all the controls and indicators. It gets even more tricky when one control “part” has several states with a color each (i.e. the increment and decrement buttons of a digital), then I think the only way is to open the control editor (Customize option), and change each color. So I NEED to automate this task. Did anyone ever need to do just that? Is there a way to manipulate controls, and sub-parts of controls? Maybe any idea in the direction of programmatically manipulating the control editor? Can I get a reference to a control sub-part (say the frame)? Thanks, BaB. Quote Link to comment
Yair Posted December 5, 2007 Report Share Posted December 5, 2007 Each class has a different color property. For example, a boolean will have the Colors[4] property where a string control can have colors for the text and colors for the control itself. What you can do is cast the generic control reference to the specific class of the control and then use its colors properties. You can do this by getting the ClassID property of the control, wiring it into a case structure and using the To More Specific Class primitive inside the case. I don't know of a list of the class IDs, but there are various tools around the web (and on LAVA) which do this for generic handling of controls (although not neccessarily for the color properties). There is currently no way to programatically access the subparts of a control or to control the control editor. Can you give an example of a UI which is so complex that it takes more than a minute or two to color all of it? Quote Link to comment
Bab Posted December 6, 2007 Author Report Share Posted December 6, 2007 QUOTE(Yen @ Dec 4 2007, 06:06 PM) Each class has a different color property. For example, a boolean will have the Colors[4] property where a string control can have colors for the text and colors for the control itself.What you can do is cast the generic control reference to the specific class of the control and then use its colors properties. You can do this by getting the ClassID property of the control, wiring it into a case structure and using the To More Specific Class primitive inside the case. I don't know of a list of the class IDs, but there are various tools around the web (and on LAVA) which do this for generic handling of controls (although not neccessarily for the color properties). There is currently no way to programatically access the subparts of a control or to control the control editor. Can you give an example of a UI which is so complex that it takes more than a minute or two to color all of it? Hi Yen, I feared I would have such a reply. Jim Kring’s topic Is there a cluster frame color property? indicates the frame color (for a cluster or any other control I would say) is not available programmatically. I naively supposed that every manual change available with the right mouse click on a control was also available using property nodes… And to answer your question Yen: your example of a Boolean is one of the control that have a color property, unfortunately it is more an exception that the general case. Let’s look at a simple digital numeric control. When you edit it in the control editor, it has 6 sub-parts: Name Label, Numeric Text, Increment, Decrement, Radix and Frame. The first 2 are nice since you can get a reference to it and they belong to the Decoration\Text Class and inherit therefore the colors property programmatically available. The 4 other seem not available at all programmatically. The Increment and Decrement parts are like simple buttons having each 2 states (and thus 2 colors each). The radix has a background and a text color. The frame has also 2 colors. So you see how many thing you must modify in order to set the colors of one control the way you really want it. If you have many controls – maybe in a settings window with many tabs… And if you have a rather large application with many Front Panels. It takes quite some time. If no one know of a way, I guess I’ll be able to automate the coloring of Booleans and Text-Class Objects at least. I tried to typecast a Digital Numeric into a Decoration: but I only get Error 1058 (Specified property not found). Thanks, BaB. Quote Link to comment
LAVA 1.0 Content Posted December 6, 2007 Report Share Posted December 6, 2007 QUOTE(Bab @ Dec 5 2007, 04:51 AM) So you see how many thing you must modify in order to set the colors of one control the way you really want it. If you have many controls – maybe in a settings window with many tabs…And if you have a rather large application with many Front Panels. It takes quite some time. If no one know of a way, I guess I'll be able to automate the coloring of Booleans and Text-Class Objects at least. Are you trying to make a UI where the operator can customize the colors on the fly, or are you trying to automate (script) changes while using the development environment? If you're doing this to speed up making changes in the development environment, consider creating strictly typdefed controls. It takes some up-front planning, but makes changes simpler later on. Place these as needed, then update the typdef once to change all instances. If your application is going to run on more than one machine or be used by more than one or two operators, you may want to use system colors on your controls, indicators and backgrounds. The UI will then match the OS settings for colors and will behave like larger commercial based apps. Just an idea... Quote Link to comment
Bobillier Posted December 6, 2007 Report Share Posted December 6, 2007 One other way can be to use transparents controls. I send you a library find on web but i don't remember where.Thanks to is creator. Quote Link to comment
Recommended Posts
Join the conversation
You can post now and register later. If you have an account, sign in now to post with your account.