LabWindows/CVI

cancel
Showing results for 
Search instead for 
Did you mean: 

CallMenuCallback ?

Hello all,
why isn't there a CallMenuCallback() function similar to CallCtrlCallback or
CallPanelCallback ?
--
Guillaume Dargaud
http://www.gdargaud.net/


0 Kudos
Message 1 of 2
(2,954 Views)

It seems a little inconsistent that there isn't one, but it's not going to be hard to do. Something like:

 

#include <userint.h>

int CallMenuItemCallback (int menuBar, int menuItem, void *callbackData,
  int panel)
{
    void (CVICALLBACK * CallbackFunction)(int, int, void *, int);
 
    int retVal = GetMenuBarAttribute(menuBar, menuItem, ATTR_CALLBACK_FUNCTION_POINTER, &CallbackFunction);
 
    if (retVal < 0) // error check
        return retVal;
 
    // If there is a callback, call it
    if (CallbackFunction)
        (*CallbackFunction)(menuBar, menuItem, callbackData, panel);


    return 0;
}

might suffice?

 

(n.b.: code above untested)

--
Martin
Certified CVI Developer
Message 2 of 2
(2,946 Views)