LabWindows/CVI

cancel
Showing results for 
Search instead for 
Did you mean: 

EVENT_COMMIT when EVENT_CLOSE closing panel

Hi,

    I have a string control in HOT mode with a callback associated with it.  If the cursor is on the control and I QuitUserInterface on the EVENT_CLOSE of the panel callback, the string control callback receives an EVENT_COMMIT.  I don't understand why this is happening any Ideas?  Do I need to remove the callback in the panel EVENT_CLOSE by setting the ATTR_CALLBACK_FUNCTION_POINTER to 0 or settting the mode to NORMAL?  I have never run into this before. 

 

Thanks,

Mike

0 Kudos
Message 1 of 5
(3,279 Views)

Hi,

 

can you post your string control callback...?

0 Kudos
Message 2 of 5
(3,268 Views)

If you are editing the string in the control it seems not strange to me. It happens the same when you operate another control during editing (e.g. type some characters in the string control and next click on a button): the string control receives the commit and lost focus events, next the new control receives the got focus and other possible events.



Proud to use LW/CVI from 3.1 on.

My contributions to the Developer Community
________________________________________
If I have helped you, why not giving me a kudos?
Message 3 of 5
(3,252 Views)

Roberto is right, as usual Smiley Happy

While I was aware of the LOST_FOCUS event I didn't realize that this will also trigger a COMMIT event because changing the focus will also finish the text input.

0 Kudos
Message 4 of 5
(3,242 Views)

I didn't enter anything in, but the cursor was in the box before I hit the close button.  I ended up just disabling the callback before the QuitUserInterface.  Below is the code for the string callback and the panel callback.

 

Mike 

 

int CVICALLBACK cbkTraveler (int panel, int control, int event,
        void *callbackData, int eventData1, int eventData2)
{ // cbkTraveler
    int    iRet;
    switch (event)
    { // Switch Event
        case EVENT_COMMIT:
            iRet = Message_Box("Database Access","Retrieving S/N's");
            iRet = Message_Box("Load","Load Parts");
            iRet = Message_Box("Marking","Marking");
            iRet = Message_Box("Un Load","Remove Parts");
            iRet = Message_Box("Verify","Are Parts OK");
            break; // EVENT_COMMIT
        case EVENT_LEFT_CLICK:

            break; // EVENT_LEFT_CLICK
        case EVENT_LEFT_DOUBLE_CLICK:

            break; // EVENT_LEFT_DOUBLE_CLICK
    }  // Switch Event
    return 0;
} // cbkTraveler


int CVICALLBACK cbkMainPnl (int panel, int event, void *callbackData,
        int eventData1, int eventData2)
{ // cbkMainPnl
    switch (event)
    { // Switch Event
        case EVENT_GOT_FOCUS:

            break; // EVENT_GOT_FOCUS
        case EVENT_LOST_FOCUS:

            break; // EVENT_LOST_FOCUS
        case EVENT_CLOSE:
            SetCtrlAttribute(panel, PNL_MAIN_TXT_TRAVELER, ATTR_CALLBACK_FUNCTION_POINTER, 0);
            QuitUserInterface(0);
            break; // EVENT_CLOSE
    } // Switch Event
    return 0;
} // cbkMainPnl

 

0 Kudos
Message 5 of 5
(3,231 Views)