LabWindows/CVI

cancel
Showing results for 
Search instead for 
Did you mean: 

"ATTR_CALLBACK_NAME" and "EasyTab_ConvertFromCanvas"

Hi all,

I tried to get the name and pointer of a callback programatically by using:
GetCtrlAttribute (panel, PANEL_DONE, ATTR_CALLBACK_NAME, name) and
GetCtrlAttribute (panel, PANEL_DONE, ATTR_CALLBACK_FUNCTION_POINTER, fkt)

In my programm the function always returned bad data. After a day of searching, I found that the functions work fine until easytab_controls were used.

I modified the CVI sample program "simpdemo.c" and added the five marked lines. Before calling "EasyTab_ConvertFromCanvas" I can get the callback-name.
After calling "EasyTab_ConvertFromCanvas" I can't get a result

Any suggestions?


Thank in advance

Willi



And here the example code:

#include /* Needed if linking in external compiler; harmless otherwise */
#include
#include "easytab.h"
#include "simpdemo.h"


int main (int argc, char *argv[])
{
int panel, tabCtrl;
char name[256]; //@@@@@


if (InitCVIRTE (0, argv, 0) == 0) /* Needed if linking in external compiler; harmless otherwise */
return -1; /* out of memory */

panel = LoadPanel(0, "simpdemo.uir", PANEL);


GetCtrlAttribute (panel, PANEL_DONE, ATTR_CALLBACK_NAME, name); //@@@@@
printf("Name: %s\n",name); //@@@@@

/* Two function calls and, Voila!, a tab sheet dialog */
tabCtrl = EasyTab_ConvertFromCanvas(panel, PANEL_CANVAS);
EasyTab_LoadPanels (panel, tabCtrl, 1, "simpdemo.uir", __CVIUserHInst, CONTROL, 0,
VALVES, 0, MONITOR, 0, CONFIG, 0, HELP, 0, 0);

InstallPopup(panel);

GetCtrlAttribute (panel, PANEL_DONE, ATTR_CALLBACK_NAME, name); //@@@@@
printf("Name: %s\n",name); //@@@@@

RunUserInterface();


return 0;
}

int CVICALLBACK DoneCallback (int panel, int control, int event, void *callbackData, int eventData1, int eventData2)
{
if (event == EVENT_COMMIT)
QuitUserInterface(0);
return 0;
}

Hi all,

I tried to get the name and pointer of a callback programatically by using:
GetCtrlAttribute (panel, PANEL_DONE, ATTR_CALLBACK_NAME, name) and
GetCtrlAttribute (panel, PANEL_DONE, ATTR_CALLBACK_FUNCTION_POINTER, fkt)

In my programm the function always returned bad data. After a day of searching, I found that the functions work fine until easytab_controls were used.

I modified the CVI sample program "simpdemo.c" and added the five marked lines. Before calling "EasyTab_ConvertFromCanvas" I can get the callback-name.
After calling "EasyTab_ConvertFromCanvas" I can't get a result

Any suggestions?


Thank in advance

Willi



And here the example code:

#include /* Needed if linking in external compiler; harmless otherwise */
#include
#include "easytab.h"
#include "simpdemo.h"


int main (int argc, char *argv[])
{
int panel, tabCtrl;
char name[256]; //@@@@@


if (InitCVIRTE (0, argv, 0) == 0) /* Needed if linking in external compiler; harmless otherwise */
return -1; /* out of memory */

panel = LoadPanel(0, "simpdemo.uir", PANEL);


GetCtrlAttribute (panel, PANEL_DONE, ATTR_CALLBACK_NAME, name); //@@@@@
printf("Name: %s\n",name); //@@@@@

/* Two function calls and, Voila!, a tab sheet dialog */
tabCtrl = EasyTab_ConvertFromCanvas(panel, PANEL_CANVAS);
EasyTab_LoadPanels (panel, tabCtrl, 1, "simpdemo.uir", __CVIUserHInst, CONTROL, 0,
VALVES, 0, MONITOR, 0, CONFIG, 0, HELP, 0, 0);

InstallPopup(panel);

GetCtrlAttribute (panel, PANEL_DONE, ATTR_CALLBACK_NAME, name); //@@@@@
printf("Name: %s\n",name); //@@@@@

RunUserInterface();


return 0;
}

int CVICALLBACK DoneCallback (int panel, int control, int event, void *callbackData, int eventData1, int eventData2)
{
if (event == EVENT_COMMIT)
QuitUserInterface(0);
return 0;
}
0 Kudos
Message 1 of 2
(3,219 Views)
This strange behaviour depends on the easytab instrument you are using. If you look inside easytab.c, you will see that both the canvas control and the panel on which it is are chained particular callbacks specific of the easytab instrument. That's why the name of the function is differen after and before converting the canvas.

In case you want to call the original canvas callback simulating the behaviour of the easytab control, you can use toolbox CallCtrlCallback () function.

Roberto


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?
0 Kudos
Message 2 of 2
(3,219 Views)