LabWindows/CVI

cancel
Showing results for 
Search instead for 
Did you mean: 

GetPanelAttribute ATTR_CALLBACK_FUNCTION_POINTER problems

How do I properly get and call the function from a Panel? 
 
The following gives me a Fatal runtime error on GetPanelAttribute call... but the error message doesn't make sense to me.
 
"Invalid arguement type: found
'pointer to  _cdecl int function(int, int, pointer to void, int int)', expected
'pointer to  _cdecl int function(int, int, pointer to void, int, int)'"
 
Why is that an invalid arguement?... You got what you were expecting.
 
void SomeFunctions(void)
{
  PanelCallbackPtr pfunc;
  GetPanelAttribute(panelHandle, ATTR_CALLBACK_FUNCTION_POINTER, pfunc);
  pfunc(panelHandle, EVENT_PANEL_SIZE, (void*)&panalData, 0,0);
}
 
I can replace "PanelCallbackPtr pfunc" directly with "int (_cdecl *pfunc) (int, int, void*, int, int)" and I get the same error.
0 Kudos
Message 1 of 4
(3,748 Views)

What a cryptic message! Smiley Surprised

I suggest you look at the source code for CallPanelCallback in the Programmer's toolbox: this function does exactly what you want to do, calling a panel callback, and demostrates how to perform this action being available in source form.



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 2 of 4
(3,740 Views)
Surely you need to pass a pointer to the function pointer?
 
GetPanelAttribute(panelHandle, ATTR_CALLBACK_FUNCTION_POINTER, &pfunc);
 
--
Martin
Certified CVI Developer
Message 3 of 4
(3,735 Views)

"Surely you need to pass a pointer to the function pointer?"

Surely yes.  I do I have to pass the function pointer by reference.  The message I posted above made it seem like it wasn't expecting a pointer by reference though.

I have a new question... or a re-defined one anyway.  

Is the function I have set in the UIR the same as the ATTR_CALLBACK_FUNCTION_POINTER?

if so, when does (if ever) the function I have in the UIR for the panel get set to to the CALLBACK attribute?

if not, how do I get a pointer to the panel function that was set in the UIR?

I'm trying to get the function pointer (panel callback function set in the UIR) after loading the panel, but before RunUserInterface()... when I do, the pointer has not yet been set. I can set it to some function and the get it back, but that doesn't solve what I'm trying to do.

Greg

 

 

0 Kudos
Message 4 of 4
(3,704 Views)