读书人

motif 使用有关问题

发布时间: 2012-02-14 19:19:19 作者: rapoo

motif 使用问题?
哪位能告我一下怎样才能配好motif环境?(详细的)

[解决办法]
test.c:
#include <Xm/PushB.h>
main (int argc, char *argv[])
{
Widget toplevel, button;
XtAppContext app;
void button_pushed(Widget, XtPointer, XtPointer);
XmString label;
Arg args[2];
XtSetLanguageProc (NULL, NULL, NULL);
toplevel = XtVaOpenApplication (&app, "Hello ", NULL, 0, &argc, argv,
NULL,sessionShellWidgetClass, NULL);
label = XmStringCreateLocalized ( "Push here to say hello ");
XtSetArg(args[0], XmNlabelString, label);
button = XmCreatePushButton (toplevel, "pushme ", args, 1);
XmStringFree (label);
XtAddCallback (button, XmNactivateCallback, button_pushed, NULL);
XtManageChild (button);
XtRealizeWidget (toplevel);
XtAppMainLoop (app);
}
void button_pushed (Widget widget, XtPointer client_data, XtPointer call_data)
{
printf ( "Hello Yourself!\n ");
}
gcc -W -o test test.c -L/usr/X11R6/lib -lXm -lXt -lX11 -I/usr/X11R6/include

读书人网 >UNIXLINUX

热点推荐