LabWindows/CVI

cancel
Showing results for 
Search instead for 
Did you mean: 

control callback eventdata for panel close

Solved!
Go to solution

Hi...

 

I am sorry, this seems to be such a basic question - but actually I could not find an answer in the help...

 

I have built a panel that is displayed using InstallPopup (); besides other controls the panel has a OK command button, and in the UIR editor the close control of the panel has been assigned to this OK button. (there is no panel callback for this panel)

 

In consequence, hitting the OK button or clicking on the Close button in the upper right corner of the panel title bar calls the control callback function, and in both cases a COMMIT event is generated because the command button is a hot control. That's all fine.

 

Now in the callback function CVICALLBACK PanelOK ( int panel, int control, int event, void *callbackData, int eventData1, int eventData2 ) I thought of distinguishing between the OK button and the panel close button and so I checked the parameters eventData1 and eventData2.

 

Pressing the OK button yields 0 in both parameters, and in my understanding this is fine.

 

However, clicking on the Close button in the upper right corner of the panel title bar yields 1 in both parameters, and I am trying to understand why there is a 1 and what this value means.

 

According to the help (and userint.h), the event data parameters for a COMMIT event are defined for

  • menu selection events
  • table events
  • tree events
  • mark state changes 
  • finishing label changes
  • double clicks
  • return keys
  • column labels
  • graphs

What case applies here? And what is the magic keyword I should have entered into the help search function to find the answer myself? Smiley Wink

 

Thanks!

0 Kudos
Message 1 of 3
(3,197 Views)
Solution
Accepted by topic author Wolfgang

Wolfgang,

 

Outside of the cases that you listed here, the event data is undefined. It's usually 0, but not necessarily so. You should definitely not rely on it being 1 in this case.

 

This basically means that you can't really differentiate between those two events. If you really need to differentiate, you can catch the panel's EVENT_CLOSE event.

 

Luis

Message 2 of 3
(3,180 Views)

Thanks, Luis!

0 Kudos
Message 3 of 3
(3,175 Views)