LabVIEW

cancel
Showing results for 
Search instead for 
Did you mean: 

How to create controls dynamically?

Is it possible to create a control dynamically? (Especially on a graph control, to put some comments
on that)
 
Also I would like to know is it possible to disable part of the properties shown on a cursor legend. Like I dont want to alter the cursor color, style etc set during design time. 
 
 Can anybody help me out on this.
 
Kousy
0 Kudos
Message 1 of 9
(6,035 Views)

The answer is simple : forget it. Yes, this is something possible, and no you should not do it. If you really will to live an adventurous life, then search for "Labview scripting".

There are better work arounds than using an undocumented feature of LabVIEW. You already found that you can comment a graph using cursors, and move them programmatically over the interesting spots, using property nodes. That's probably the best way of doing it. However, the cursor text has to fit in the graph pane, and this is not always possible.

An alternative solution could be to use a string indicator to display the comment, and move it over the right position, using property nodes. Of course when you don't need the indicator, you can make it invisible, or transparent, or move it out of the window pane. So back to the first question : prepare a number of indicators/controls before hand, and make them appear when needed at run time. That's the easy way...

 

Chilly Charly    (aka CC)

         E-List Master - Kudos glutton - Press the yellow button on the left...
        
0 Kudos
Message 2 of 9
(6,026 Views)

As far as I know you cant create a control dynamically like in other languages.  I have tried to do this in the past with no success, I even tried to create a pool of generic (gObject) references and type-cast them and manipulate a GUI through the properties but it failed miserably.  I guess dynamic objects are more an object oriented concept while labview employs a data-flow model.  I would love to know how to do this as well, anyone know?

 

Paul

Paul Falkenstein
Coleman Technologies Inc.
CLA, CPI, AIA-Vision
Labview 4.0- 2013, RT, Vision, FPGA
0 Kudos
Message 3 of 9
(6,024 Views)
Thanks CC, you confirmed what I suspected.  Great question.
Paul Falkenstein
Coleman Technologies Inc.
CLA, CPI, AIA-Vision
Labview 4.0- 2013, RT, Vision, FPGA
0 Kudos
Message 4 of 9
(6,025 Views)
You can find some hints in the Lava Forum. There was a short contribution on the subject a while ago here . An additionnal extremely elegant solution is to use the picture control to create "false" controls/indicators. This is discussed in this thread, with some great examples. I should have mention it before... Credits to Ben for being an indefectible supporter of the technique.
Chilly Charly    (aka CC)

         E-List Master - Kudos glutton - Press the yellow button on the left...
        
Message 5 of 9
(6,015 Views)

Thanks Charley. I also already had thought of creating required no. of indicators to show the needed comments. But the thing is after seeing the graph's plot, have to put some comments where something extraordinary glitches/peaks occurred. Instead of indiactors I can place string controls itself to enable the user to write their comments. But how can I move that controls to the relevant place on the graph?
 
Also I want to know whether is it possible to stop the Timed loop & start again depends on some event basis. Hope any one help me out.
 
 
Thanks
 
Kousy
0 Kudos
Message 6 of 9
(5,984 Views)

Concider doing an "invoke node >>> get image" and then push that into a picture control.

Do some math to convert graph position to picture offests and insert text were required.

You can also draw some lines connecting the text to the event.

Just a clue that may help. If you come up with something that does this, please share an example.

 

Ben

Retired Senior Automation Systems Architect with Data Science Automation LabVIEW Champion Knight of NI and Prepper LinkedIn Profile YouTube Channel
0 Kudos
Message 7 of 9
(5,972 Views)
If you have the string controls, you can move them using property nodes.  Depending on how much trouble you want to go to, you can do this either statically (I found a peak, I want to move my control there) or dynamically (user sees a peak, grabs string control and drags it to location).  The static method is relatively easy using the property nodes.  The dynamic method requires using the event structure to look for mouse move events (only when you want them) and moving the string control using those mouse move events.  I would start with looking for a mouse down in the control, then move the control on mouse move until a mouse up occurs.  It will probably get more complex than that, but that will get you started.

One final note.  Even with scripting, LabVIEW cannot modify a running VI.  I have wanted this ability many times myself.  There is almost always a workaround.
0 Kudos
Message 8 of 9
(5,954 Views)
Although you can't create LabVIEW objects, you can create Window objects at runtime.  Such as text box (same as the one use by notepad), button, toolbar, statusbar, listbox, listview, tree, etc.
 
G Toolbox (http://gtoolbox.yeah.net) creates text box, button, statusbar, and listbox at runtime.
George Zou
0 Kudos
Message 9 of 9
(5,929 Views)