08-02-2023 03:34 AM
Hello,
I'm working a new project and I have a question regarding numerical indicator.
It's not so easy to explain but maybe it's the answer is too easy 🙂
When I want to change a value on an indicator, for example Init time, if I use the top or bottom arrows, after pressing APPLY, there's no problem.
If I put the cursor inside and change it with my keyboard and keep my cursor inside the indicator and press Apply, the modification not taken into account.
It's a bit annoying to have to click each time next to the indicator to validate.
Strangely enough, I have other identical functions that don't have this problem and I can't find any difference.
My version is labview 2015 32bits
Thanks a lot for your advices.
08-02-2023 03:59 AM
Hi fabricio,
@fabricio19 wrote:
When I want to change a value on an indicator, for example Init time, if I use the top or bottom arrows, after pressing APPLY, there's no problem.
If I put the cursor inside and change it with my keyboard and keep my cursor inside the indicator and press Apply, the modification not taken into account.
It's a bit annoying to have to click each time next to the indicator to validate.
When you can change values at runtime then you are using controls and not indicators…
When you use the arrows then you create a "value changed" event for each mouse click.
When you place the cursor inside the control and change the value using the keyboard (either numbers or up/down/left/right keys) you don't create "value change" events: that event gets toggled once you press the ENTER key or click outside the control.
BUT: when you immediately click the "Apply" button then the value change of your numeric input might "come too late" to be processed before your "apply data" operation…
How does the block diagram look like? Do you use the event structure?
08-02-2023 06:45 AM - edited 08-02-2023 06:49 AM
Yes, you are right, it's not indicators but controls...
Yes I use some event structure like following :
I use an event structure because I have lots of button to check in my front panel :
08-02-2023 07:21 AM
I really should let @GerdW explain this, but the problem is the "Apply" button, and the (improper) use of Local Variables inside the Event Structure. Your Event Structure should "fire" every time you change one of your Front Panel Controls. Your Event Structure needs to be inside a While Loop, because it needs to be updating whatever the output of the "Levels" sub-VI is doing and saving it in a Shift Register (inside the Event Loop's While). You need a separate Case for every Control whose "change" you want to capture. Indeed, if "Levels" is simply taking all its inputs and bundling them into a Cluster (which is the way I handle these things), then you don't need the sub-VI at all. Here's how I would do this:
Bob Schor
08-02-2023 09:03 AM
Thanks a lot for your answer.
It's very interresting. I understand the concept.
Do you think, it's possible to find an example online or on the website ni.com.
It could help me a lot to save time. 🙂
Best regards
Fabrice
08-02-2023 09:25 AM - edited 08-02-2023 09:25 AM
As has been explained in other words, controls have their own space data that gets read asynchronously by the code via a transfer buffer. Changing an entry without hitting enter or clicking outside will not push the value to the code side.
I would love the see the rest of the code, but it seems to greatly suffer from "chronic localitis", possibly due to prior experience in mostly text based code. I am sure some simple rearchitecting would greatly improve overall behavior and make things more rigorous and predictable.
For example a single typede'f cluster connector to the subVI would significantly simply the current spiderweb of wires entering from all sides.
08-02-2023 10:31 AM
This is the rest of the code.
With each test bench I develop, I try to improve parts of it, and it also helps me to progress even if I don't do Labview every day.
It's always interesting to talk to specialists.
08-02-2023 01:52 PM - edited 08-02-2023 02:12 PM
Hi fabricio,
@fabricio19 wrote:
This is the rest of the code.
You're kidding, the block diagram is WAY TOO big (navigation window):
Then re-attach the VI…
08-03-2023 03:08 AM
Hello,
I'm in the process of taking over the work of a trainee and it's not easy.
It's been a war to get him to reduce the size of the VI during his whole internship.
You made a very good point about the size of the variable. In fact, on embedded boards, we pay attention to this to reduce program and memory size, but not necessarily in my case. When programming with labview, you don't necessarily pay attention to this kind of thing, and that's a mistake.
Concerning the end-of-string character, we tested it with a variable because this character is used in very many places.
Thanks for your advices. I will work on it.
08-03-2023 10:01 AM
I am so sorry you have to deal with this code! I think it is beyond repair.
This code should get tossed and rewritten from scratch. It is not salvageable. It shows a complete misunderstanding of graphical programming and the magic and power of dataflow. Whoever wrote this was probably a text programmer unwilling to even look at the LabVIEW documentation. It's not just the size of the diagram (which has nothing to do with memory use), but mostly the logic and architecture.