LabWindows/CVI

cancel
Showing results for 
Search instead for 
Did you mean: 

How can I tell when a control is created?

When a control is destroyed I recieve the EVENT_DISCARD event but is there a way to tell when the control has been created (kinda of like a EVENT_CREATE) ?
0 Kudos
Message 1 of 4
(3,065 Views)
If you programatically create a control would you not know that you are about to do it from the logical sequence in your code?
Jattie van der Linde
Engineering Manager, Software & Automation
TEL Magnetic Solutions Ltd
0 Kudos
Message 2 of 4
(3,065 Views)
Well hypothetically yes but that is only if you know that the control exists. The program that I am working on is to have the ability for the user to create "controls" on the fly. These controls then register a event so that they can update themselves. The only common place that I can think of to do this is in the Callback which would stay the same for controls of all types. The fact is I can think of ways to do it such as looping thyough all the controls on a panel calling thier callback routines with a create event but this method seems ineffecient and seems strange to me that NI would not have a way to get a hold of this event.
0 Kudos
Message 3 of 4
(3,065 Views)
Hi,

CVI does not generates a CREATE event for a control. However there are a couple of things to ask: if you create your controls on the fly I'm guessing that you have a shared callback for all the newly created controls; in this case you could just call this shared callback with your own CREATE event to notify that a new control was linked to the callback.

there are a couple of things to mention here, you can also use the function GetPanelAttribute to get the number of controls in the panel. You can also create an array of callback functions where you could send the notification of the new controls to every callback in the code.

I hope this helps.

Regards,

Juan Carlos
N.I.
0 Kudos
Message 4 of 4
(3,065 Views)