int main(int argc, char **argv) { Widget toplevel, spb, bb, list, tf; XtAppContext app; XmString item; Arg al[10]; int ac; XtSetLanguageProc(NULL, NULL, NULL); toplevel = XtVaAppInitialize(&app, "SpinBox", NULL, 0, &argc, argv, NULL, NULL); bb = XmCreateForm(toplevel, "bb", NULL, 0); XtManageChild(bb); XtRealizeWidget(toplevel); ac = 0; spb = XmCreateSpinBox(bb, "spinbox", al, ac); XtAddCallback(spb, XmNvalueChangedCallback, ModifyVerify, NULL); ac = 0; XtSetArg(al[ac], XmNspinBoxChildType, XmNUMERIC); ac++; XtSetArg(al[ac], XmNdecimalPoints, 1); ac++; tf = XmCreateTextField(spb, "tf", al, ac); XtManageChild(tf); XtManageChild(spb); LessTifTestMainLoop(toplevel); exit(0); }
void main (int argc, char **argv) { Arg args[10]; int n; CommonTestInit (argc, argv); n=0; Parent = XmCreateFrame (Shell1, "Frame", args, n); XtManageChild (Parent); n=0; XtSetArg (args[n], XmNarrowLayout, XmARROWS_FLAT_END); n++; XtSetArg (args[n], XmNrepeatDelay, 0); n++; XtSetArg (args[n], XmNarrowOrientation, XmHORIZONTAL); n++; SpinBox1 = XmCreateSpinBox (Parent, "SpinBox1", args, n); XtManageChild (SpinBox1); XtAddCallback (SpinBox1, XmNvalueChangedCallback, ValueChanged, (XtPointer)NULL); XtAddCallback (SpinBox1, XmNmodifyVerifyCallback, ModifyVerify, (XtPointer)0); n=0; XtSetArg (args[n], XmNspinBoxChildType, XmNUMERIC); n++; XtSetArg (args[n], XmNminimumValue, 1); n++; XtSetArg (args[n], XmNmaximumValue, 10); n++; XtSetArg (args[n], XmNincrementValue, 3); n++; XtSetArg (args[n], XmNposition, 2); n++; XtSetArg (args[n], XmNpositionType, XmPOSITION_INDEX); n++; TextF1 = XmCreateTextField (SpinBox1, "TextF1", args,n); XtManageChild (TextF1); XtRealizeWidget (Shell1); CommonPause(); CommonPause(); XtAddCallback( SpinBox1, XmNmodifyVerifyCallback, CrossedBound, (XtPointer)0 ); CommonPause(); XtRemoveCallback( SpinBox1, XmNmodifyVerifyCallback, CrossedBound, (XtPointer)0 ); XtAddCallback( SpinBox1, XmNmodifyVerifyCallback, SetPosition, (XtPointer)0 ); CommonPause(); XtRemoveCallback( SpinBox1, XmNmodifyVerifyCallback, SetPosition, (XtPointer)0 ); CommonPause(); CommonPause(); XtAppMainLoop (app_context); }
int main(int argc, char **argv) { XtAppContext app; XmString item; Arg al[10]; int ac; XtSetLanguageProc(NULL, NULL, NULL); toplevel = XtVaAppInitialize(&app, "SpinBox", NULL, 0, &argc, argv, NULL, NULL); #ifdef USE_BB bb = XmCreateBulletinBoard(toplevel, "bb", NULL, 0); XtManageChild(bb); #else bb = toplevel; #endif ac = 0; spb = XmCreateSpinBox(bb, "spinbox", al, ac); XtAddCallback(spb, XmNvalueChangedCallback, ModifyVerify, NULL); ac = 0; XtSetArg(al[ac], XmNspinBoxChildType, XmNUMERIC); ac++; day = XmCreateText(spb, "day", al, ac); XtManageChild(day); ac = 0; XtSetArg(al[ac], XmNspinBoxChildType, XmNUMERIC); ac++; month = XmCreateText(spb, "month", al, ac); XtManageChild(month); ac = 0; XtSetArg(al[ac], XmNspinBoxChildType, XmNUMERIC); ac++; year = XmCreateText(spb, "year", al, ac); XtManageChild(year); XtManageChild(spb); XtRealizeWidget(toplevel); LessTifTestMainLoop(toplevel); exit(0); }
void main(int argc, char **argv) { Widget MainForm, ControlPanel, Separator1, Separator2, Label1, Label2; XmString string; CommonTestInit( argc, argv ); n = 0; XtSetArg( args[n], XmNx, 0 ); n++; XtSetArg( args[n], XmNy, 0 ); n++; XtSetValues( Shell1, args, n ); XtRealizeWidget( Shell1 ); n = 0; MainForm = XmCreateForm( Shell1, "MainForm", args, n ); XtManageChild( MainForm ); string = XmStringCreateLtoR("XmSTRING:", XmFONTLIST_DEFAULT_TAG ); n = 0; XtSetArg( args[n], XmNtopAttachment, XmATTACH_FORM ); n++; XtSetArg( args[n], XmNleftAttachment, XmATTACH_FORM ); n++; XtSetArg( args[n], XmNwidth, SPIN_BOX_WIDTH ); n++; XtSetArg( args[n], XmNlabelString, string ); n++; XtSetArg( args[n], XmNalignment, XmALIGNMENT_CENTER ); n++; Label1 = XmCreateLabel( MainForm, "Label1", args, n ); XtManageChild( Label1 ); XmStringFree( string ); n = 0; XtSetArg( args[n], XmNtopAttachment, XmATTACH_WIDGET ); n++; XtSetArg( args[n], XmNtopWidget, Label1 ); n++; XtSetArg( args[n], XmNleftAttachment, XmATTACH_FORM ); n++; XtSetArg( args[n], XmNwidth, SPIN_BOX_WIDTH ); n++; XtSetArg( args[n], XmNheight, SPIN_BOX_HEIGHT ); n++; XtSetArg( args[n], XmNarrowLayout, XmARROWS_FLAT_END ); n++; XtSetArg( args[n], XmNarrowOrientation, XmARROWS_HORIZONTAL ); n++; SpinBox1 = XmCreateSpinBox( MainForm, "SpinBox1", args, n ); XtManageChild( SpinBox1 ); n = 0; StringTextF = XmCreateTextField( SpinBox1, "StringTextF", args, n ); XtManageChild( StringTextF ); string = XmStringCreateLtoR("XmNUMERIC:", XmFONTLIST_DEFAULT_TAG ); n = 0; XtSetArg( args[n], XmNtopAttachment, XmATTACH_FORM ); n++; XtSetArg( args[n], XmNleftAttachment, XmATTACH_WIDGET ); n++; XtSetArg( args[n], XmNleftWidget, Label1 ); n++; XtSetArg( args[n], XmNwidth, SPIN_BOX_WIDTH ); n++; XtSetArg( args[n], XmNlabelString, string ); n++; XtSetArg( args[n], XmNalignment, XmALIGNMENT_CENTER ); n++; Label2 = XmCreateLabel( MainForm, "Label2", args, n ); XtManageChild( Label2 ); XmStringFree( string ); n = 0; XtSetArg( args[n], XmNtopAttachment, XmATTACH_WIDGET ); n++; XtSetArg( args[n], XmNtopWidget, Label2 ); n++; XtSetArg( args[n], XmNleftAttachment, XmATTACH_WIDGET ); n++; XtSetArg( args[n], XmNleftWidget, SpinBox1 ); n++; XtSetArg( args[n], XmNwidth, SPIN_BOX_WIDTH ); n++; XtSetArg( args[n], XmNheight, SPIN_BOX_HEIGHT ); n++; XtSetArg( args[n], XmNarrowLayout, XmARROWS_FLAT_END ); n++; XtSetArg( args[n], XmNarrowOrientation, XmARROWS_HORIZONTAL ); n++; SpinBox2 = XmCreateSpinBox( MainForm, "SpinBox2", args, n ); XtManageChild( SpinBox2 ); n = 0; NumericTextF = XmCreateTextField( SpinBox2, "NumericTextF", args, n ); XtManageChild( NumericTextF ); CreateControlPanel(); CommonPause(); CommonPause(); CommonPause(); CommonPause(); CommonPause(); CommonPause(); CommonPause(); CommonPause(); CommonPause(); CommonPause(); CommonPause(); CommonPause(); CommonPause(); CommonPause(); CommonPause(); CommonPause(); MotifConvergeTP3(); MotifConvergeTP4(); MotifConvergeTP5(); MotifConvergeTP6(); MotifConvergeTP7(); XtAppMainLoop( app_context ); }
static Widget h_create_fonts_frame(Widget top, struct topic_info *info) { Widget darkness_form, darkness_label; UNUSED(info); darkness_form = XmCreateForm(top, "darkness_form", NULL, 0); XtVaSetValues(darkness_form, XmNverticalSpacing, 10, XmNhorizontalSpacing, 10, NULL); darkness_label = XmCreateLabelGadget(darkness_form, "Font Darkness: ", NULL, 0); XtVaSetValues(darkness_label, XmNtopAttachment, XmATTACH_FORM, XmNleftAttachment, XmATTACH_FORM, XmNbottomAttachment, XmATTACH_FORM, NULL); XtManageChild(darkness_label); { Widget darkness_text; #if USE_SPINBOX Widget darkness_spinbox = XmCreateSpinBox(darkness_form, Xdvi_DARKNESS_SPINBOX, NULL, 0); darkness_text = XmCreateTextField(darkness_spinbox, Xdvi_DARKNESS_TEXT, NULL, 0); XtVaSetValues(darkness_spinbox, XmNtopAttachment, XmATTACH_FORM, XmNleftAttachment, XmATTACH_WIDGET, XmNleftWidget, darkness_label, XmNinitialDelay, 200, XmNrepeatDelay, 50, NULL); XtVaSetValues(darkness_text, XmNspinBoxChildType, XmNUMERIC, XmNminimumValue, 0, XmNmaximumValue, 1000, XmNeditable, True, XmNcolumns, 4, XmNincrementValue, 1, XmNwrap, False, /* too confusing */ XmNposition, (int)(resource.gamma * 100.0 + 0.5), NULL); XtAddCallback(darkness_text, XmNactivateCallback, darkness_text_cb, (XtPointer)info); XtAddCallback(darkness_text, XmNvalueChangedCallback, darkness_text_cb, (XtPointer)info); adjust_heights(darkness_spinbox, darkness_text, darkness_label, NULL); XtManageChild(darkness_text); XtManageChild(darkness_spinbox); #else char buf[LENGTH_OF_INT]; Widget darkness_button; darkness_text = XmCreateTextField(darkness_form, Xdvi_DARKNESS_TEXT, NULL, 0); SNPRINTF(buf, LENGTH_OF_INT, "%d", (int)(resource.gamma * 100.0 + 0.5)); XtVaSetValues(darkness_text, XmNtopAttachment, XmATTACH_FORM, XmNleftAttachment, XmATTACH_WIDGET, XmNleftWidget, darkness_label, XmNcolumns, 4, XmNvalue, buf, XmNuserData, darkness_text, NULL); XtOverrideTranslations(darkness_text, XtParseTranslationTable("<Key>Return:activate()")); XtAddCallback(darkness_text, XmNactivateCallback, darkness_text_cb, (XtPointer)info); darkness_button = XmCreatePushButton(darkness_form, Xdvi_APPLY_STR, NULL, 0); XtVaSetValues(darkness_button, XmNtopAttachment, XmATTACH_FORM, XmNleftAttachment, XmATTACH_WIDGET, XmNleftWidget, darkness_text, XmNuserData, darkness_text, NULL); XtAddCallback(darkness_button, XmNactivateCallback, darkness_text_cb, (XtPointer)info); adjust_heights(darkness_label, darkness_text, darkness_button, NULL); XtManageChild(darkness_text); XtManageChild(darkness_button); #endif } /* XtManageChild(darkness_form); */ return darkness_form; }
Widget XmCreateSpinBox_TNK(Widget parent, String name, ArgList arglist,Cardinal argcount) { return XmCreateSpinBox(parent, name, arglist, argcount);}
int main(int argc, char **argv) { Widget shell, panedw, rc, rc2, sb1, sb2; Widget label, label2; Arg args[20]; int argcount; int i; XmString months[12]; char *monthstr[12]; char buf[10]; char *str; shell = XtVaAppInitialize(&context, APP_CLASS, NULL, 0, &argc, argv, fallback_resources, NULL); time(&timer); thetime = localtime(&timer); dy = thetime -> tm_mday; yr = thetime -> tm_year + 1900; mn = thetime -> tm_mon; hr = thetime -> tm_hour; mi = thetime -> tm_min; panedw = XmCreatePanedWindow(shell, "BBoard", NULL, 0); XtManageChild(panedw); /* argcount = 0; XtSetArg(args[argcount], XmNlabelType, XmSTRING), argcount++; XtSetArg(args[argcount], XmNlabelString, XmStringCreate("Set Current Date and Time", XmSTRING_DEFAULT_CHARSET)), argcount++; label = XmCreateLabel(panedw, "label1", args, argcount); XtManageChild(label); */ str = XGetDefault(XtDisplay(panedw), APP_CLASS, "dateCommand"); if (str == NULL) str = XGetDefault(XtDisplay(panedw), argv[0], "dateCommand"); if (str == NULL) dateCommand = "echo Default command, the date is: %s"; else dateCommand = str; rc = XmCreateRowColumn(panedw, "SpinBoxs", NULL, 0); XtManageChild(rc); label = XmCreateLabel(rc, "label2", NULL, 0); XtManageChild(label); sb1 = XmCreateSpinBox(rc, "DateSB", NULL, 0); XtAddCallback(sb1, XmNvalueChangedCallback, ValueChanged, NULL); XtManageChild(sb1); argcount = 0; XtSetArg(args[argcount], XmNpositionType, XmPOSITION_INDEX), argcount++; XtSetArg(args[argcount], XmNspinBoxChildType, XmNUMERIC), argcount++; XtSetArg(args[argcount], XmNmaximumValue, 31), argcount++; XtSetArg(args[argcount], XmNminimumValue, 1), argcount++; XtSetArg(args[argcount], XmNposition, dy - 1), argcount++; XtSetArg(args[argcount], XmNcolumns, 3), argcount++; day = XmCreateTextField(sb1, "Day", args, argcount); XtManageChild(day); #ifndef CSRG_BASED months[0] = XmStringCreate(nl_langinfo(MON_1), XmSTRING_DEFAULT_CHARSET); months[1] = XmStringCreate(nl_langinfo(MON_2), XmSTRING_DEFAULT_CHARSET); months[2] = XmStringCreate(nl_langinfo(MON_3), XmSTRING_DEFAULT_CHARSET); months[3] = XmStringCreate(nl_langinfo(MON_4), XmSTRING_DEFAULT_CHARSET); months[4] = XmStringCreate(nl_langinfo(MON_5), XmSTRING_DEFAULT_CHARSET); months[5] = XmStringCreate(nl_langinfo(MON_6), XmSTRING_DEFAULT_CHARSET); months[6] = XmStringCreate(nl_langinfo(MON_7), XmSTRING_DEFAULT_CHARSET); months[7] = XmStringCreate(nl_langinfo(MON_8), XmSTRING_DEFAULT_CHARSET); months[8] = XmStringCreate(nl_langinfo(MON_9), XmSTRING_DEFAULT_CHARSET); months[9] = XmStringCreate(nl_langinfo(MON_10), XmSTRING_DEFAULT_CHARSET); months[10] = XmStringCreate(nl_langinfo(MON_11), XmSTRING_DEFAULT_CHARSET); months[11] = XmStringCreate(nl_langinfo(MON_12), XmSTRING_DEFAULT_CHARSET); #else months[0] = XmStringCreate("January", XmSTRING_DEFAULT_CHARSET); months[1] = XmStringCreate("February", XmSTRING_DEFAULT_CHARSET); months[2] = XmStringCreate("March", XmSTRING_DEFAULT_CHARSET); months[3] = XmStringCreate("April", XmSTRING_DEFAULT_CHARSET); months[4] = XmStringCreate("May", XmSTRING_DEFAULT_CHARSET); months[5] = XmStringCreate("June", XmSTRING_DEFAULT_CHARSET); months[6] = XmStringCreate("July", XmSTRING_DEFAULT_CHARSET); months[7] = XmStringCreate("August", XmSTRING_DEFAULT_CHARSET); months[8] = XmStringCreate("September", XmSTRING_DEFAULT_CHARSET); months[9] = XmStringCreate("October", XmSTRING_DEFAULT_CHARSET); months[10] = XmStringCreate("November", XmSTRING_DEFAULT_CHARSET); months[11] = XmStringCreate("December", XmSTRING_DEFAULT_CHARSET); #endif argcount = 0; XtSetArg(args[argcount], XmNpositionType, XmPOSITION_INDEX), argcount++; XtSetArg(args[argcount], XmNvalues, months), argcount++; XtSetArg(args[argcount], XmNnumValues, 12), argcount++; XtSetArg(args[argcount], XmNposition, mn), argcount++; XtSetArg(args[argcount], XmNcolumns, 12), argcount++; month = XmCreateTextField(sb1, "MonthSB", args, argcount); XtManageChild(month); argcount = 0; XtSetArg(args[argcount], XmNpositionType, XmPOSITION_INDEX), argcount++; XtSetArg(args[argcount], XmNspinBoxChildType, XmNUMERIC), argcount++; XtSetArg(args[argcount], XmNmaximumValue, 2020), argcount++; XtSetArg(args[argcount], XmNminimumValue, 1992), argcount++; XtSetArg(args[argcount], XmNposition, yr-1992), argcount++; XtSetArg(args[argcount], XmNcolumns, 5), argcount++; year = XmCreateTextField(sb1, "YearSB", args, argcount); XtManageChild(year); argcount = 0; label = XmCreateLabel(rc, "label3", args, argcount); XtManageChild(label); argcount = 0; XtSetArg(args[argcount], XmNy, 50), argcount++; sb2 = XmCreateSpinBox(rc, "TimeSB", args, argcount); XtAddCallback(sb2, XmNvalueChangedCallback, ValueChanged, NULL); XtManageChild(sb2); argcount = 0; XtSetArg(args[argcount], XmNpositionType, XmPOSITION_INDEX), argcount++; XtSetArg(args[argcount], XmNspinBoxChildType, XmNUMERIC), argcount++; XtSetArg(args[argcount], XmNmaximumValue, 23), argcount++; XtSetArg(args[argcount], XmNminimumValue, 0), argcount++; XtSetArg(args[argcount], XmNposition, hr), argcount++; XtSetArg(args[argcount], XmNcolumns, 3), argcount++; hour = XmCreateTextField(sb2, "Hour", args, argcount); XtManageChild(hour); argcount = 0; XtSetArg(args[argcount], XmNpositionType, XmPOSITION_INDEX), argcount++; XtSetArg(args[argcount], XmNlabelType, XmSTRING), argcount++; XtSetArg(args[argcount], XmNlabelString, XmStringCreate(":", XmSTRING_DEFAULT_CHARSET)), argcount++; label = XmCreateLabel(sb2, "label4", args, argcount); XtManageChild(label); argcount = 0; XtSetArg(args[argcount], XmNpositionType, XmPOSITION_INDEX), argcount++; XtSetArg(args[argcount], XmNspinBoxChildType, XmNUMERIC), argcount++; XtSetArg(args[argcount], XmNmaximumValue, 59), argcount++; XtSetArg(args[argcount], XmNminimumValue, 0), argcount++; XtSetArg(args[argcount], XmNposition, mi), argcount++; XtSetArg(args[argcount], XmNcolumns, 3), argcount++; minute = XmCreateTextField(sb2, "Minute", args, argcount); XtManageChild(minute); argcount = 0; XtSetArg(args[argcount], XmNorientation, XmHORIZONTAL), argcount++; XtSetArg(args[argcount], XmNpacking, XmPACK_TIGHT), argcount++; rc2 = XmCreateRowColumn(panedw, "SpinBoxs2", args, argcount); XtManageChild(rc2); argcount = 0; action = XmCreatePushButton(rc2, "SetDate", args, argcount); XtManageChild(action); XtAddCallback(action, XmNactivateCallback, Doit, "OK"); argcount = 0; exitpb = XmCreatePushButton(rc2, "Quit", args, argcount); XtManageChild(exitpb); XtAddCallback(exitpb, XmNactivateCallback, QuitAppl, "OK"); XtRealizeWidget(shell); XtAppMainLoop(context); return 0; /* make compiler happy */ }
void CreateSpinBoxes(Widget parent_of_spin_box) { Cardinal n; Position nextY; Arg argList[25]; Widget parent; XmString decoString; /***** Set Y position for next SpinBox *****/ nextY = 10; /***** Create BulletinBoard parent for SpinBox widgets *****/ n = 0; XtSetArg(argList[n], XmNwidth, 250); n++; XtSetArg(argList[n], XmNheight, 400); n++; parent = XmCreateBulletinBoard(parent_of_spin_box, "Parent", argList, n); XtManageChild(parent); /****************************************************************/ /***** ***** Create SpinBox spin0 ***** ***** Choices: months of the year ***** ***** Callbacks: ***** - changedSpin0 Prints string desription of callback ***** reason, and prints 'new' year when boundary ***** is crossed (January to December, decrement year; ***** December to January, increment year); *****/ /***** Create SpinBox parent *****/ n = 0; XtSetArg(argList[n], XmNy, nextY); n++; spin0 = XmCreateSpinBox(parent, "spin0", argList, n); /***** Increment Y position for next SpinBox *****/ nextY += Y_OFFSET; /***** Create XmString array of month names *****/ setMonths(); /***** Create TextField child *****/ n = 0; XtSetArg(argList[n], XmNvalues, monthValues); n++; XtSetArg(argList[n], XmNnumValues, 12); n++; XtSetArg(argList[n], XmNspinBoxChildType, XmSTRING); n++; XtSetArg(argList[n], XmNselectionPolicy, XmSINGLE_SELECT); n++; XtSetArg(argList[n], XmNeditable, False); n++; spin0_text = XmCreateTextField(spin0, "spin0_text", argList, n); /***** Manage SpinBox *****/ XtManageChild(spin0); /***** Call changedSpin0 AFTER displayed value has changed *****/ XtAddCallback(spin0, XmNvalueChangedCallback, changedSpin0, (XtPointer) 0); /***** Manage SpinBox child *****/ XtManageChild(spin0_text); /***** End of SpinBox spin0 *****/ /***** ***** Create SpinBox spin1 ***** ***** Choices: letters of the alphabet ***** ***** Callbacks: ***** - modifySpin1 Callback prevents spinning beyond ***** positions 0 (letter a) and 6 (letter g) ***** ***** - changedSpin1 Sets arrow sensitivity to inhibit wrapping ***** *****/ /***** Create SpinBox parent *****/ n = 0; XtSetArg(argList[n], XmNy, nextY); n++; XtSetArg(argList[n], XmNdefaultArrowSensitivity, XmARROWS_DECREMENT_SENSITIVE); n++; spin1 = XmCreateSpinBox(parent, "spin1", argList, n); /***** Increment Y position for next SpinBox *****/ nextY += Y_OFFSET; /***** Create XmString array of single letters *****/ setLetters(); /***** Create SpinBox child *****/ n = 0; XtSetArg(argList[n], XmNvalues, letterValues); n++; XtSetArg(argList[n], XmNnumValues, NUM_LETTERS); n++; XtSetArg(argList[n], XmNspinBoxChildType, XmSTRING); n++; XtSetArg(argList[n], XmNarrowSensitivity, XmARROWS_INCREMENT_SENSITIVE); n++; XtSetArg(argList[n], XmNeditable, False); n++; spin1_text = XmCreateTextField(spin1, "spin0_text", argList, n); /***** Manage SpinBox *****/ XtManageChild(spin1); /***** Call modifySpin1 BEFORE displayed value is changed *****/ XtAddCallback(spin1, XmNmodifyVerifyCallback, modifySpin1, (XtPointer) 0); /***** Call changedSpin1 AFTER displayed value has changed *****/ XtAddCallback(spin1, XmNvalueChangedCallback, changedSpin1, (XtPointer) 0); /***** Manage SpinBox child *****/ XtManageChild(spin1_text); /***** End of SpinBox spin1 *****/ /***** ***** Create SpinBox spin2 ***** ***** Choices: 0.0000 to 0.0010 by .0002 ***** ***** Initial Position: 4 (displays 0.0008) ***** ***** Callbacks: none ***** *****/ /***** Create SpinBox parent *****/ n = 0; XtSetArg(argList[n], XmNy, nextY); n++; spin2 = XmCreateSpinBox( parent, "spin2", argList, n ); /***** Increment Y position for next SpinBox *****/ nextY += Y_OFFSET; n = 0; XtSetArg(argList[n], XmNposition, 4); n++; XtSetArg(argList[n], XmNdecimalPoints, 4); n++; XtSetArg(argList[n], XmNincrementValue, 2); n++; XtSetArg(argList[n], XmNspinBoxChildType, XmNUMERIC); n++; XtSetArg(argList[n], XmNeditable, False); n++; spin2_text = XmCreateTextField( spin2, "spin2_text", argList, n ); /***** Manage SpinBox *****/ XtManageChild(spin2); /***** Manage SpinBox child *****/ XtManageChild(spin2_text); /***** End of SpinBox spin2 *****/ /***** ***** Create SpinBox spin3 ***** ***** Choices: 0.000 to 121.500 by 0.002 ***** ***** Callbacks: none ***** *****/ /***** Create SpinBox parent *****/ n = 0; XtSetArg(argList[n], XmNy, nextY); n++; XtSetArg(argList[n], XmNrepeatDelay, 250); n++; XtSetArg(argList[n], XmNarrowLayout, XmARROWS_BEGINNING); n++; spin3 = XmCreateSpinBox( parent, "spin3", argList, n ); /***** Increment Y position for next SpinBox *****/ nextY += Y_OFFSET; n = 0; XtSetArg(argList[n], XmNminimumValue, 0); n++; XtSetArg(argList[n], XmNdecimalPoints, 3); n++; XtSetArg(argList[n], XmNincrementValue, 2); n++; XtSetArg(argList[n], XmNmaximumValue, 121500); n++; XtSetArg(argList[n], XmNspinBoxChildType, XmNUMERIC); n++; spin3_text = XmCreateTextField( spin3, "spin3_text", argList, n ); /***** Manage SpinBox *****/ XtManageChild(spin3); /***** Manage SpinBox child *****/ XtManageChild(spin3_text); /***** End of SpinBox spin3 *****/ /***** ***** Create SpinBox spin4 ***** ***** Choices: 0 to 10 by 1 ***** ***** Callbacks: ***** - modifySpin4 Callback inhibits spinning below 0 ***** at all times. Wrapping increments the maximum value. ***** *****/ /***** Create SpinBox parent *****/ n = 0; XtSetArg(argList[n], XmNy, nextY); n++; XtSetArg(argList[n], XmNarrowSize, 35); n++; XtSetArg(argList[n], XmNrepeatDelay, 250); n++; XtSetArg(argList[n], XmNinitialDelay, 500); n++; XtSetArg(argList[n], XmNarrowLayout, XmARROWS_SPLIT); n++; spin4 = XmCreateSpinBox( parent, "spin4", argList, n ); /***** Increment Y position for next SpinBox *****/ nextY += Y_OFFSET; n = 0; XtSetArg(argList[n], XmNmaximumValue, 4); n++; XtSetArg(argList[n], XmNspinBoxChildType, XmNUMERIC); n++; spin4_text = XmCreateTextField( spin4, "spin4_text", argList, n ); /***** Manage SpinBox *****/ XtManageChild(spin4); /***** Call modifySpin4 BEFORE displayed value is changed *****/ XtAddCallback(spin4, XmNmodifyVerifyCallback, modifySpin4, (XtPointer) 0); /***** Manage SpinBox child *****/ XtManageChild(spin4_text); /***** End of SpinBox spin4 *****/ /***** ***** Create SpinBox spin5 ***** ***** Choices: 0 to 10 by 1 ***** ***** Delay: Repeat delay is 0 - displayed value only increments ***** or decrements ONCE each time arrow is armed ***** ***** Callbacks: none ***** *****/ /***** Create SpinBox parent *****/ n = 0; XtSetArg(argList[n], XmNy, nextY); n++; XtSetArg(argList[n], XmNarrowSize, 20); n++; XtSetArg(argList[n], XmNrepeatDelay, 0); n++; XtSetArg(argList[n], XmNarrowLayout, XmARROWS_BEGINNING); n++; spin5 = XmCreateSpinBox( parent, "spin5", argList, n ); /***** Increment Y position for next SpinBox *****/ nextY += Y_OFFSET; n = 0; XtSetArg(argList[n], XmNminimumValue, 1); n++; XtSetArg(argList[n], XmNposition, 1); n++; XtSetArg(argList[n], XmNspinBoxChildType, XmNUMERIC); n++; XtSetArg(argList[n], XmNeditable, False); n++; spin5_text = XmCreateTextField( spin5, "spin5_text", argList, n ); /***** Manage SpinBox *****/ XtManageChild(spin5); /***** Manage SpinBox child *****/ XtManageChild(spin5_text); /***** End of SpinBox spin5 *****/ /***** ***** Create SpinBox spin6 ***** ***** This example has multiple children, including two ***** decoration children. In addition, this SpinBox ***** includes 'chaining', the process where a change ***** in one child causes values to change in the child ***** and on or more other children. Chaining is performed ***** by the valueChanged callback. ***** ***** Choices: spin6_text1 1 to 12 (months) ***** spin6_deco1 '/' decoration ***** spin6_text2 1 to 28-31 (max days varies by month) ***** spin6_deco2 '/' decoration ***** spin6_text3 0 to 99 (years) ***** ***** Callbacks: ***** - changedSpin6 sets maximum days in month. The month field ***** is chained to the day field, and the year field is ***** chained to the month field. (When the day child ***** wraps, the month child is also changed. When the ***** month child wraps, the year child is also changed.) ***** *****/ /***** Create SpinBox parent *****/ n = 0; XtSetArg(argList[n], XmNy, nextY); n++; XtSetArg(argList[n], XmNinitialDelay, 0); n++; XtSetArg(argList[n], XmNrepeatDelay, 150); n++; spin6 = XmCreateSpinBox( parent, "spin6", argList, n ); /***** Increment Y position for next SpinBox *****/ nextY += Y_OFFSET; /***** Create SpinBox child *****/ n = 0; XtSetArg(argList[n], XmNwidth, 30); n++; XtSetArg(argList[n], XmNposition, thisMM - 1); n++; XtSetArg(argList[n], XmNminimumValue, 1); n++; XtSetArg(argList[n], XmNmaximumValue, 12); n++; XtSetArg(argList[n], XmNspinBoxChildType, XmNUMERIC); n++; spin6_text1 = XmCreateTextField( spin6, "spin6_text1", argList, n ); /***** Create SpinBox decoration child *****/ n = 0; decoString = XmStringCreateLtoR("/", XmSTRING_DEFAULT_CHARSET); XtSetArg(argList[n], XmNlabelString, decoString); n++; spin6_deco1 = XmCreateLabel( spin6, "spin6_deco1", argList, n ); /***** Create SpinBox child *****/ n = 0; XtSetArg(argList[n], XmNwidth, 30); n++; XtSetArg(argList[n], XmNposition, thisDD - 1); n++; XtSetArg(argList[n], XmNminimumValue, 1); n++; XtSetArg(argList[n], XmNmaximumValue, 31); n++; XtSetArg(argList[n], XmNspinBoxChildType, XmNUMERIC); n++; spin6_text2 = XmCreateTextField( spin6, "spin6_text2", argList, n ); /***** Create SpinBox decoration child *****/ n = 0; decoString = XmStringCreateLtoR("/", XmSTRING_DEFAULT_CHARSET); XtSetArg(argList[n], XmNlabelString, decoString); n++; spin6_deco2 = XmCreateLabel( spin6, "spin6_deco2", argList, n ); XmStringFree(decoString); /***** Create SpinBox child *****/ n = 0; XtSetArg(argList[n], XmNwidth, 30); n++; XtSetArg(argList[n], XmNposition, thisYY); n++; XtSetArg(argList[n], XmNmaximumValue, 99); n++; XtSetArg(argList[n], XmNspinBoxChildType, XmNUMERIC); n++; spin6_text3 = XmCreateTextField( spin6, "spin6_text3", argList, n ); /***** Manage SpinBox *****/ XtManageChild(spin6); /***** Call changedSpin6 AFTER displayed value has changed *****/ XtAddCallback(spin6, XmNvalueChangedCallback, changedSpin6, (XtPointer) 0); /***** Manage SpinBox children *****/ XtManageChild(spin6_text1); XtManageChild(spin6_deco1); XtManageChild(spin6_text2); XtManageChild(spin6_deco2); XtManageChild(spin6_text3); /***** End of SpinBox spin6 *****/ }