当前位置: 技术问答>linux和unix
motif 使用问题?
来源: 互联网 发布时间:2016-01-17
本文导语: 哪位能告我一下怎样才能配好motif环境?(详细的) | test.c: #include main (int argc, char *argv[]) { Widget toplevel, button; XtAppContext app; ...
哪位能告我一下怎样才能配好motif环境?(详细的)
|
test.c:
#include
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
#include
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