LabVIEW

cancel
Showing results for 
Search instead for 
Did you mean: 

[UI] How to change condition color automatically according to data type ?

Solved!
Go to solution

Kochise wrote:

 

Hello,

 

I'd like to know if there is an automated way to change

conditions' color following the linked data type on the

diagram, so that it's a little bit easier to know what kind

to processing is done when you don't have the whole

thing on screen. Currently I'm doing it manually :

 

David Koch


Everything else in the thread notwithstanding, you should be able to do this with VI scripting if you really wanted to. I can't find the property for a CaseSel's border colour, but you can most definitely get the selector outer terminal data type. I've used it for colouring each frame colour differently before. It'd work well as a QuickDrop plugin.

 

For easily maintainable code, however, there are far better alternatives - even if they're harder to fit into your inherited code.

 

Good luck.

---
CLA
0 Kudos
Message 11 of 22
(2,040 Views)

Clipboard_150206_1128.png

0 Kudos
Message 12 of 22
(2,003 Views)

Hi David,

 

nice image.

 

Yes, sometimes IDE/compiler error occur.

Yes, sometimes it might be a good idea to write VIs from scratch…

Best regards,
GerdW


using LV2016/2019/2021 on Win10/11+cRIO, TestStand2016/2019
0 Kudos
Message 13 of 22
(2,001 Views)

@Kochise wrote:

altenbach a écrit :

The point is to gauge user interest in the idea. If there is not interest nobody cares if it does not get implemented. Many good ideas from the exchange have been implemented over the last few versions.


There's already 245 pages of ideas to implement, mine would drown amongst.


Oh dear.

 


@Kochise wrote:
That depend on the way you see things inside your head, organize your sub VIs, or organize things visually into nested conditions and loops.

 

Just have a look how things were done by a 'professional' Labview coder that passed certifications, enjoy the ride :

 

Look at this last example, this is a SQL statement construction !

 

I don't think I'm a bad guy, my task is to completely re-architecture things to be maintenable.


 

Oh deary deary me.

 

Look, I have to chime in because your answers to these points raised (many of which are very valid) is distressing.

 

You seem to focus on the negatives in order to judge your efforts / chance of rewards.  Now this isn't a LabVIEW topic, it's a life topic but since you're here asking for help, you get an answer from me.

 

Stop using other bad examples as justification for doing bad things.  It's PROOF that you KNOW what you are doing is not good.  Man up and admit your shortcomings and at least show SOME effort in improving.  It's not making your contributions any better by claiming "At least I'm not the worst".  That way of thinking will get you nowhere in life or in LabVIEW.  If you continue this way of thinking this community (who like to help people improve themselves in coding and has produced some excellent results) will ignore you.

 

Rant finished.

 

 

Message 14 of 22
(1,991 Views)

calimero_lv.png

0 Kudos
Message 15 of 22
(1,963 Views)

I don't understand what information you are trying to convey with this image aside from a clumsy and juvenile attempt at provocation.

 

Or is it supposed to be a self-portrait?

0 Kudos
Message 16 of 22
(1,967 Views)

Hi Kochise,

 

Let me first appologize for what you have been given and the impresion that a "certified..." aftually is capable of developing well structured easy to maintain code.

 

You have been mislead.

 

I am not allowed to let you see the code we develop so I am limited in the extent of my assistance.

 

I too came from "another" programming language. It took me time to get a handle on the difference between LV and C and macro etc. I would like to encourage you to wok at the paradigm shift needed to make the jump.

 

Programming in LV is a lot like riding a surf board. When surfing we do not think about the dynamics of the water etc. but have to think abou tthe "Big Picture" like what wave is coming how to get into the curl etc. If we were thinking about the low-level stuff, we would be wipping out.

 

LV presents an interface that is wonderful at expressing thoughts and intension in a single image. If we try to make that image too complex by introducing low-level details it can be "hard to tell the forest from the trees". SO I urge my fellow developers to keep their digarms structured such that it relates simple straight froward ideas. The low level details are abstracted away using sub-VIs that encapsulate related concepts.

 

So since I can not post an image I will try to paint with words.

 

Top level "MAIN" VIs are typically composed of the applications components. If you look at the main diagrams we often find a bunch of sub-VIs that all run side by side. The purpose of each sub-VI are communicated via the icon and the help included for each. THe details vary from application to application but a typical Main may have;

 

Configuration

DAQ

Reporting

 

So if some poor sole has to dig into my code and fix an issue with how the configuration functinality works, they can make an educated guess.

 

When they drill down into one of those sub-VI they find code that is related to the function they handle. Depending on the complexity, they may find addional layers where the sub-functionality is handled.

 

LV introduced "multithreading" very early since the "Data Flow Paradigm" naturally adpst well to multithreading. With multi-threading LV is a natural for multiple interacting parts. "Active Objects" as it is described in OOP.

 

Multithreading works when components are able to safely inteact with each other. LV has a lot of options that serve a variety of interaction types. Queues, Notifiers, Events, Functional globals,... each have their own use and are great once we know how each operate. They all work in a multithreaded environment safely when used properly. There is no need to create mutexes to protect resources. LV abstracts those away so we can focus on the big questions.

 

A technically challenging part of realizing multithreded applications rears its ugle head when we turn our attention to GUIs since ther may be only one. LV addresse this best using a "User Interface Thread" which is single threaded. THis prevents issues with two components attempting to change the same GUI element at the same time. While solving the problem of multiples fighting, it introduces a situation that has to be understood and recognized.

 

THe best wasy that I have found to handle the bottleneck of the GUI is to recognize the GUI as a way to get information from a human operator and update that user. It is not a place to store data. There are better place to store data.

 

So to further attemp to help you, I would suggest you stop looking at that code you were given and trying to figure out how to nudge and coax it into a "more manable state" and rather start with a fresh white board and break down your applcaiton on a high level. Don't get down in the weeds, with too many details, let the while board limit you on how you render the application its components and their interactions.

 

THEN

 

Go to a new VI and create VIs that mirror your while board design.

 

I have been posting to this forum long enough to know that I may not be able to persuade you with a simple post and a big pile of words. I hope that this short diatribe is helpful to someone.

 

Trying to help,

 

Ben

Retired Senior Automation Systems Architect with Data Science Automation LabVIEW Champion Knight of NI and Prepper LinkedIn Profile YouTube Channel
0 Kudos
Message 17 of 22
(1,956 Views)
Solution
Accepted by Kochise

Although it is possible to programatically access the data type and color of the wires, there is no way to programatically set the color of the frame of a case structure.  However it is possible to set the background color.

See attached code..

"If you weren't supposed to push it, it wouldn't be a button."
Download All
Message 18 of 22
(1,916 Views)

@paul_cardinale : Thanks, you deserve some kudos...

 

@ben : Thanks...

 

@Intaris : self-portrait, but I don't care anymore, I'm now on Prozac...

 

David Koch

0 Kudos
Message 19 of 22
(1,909 Views)

This is a little better.  It sets the BG color of the subdiagram label instead of the diagram.  (Still needs sub-vi "Flatten Diagrams.vi" in my previous post.

"If you weren't supposed to push it, it wouldn't be a button."
Message 20 of 22
(1,896 Views)