LabWindows/CVI

cancel
Showing results for 
Search instead for 
Did you mean: 

Added buttons on CVI UIR do not work

Command button added to my CVI UIR when the UIR is first created work (they generate EVENT_LEFT_CLICKs and EVENT_COMMITs). Command buttons added after code has been developed do not work (EVENT_LEFT_CLICKs are generated but EVENT_COMMITs are not). The buttons are hot and enabled.
0 Kudos
Message 1 of 4
(2,903 Views)
What do you mean by "after code had been developed"?

vishi

Doug L. wrote:
> Command button added to my CVI UIR when the UIR is first created work
> (they generate EVENT_LEFT_CLICKs and EVENT_COMMITs). Command buttons
> added after code has been developed do not work (EVENT_LEFT_CLICKs are
> generated but EVENT_COMMITs are not). The buttons are hot and
> enabled.
0 Kudos
Message 2 of 4
(2,903 Views)
Doug,

I'm assuming that you mean that command buttons that you create programmatically (with the NewCtrl function) do not work -- they do not generate COMMIT events.

If that's the case, I tried a simple test program and I could not reproduce that problem. (I'm attaching the program I used. If the problem happens in your machine, please let me know).

If this is not what you meant, please clarify your question a bit, or maybe just attach a sample program that causes this to happen.

Luis
NI
0 Kudos
Message 3 of 4
(2,903 Views)
How do you know EVENT_COMMITs are not being generated?
Have you tried using the UI Editor and selecting the operate tool (looks like a finger pointing to a button), then clicking on the button and watching the event names displayed to the right of the toolbar?
Do you have callback functions for the buttons? (In the UI Editor with the Edit tool selected (looks like a dashed box), right-click on the button and select View Control Callback. If Generate Control Callback and View Control Callback are greyed-out, it's because the button doesn't have a Callback Function assigned: in the UI Editor, double-click on the control and enter a function name in the box titled Callback Function.
Do you return a non-zero from the callback function before it processes the EVENT_COMMIT
(e.g. in a case for EVENT_LEFT_CLICK)? A non-zero return from a callback swallows the event. EVENT_LEFT_CLICK occurs before EVENT_COMMIT. If the calllback returns a non-zero value from EVENT_LEFT_CLICK, it will never see EVENT_COMMIT.
0 Kudos
Message 4 of 4
(2,903 Views)