[Motiftools-xmt-cvs] CVS: xmt/examples/RunApplication RunApp.c,NONE,1.1
Brought to you by:
motiftools
From: Grant M. <grm...@us...> - 2004-12-14 19:37:24
|
Update of /cvsroot/motiftools/xmt/examples/RunApplication In directory sc8-pr-cvs1.sourceforge.net:/tmp/cvs-serv18274 Added Files: RunApp.c Log Message: Example for new run application utility function --- NEW FILE --- #include <stdio.h> #include <Xmt/Xmt.h> #include <Xmt/ExtButton.h> #include <Xmt/WorkingBox.h> #include <Xmt/RunApplication.h> static Widget dialog; static void doneCallback(Widget w, XtPointer a, XtPointer b) { XtUnmanageChild(dialog); } static void doBg(Widget w, XtPointer a, XtPointer b) { char *arguments[] = { "date", "+%d-%b-%Y", NULL }; Arg args[10]; int n = 0; int error; int status; XtSetArg(args[n], XmtNmessage, "Running application"); n++; XtSetArg(args[n], XmtNshowScale, False); n++; dialog = XmtCreateWorkingDialog(w, "run", args, n); XtManageChild(dialog); status = XmtRunApplicationCallback("date", arguments, False, NULL, &error, w, doneCallback, NULL); if (status != XmtRUN_SUCCESS) { printf("failure: %d e=%d\n", status, error); XtUnmanageChild(dialog); } } int main(argc,argv) int argc; char **argv; { XtAppContext app; Widget toplevel, layout, button; toplevel = XtAppInitialize(&app, "BgWorker", NULL, 0, &argc, argv, NULL, NULL, 0); layout = XmtCreateLayout(toplevel, "layout", NULL, 0); XtManageChild(layout); button = XtVaCreateManagedWidget("pushMe", xmtExtButtonWidgetClass, layout, NULL); XtAddCallback(button, XmNactivateCallback, doBg, NULL); XtRealizeWidget(toplevel); XtAppMainLoop(app); } |