Path: utzoo!attcan!uunet!lll-winken!lll-tis!helios.ee.lbl.gov!nosc!ucsd!ucsdhub!hp-sdd!hplabs!hpda!hp-sde!hpfcdc!hpislx!hpmtlx!adam
From: adam@hpmtlx.HP.COM ($Adam Kao)
Newsgroups: comp.windows.x
Subject: Desperately seeking HP Widget help
Message-ID: <650002@hpmtlx.HP.COM>
Date: 13 Jul 88 17:13:39 GMT
Organization: HP Manufacturing Test Division - Loveland, CO
Lines: 49

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