adam@hpmtlx.HP.COM ($Adam Kao) (07/14/88)
Hello, here's a widget problem. I want to have a procedure that attaches
a standard "ok/cancel/help" set of buttons to a parent window. I need
to pass in the parent window and the procedures to be called on select.
This is the code I have now:
void ok (w, client_data, call_ata)
Widget w;
caddr_t client_data;
caddr_t call_data;
{
printf ("ok called\n");
}
/* cancel and help are similar procedures */
void add_donebuttons (ok, cancel, help, parent)
void (*ok)();
void (*cancel)();
void (*help)();
Widget *parent;
{
static XtCallbackRec callok[] = {
{ ok, NULL },
{ NULL, NULL },
}
/* callcancel and callhelp are the same */
Now, when I try to compile, the compiler complains:
"./donebuttons.c", line 13: incorrect initialization
Dereferencing ok ( *ok, NULL ) gives me the same error. Changing the
declaration (XtCallbackProc ok;) gives me the same error.
Taking out the parameter declarations:
void add_donebuttons (parent)
Widget *parent;
{
static XtCallbackRec callok[] = {
{ ok, NULL },
{ NULL, NULL },
}
and using the global ok/cancel/help makes the compiler happy, and even
gives me bug-free code.
So what's happening here?
Thank you for your time,
Adam