void Eval_NewSize( int width, int height ) { char old_width[10], old_height[10]; int flag; if ((width < 1) || (width > xrdb.maxIconWidth) || (height < 1) || (height > xrdb.maxIconHeight)) { sprintf(old_width, "%d", icon_width); XmTextFieldSetString(newWidthText, old_width); sprintf(old_height, "%d", icon_height); XmTextFieldSetString(newHeightText, old_height); DoErrorDialog(GETSTR(16,10,"Invalid width and/or\nheight specified")); } else { if (DialogFlag == NEW) flag = DO_NOT_SAVE; else flag = DO_SAVE; Backup_Icons(); /* for undo */ Init_Icons(width, height, flag); } }
void Process_Resize( void ) { int flag; char old_width[10], old_height[10]; static char *untitledStr = NULL; if ( DialogFlag == NEW ) { strcpy(undo_file, last_fname); last_fname[0] = '\0'; SavedOnce = False; Backup_Icons(); /* for undo */ flag = DO_NOT_SAVE; Init_Icons(icon_width, icon_height, flag); if (!untitledStr) untitledStr = GETSTR(2,20, "UNTITLED"); strcpy(last_fname, untitledStr); strcat(last_fname, ".m.pm"); last_fname[strlen(last_fname)] = '\0'; ChangeTitle(); Repaint_Exposed_Tablet(); Dirty = False; NewFlag = TRUE; } else{ sprintf(old_width, "%d", icon_width); XmTextFieldSetString(newWidthText, old_width); sprintf(old_height, "%d", icon_height); XmTextFieldSetString(newHeightText, old_height); XtManageChild(newIconDialog); XmProcessTraversal(newWidthText, XmTRAVERSE_CURRENT); XmTextFieldSetSelection(newWidthText, 0, 3, CurrentTime); } }
void ShowRateChangeDialog(struct rpar_object *rp,int focus) { Arg args[1]; char tempString[LINEMAX]; Widget focusTo; XmString XmTemp; char *insert; int insertlen; cur_rpar = rp; if(cur_rpar != NULL) { XmTemp=XmStringCreate("Change Rate Parameter",XmSTRING_DEFAULT_CHARSET); XtSetArg(args[0],XmNdialogTitle,XmTemp); XtSetValues(rate_dlg,args,1); if(cur_rpar->tag != NULL) XmTextFieldSetString(rate_tag,cur_rpar->tag); else XmTextFieldSetString(rate_tag,""); sprintf(tempString,"%f",cur_rpar->value); XmTextFieldSetString(rate_rate,tempString); switch(focus) { case 0: focusTo=rate_tag; break; default: focusTo=rate_rate; } } else { XmTemp=XmStringCreate("Create Rate Parameter",XmSTRING_DEFAULT_CHARSET); XtSetArg(args[0],XmNdialogTitle,XmTemp); XtSetValues(rate_dlg,args,1); XmTextFieldSetString(rate_tag,""); XmTextFieldSetString(rate_rate,""); focusTo = rate_tag; } XmStringFree(XmTemp); XtManageChild(rate_dlg); XmProcessTraversal(focusTo,XmTRAVERSE_CURRENT); insert=XmTextFieldGetString(focusTo); insertlen=strlen(insert); XmTextFieldSetSelection(focusTo,0,insertlen,XtLastTimestampProcessed(XtDisplay(focusTo))); XmTextFieldSetHighlight(focusTo,0,insertlen,XmHIGHLIGHT_SELECTED); XtFree(insert); }
static void _RGISEditPointSTNCoordsSelectCBK (Widget widget,Widget text,XmAnyCallbackStruct *callData) { static Widget select = NULL; char *field; DBObjectLIST<DBObjTableField> *fields; callData = callData; if (select == NULL) select = UISelectionCreate ((char *) "Field Selection"); XtVaGetValues (text,XmNuserData, &fields, NULL); if ((field = UISelectObject (select,(DBObjectLIST<DBObject> *) fields,DBTableFieldIsFloat)) != NULL) XmTextFieldSetString (text,field); else XmTextFieldSetString (text,(char *) ""); }
void init_vektor_interface(void) /*************************************************************************/ { char c_hilf[12]; b_init_vektor = TRUE; /* Flagge dass Fenster initialisiert */ if (g_animation.temp_on) XmToggleButtonSetState(widget_vektor.TB_temperatur, TRUE, FALSE); if (g_animation.spann_on) XmToggleButtonSetState(widget_vektor.TB_spannung, TRUE, FALSE); if (g_animation.stroem_on) XmToggleButtonSetState(widget_vektor.TB_stroemung, TRUE, FALSE); if (!XmToggleButtonGetState(widget_vektor.TB_spannung) && !XmToggleButtonGetState(widget_vektor.TB_stroemung)) { XtSetSensitive(widget_vektor.L_sp_faktor, FALSE); XtSetSensitive(widget_vektor.T_sp_faktor, FALSE); XtSetSensitive(widget_vektor.L_st_faktor, FALSE); XtSetSensitive(widget_vektor.T_st_faktor, FALSE); XtSetSensitive(widget_vektor.RC_animation, FALSE); } else { sprintf(c_hilf, "%8.3f", g_spannung.factor); XmTextFieldSetString(widget_vektor.T_sp_faktor, c_hilf); sprintf(c_hilf, "%8.3f", g_stroemung.factor); XmTextFieldSetString(widget_vektor.T_st_faktor, c_hilf); } if (g_loesung.gescannt) XtSetSensitive(widget_vektor.TB_temperatur, TRUE); else XtSetSensitive(widget_vektor.TB_temperatur, FALSE); if (g_spannung.vektor_gescannt) XtSetSensitive(widget_vektor.TB_spannung, TRUE); else XtSetSensitive(widget_vektor.TB_spannung, FALSE); if (g_stroemung.vektor_gescannt) XtSetSensitive(widget_vektor.TB_stroemung, TRUE); else XtSetSensitive(widget_vektor.TB_stroemung, FALSE); return; }
void UIAttribView::Draw (DBObjRecord *record) { DBObjTableField *field; DBObjectLIST<DBObjTableField> *fields; UIXYGraphShell *graphCLS; if (record == (DBObjRecord *) NULL) { Cardinal i, numChildren; WidgetList rowCols; UIAuxSetLabelString (ItemNameWGT,(char *) ""); XtVaGetValues (FieldsRowCol,XmNchildren, &rowCols, XmNnumChildren, &numChildren,NULL); for (i = 0;i < numChildren; ++i) XmTextFieldSetString (XtNameToWidget (rowCols [i],"UIAttribViewTextField"),(char *) ""); return; } UIAuxSetLabelString (ItemNameWGT,record->Name ()); switch (DataPTR->Type ()) { case DBTypeVectorPoint: case DBTypeVectorLine: case DBTypeVectorPolygon: case DBTypeGridDiscrete: fields = ItemTable->Fields (); for (field = fields->First ();field != (DBObjTableField *) NULL;field = fields->Next ()) if (DBTableFieldIsVisible (field) == true) DrawField (field->Name (),field->String (record)); break; case DBTypeGridContinuous: { DBCoordinate coord = *((DBCoordinate *) (record->Data ())); DBGridIF *gridIF = new DBGridIF (DataPTR); for (record = ItemTable->First ();record != (DBObjRecord *) NULL;record = ItemTable->Next ()) DrawField (record->Name (),gridIF->ValueString (record,coord)); delete gridIF; } break; case DBTypeNetwork: { DBObjTable *cellTable = DataPTR->Table (DBrNCells); DBObjTableField *basinFLD = cellTable->Field (DBrNBasin); DBObjRecord *basinRec; if ((basinRec = ItemTable->Item (basinFLD->Int (record) - 1)) == (DBObjRecord *) NULL) { CMmsgPrint (CMmsgAppError, "BasinID Error in:%s %d",__FILE__,__LINE__); return; } DrawField ((char *) "Basin Name",basinRec->Name ()); fields = ItemTable->Fields (); for (field = fields->First ();field != (DBObjTableField *) NULL;field = fields->Next ()) if (DBTableFieldIsVisible (field) == true) DrawField (field->Name (),field->String (basinRec)); fields = cellTable->Fields (); for (field = fields->First ();field != (DBObjTableField *) NULL;field = fields->Next ()) if (DBTableFieldIsVisible (field) == true) DrawField (field->Name (),field->String (record)); } break; default: break; } if ((graphCLS = (UIXYGraphShell *) DataPTR->Display (UIXYGraphShellStr)) != (UIXYGraphShell *) NULL) graphCLS->Configure (record); }
static void _UIDataHeaderButtonCBK(Widget widget, Widget text, XmAnyCallbackStruct *callData) { char *string; char *(*function)(void); XtVaGetValues(widget, XmNuserData, (int *) (&function), NULL); if ((string = (*function)()) != NULL) XmTextFieldSetString(text, string); }
static void CursorBlinkCallback ( Widget w, XtPointer clientData, XtPointer callData ) { OptionsDialogType *options = (OptionsDialogType *) clientData; XmRowColumnCallbackStruct *cb = (XmRowColumnCallbackStruct *) callData; char buffer[BUFSIZ]; char *c1; if (cb->widget == options->cursor.blink.on) { (void) XtSetSensitive(options->cursor.blinkRate.label, True); (void) XtSetSensitive(options->cursor.blinkRate.text, True); c1 = XmTextFieldGetString(options->cursor.blinkRate.text); if (atoi(c1) <= 0) { if (options->cursor.blinkRate.oldBlinkRate <= 0) { options->cursor.blinkRate.oldBlinkRate = 250; } (void) sprintf(buffer, "%d", options->cursor.blinkRate.oldBlinkRate); (void) XmTextFieldSetString(options->cursor.blinkRate.text, buffer); } } else { (void) XtSetSensitive(options->cursor.blinkRate.label, False); (void) XtSetSensitive(options->cursor.blinkRate.text, False); c1 = XmTextFieldGetString(options->cursor.blinkRate.text); options->cursor.blinkRate.oldBlinkRate = atoi(c1); } }
static void update_sources(Widget sources, Widget filter) { StatusDelay delay("Getting sources"); get_gdb_sources(all_sources); String pattern_s = XmTextFieldGetString(filter); string pattern = pattern_s; XtFree(pattern_s); strip_space(pattern); if (pattern.empty()) pattern = "*"; XmTextFieldSetString(filter, XMST(pattern.chars())); StringArray labels; uniquify(all_sources, labels); // Sort and remove duplicates sort(labels, all_sources); uniq(labels, all_sources); // Filter pattern filter_sources(labels, all_sources, pattern); // Now set the selection. bool *selected = new bool[labels.size()]; for (int i = 0; i < labels.size(); i++) selected[i] = false; setLabelList(sources, labels.values(), selected, labels.size(), false, false); delete[] selected; }
static void SciPlotDialogInternalPopup(PlotDialogData *info) { char *x,*y,*t; XtVaGetValues(info->plot, XtNplotTitle, &t, XtNxLabel, &x, XtNyLabel, &y, NULL); XmTextFieldSetString(info->title,t); XmTextFieldSetString(info->xlabel,x); XmTextFieldSetString(info->ylabel,y); XtManageChild(info->shell); }
/* ************************************************************* */ int next_zeit_cb() /* ************************************************************* */ { char c_zeit[10]; int eq = 0; g_animation.anim_frame = (g_animation.anim_frame) ? g_animation.anim_frame : 1; if (( eq = g_animation.akt_index % g_animation.anim_frame ) == 0) { lese_next_zeit(); glMatrixMode (GL_PROJECTION); glLoadIdentity (); C3D_updateref(); zeichne(); sprintf(c_zeit, "%8.3f", g_animation.zeiten[g_animation.akt_index]); XmTextFieldSetString(widgetMain.T_zeitschritt, c_zeit); return 1; } else { /* increase actual index frame */ if(g_animation.akt_index >= g_animation.anim_ende) g_animation.akt_index = g_animation.anim_anfang; else g_animation.akt_index++; return 0; } /* ************************************************************* */ }
static Boolean set_values(Widget old, Widget request, Widget new_w, ArgList args, Cardinal *num_args) { Boolean refresh = False; #ifdef DEBUG printf("NumEntry - set_values(%s) - >%s< >%s<\n", XtName(new_w), NumEntry_Value(old), NumEntry_Value(new_w)); #endif if (XtIsSensitive(old) != XtIsSensitive(new_w) && !XtIsSensitive(new_w)) { if (NumEntry_TimerId(new_w)) { XtRemoveTimeOut(NumEntry_TimerId(new_w)); NumEntry_TimerId(new_w) = (XtIntervalId)NULL; } } if (NumEntry_LabelString(old) != NumEntry_LabelString(new_w)) { NumEntry_LabelString(new_w) = XmStringCopy(NumEntry_LabelString(new_w)); XtVaSetValues(NumEntry_Label(new_w), XmNlabelString, NumEntry_LabelString(new_w), NULL); if (NumEntry_LabelString(old)) { XmStringFree(NumEntry_LabelString(old)); } } if (NumEntry_Value(old) != NumEntry_Value(new_w)) { char *tmp; Position Place; #ifdef DEBUG printf("NumEntry - set_values(%s) - value old >%s< new >%s<\n", XtName(new_w), NumEntry_Value(old), NumEntry_Value(new_w)); #endif tmp = NumEntry_Value(new_w); NumEntry_Value(new_w) = XtNewString(tmp); Place = XmTextFieldGetInsertionPosition(NumEntry_TextField(new_w)); XmTextFieldSetString(NumEntry_TextField(new_w), NumEntry_Value(new_w)); XmTextFieldSetInsertionPosition(NumEntry_TextField(new_w), Place); if (NumEntry_Value(old)) { XtFree(NumEntry_Value(old)); } refresh = True; DoMath(new_w); } if (NumEntry_Columns(old) != NumEntry_Columns(new_w)) { Dimension old_width = XtWidth(NumEntry_TextField(new_w)); XtVaSetValues(NumEntry_TextField(new_w), XmNcolumns, NumEntry_Columns(new_w), NULL); XtWidth(new_w) -= (old_width - XtWidth(NumEntry_TextField(new_w))); refresh = True; } return (refresh); }
/* * Function: _DtPrintSetMarginSpec * * margin -specifies the margin widget. * spec - specifies the string to be displayed in the GUI. * */ void _DtPrintSetMarginSpec( Widget margin, char *spec ) { if (margin) XmTextFieldSetString(margin, spec); }
static int setTextField (Widget textField, int value) { int newValue; char buf[128]; newValue = max (value, 0); newValue = min (value, 255); sprintf (buf, "%d", newValue); XmTextFieldSetString (textField, buf); }
void activate_callback(Widget w, XtPointer client_data, XtPointer call_data) { XmTextFieldSetString(field, "Hello"); if (!XtIsManaged(button1)) { XtManageChild(button1); } else { XtUnmanageChild(button1); } }
void UIAttribView::DrawField (char *fieldName,char *textSTR) { Widget label; label = XtNameToWidget (FieldsRowCol,fieldName); if (label != (Widget) NULL) { label = XtNameToWidget (label,"UIAttribViewTextField"); XmTextFieldSetString (label,textSTR); } }
void CEdit::xd_set_window_text(LPCSTR lpszString) { // Implements SetWindowText() for XmText and XmTextField. if (_xd_textwidget != NULL) { if (XmIsText(_xd_textwidget)) XmTextSetString(_xd_textwidget, (char *)lpszString); else if (XmIsTextField(_xd_textwidget)) XmTextFieldSetString(_xd_textwidget, (char *)lpszString); } }
void make_text_field(QSP_ARG_DECL Screen_Obj *sop) { #ifdef HAVE_MOTIF Arg al[5]; int ac = 0; int w; //fprintf(stderr,"make_text_field BEGIN\n"); sop->so_frame = generic_frame(curr_panel->po_panel_obj, sop, XmSHADOW_IN); XtSetArg(al[ac], XmNeditable, TRUE); ac++; XtSetArg(al[ac], XmNrecomputeSize, FALSE); ac++; /* used to use full width of panel */ //XtSetArg(al[ac], XmNwidth, PO_WIDTH(curr_panel)-30 ); ac++; /* Pick a width based on the length of the initial text - assume font width of 8 pixels? */ w = 10+strlen(sop->so_content_text)*8; //fprintf(stderr,"Using width of %d for string \"%s\"\n",w,sop->so_content_text); XtSetArg(al[ac], XmNwidth, w ); ac++; // Do we need to set the height explicitly??? XtSetArg(al[ac], XmNheight, 32 ); ac++; XtSetArg(al[ac], XmNmaxLength, 40 ); ac++; // This generates a lot of warnings, not correct usage? //XtSetArg(al[ac], XmNvalue, (char *)sop->so_content_text ); ac++; sop->so_obj = XmCreateTextField(sop->so_frame, (char *)sop->so_name, al, ac); // The callback is called when we set the default value // if this is called after the callback is assigned. // So we set the value BEFORE assigning the callback... XmTextFieldSetString(sop->so_obj, (char *)sop->so_content_text ); //fprintf(stderr,"make_text_field: obj = 0x%lx\n",(long)sop->so_obj); //fprintf(stderr,"make_text_field: adding text_func callback for value changed\n"); XtAddCallback(sop->so_obj, XmNvalueChangedCallback, text_func, NULL); XtAddCallback(sop->so_obj, XmNlosingFocusCallback, text_func2, NULL); // the callback seems to be called right away? // Why? // This was commented out, but in that case the widget does not appear!? XtManageChild(sop->so_obj); // The callback is called when we set the default value // Let's try setting the value BEFORE assigning the callback... //XmTextFieldSetString(sop->so_obj, (char *)sop->so_content_text ); #endif /* HAVE_MOTIF */ }
void UIAuxObjectSelectCBK(Widget widget, Widget text, XmAnyCallbackStruct *callData) { static Widget select = NULL; char *objName; int (*condFunc)(const DBObject *); DBObjectLIST<DBObject> *objects; if (select == NULL) select = UISelectionCreate((char *) "Object Selection"); XtVaGetValues(text, XmNuserData, &objects, NULL); XtVaGetValues(widget, XmNuserData, &condFunc, NULL); if ((objName = UISelectObject(select, objects, condFunc)) != NULL) XmTextFieldSetString(text, objName); }
/****************************************************** audioSetupNewFilename ******************************************************/ static int audioSetupNewFilename(Widget widget, char *string) { char* filename; int filenameSize; char* plast; unsigned char* pdata; struct audioinfo* poldAudioInfoFile; struct audioinfo* paudioInfo; unsigned long length; filename = string; /* remove leading white space */ while (isspace(*filename)) { filename++; continue; } /* remove trailing white space */ plast=filename + strlen(filename)-1; while (isspace(*plast)) { *plast=0; plast--; } filenameSize = strlen(filename); if (!filenameSize) return 0; if (filename[filenameSize-1]=='/'||filename[filenameSize-1]=='\\') return 0; XmTextFieldSetString(widget,filename); pdata = readAudioData(filename,&length); if (!pdata){ return -1; } paudioInfo = createAudioInfo(filename,pdata,length); if (!paudioInfo){ return -1; } poldAudioInfoFile = audioSetup.paudioInfoFile; audioSetup.paudioInfoFile = paudioInfo; if (audioSetup.audioSource==AUDIO_SOURCE_FILE) { audioSetup.paudioInfo = paudioInfo; } if (poldAudioInfoFile){ if (poldAudioInfoFile->filename) free(poldAudioInfoFile->filename); if (poldAudioInfoFile->pdata) free(poldAudioInfoFile->pdata); free(poldAudioInfoFile); } return 0; }
static void _RGISARCInfoImportFieldSelectCBK (Widget widget,Widget text,XmAnyCallbackStruct *callData) { static Widget select = NULL; char *field; int (*condFunc) (const DBObject *); if (select == NULL) select = UISelectionCreate ((char *) "ARC/Info Fields"); XtVaGetValues (widget,XmNuserData, &condFunc, NULL); if ((field = UISelectObject (select,(DBObjectLIST<DBObject> *) (_RGISARCTempTable->Fields ()),condFunc)) != NULL) XmTextFieldSetString (text,field); }
static void _RGIAnalyseLineSSampleGridSSelectCBK (Widget widget,Widget text,XmAnyCallbackStruct *callData) { static Widget select = NULL; char *field; int (*condFunc) (const DBObject *); if (select == NULL) select = UISelectionCreate ((char *) "Field Selection"); XtVaGetValues (widget,XmNuserData, &condFunc, NULL); if ((field = UISelectObject (select,(DBObjectLIST<DBObject> *) (_RGISAnLineSampleGridFields),condFunc)) != NULL) XmTextFieldSetString (text,field); }
static void _UISymbolLoadNamesCBK (Widget widget,Widget list,XmAnyCallbackStruct *callData) { int symbol, symNum, i, color, *selectPos, selectCount; FILE *file; char *fileName, buffer [1024], *token, delimit [3]; static Widget select = NULL; UISymbol**editSymbols; XmString xmString [1]; widget = widget; callData = callData; if (select == NULL) select = UIFileSelectionCreate ((char *) "Symbol Name file Selection",NULL,(char *) "*.txt",XmFILE_REGULAR); XtVaGetValues (list,XmNuserData, &editSymbols, NULL); XtVaGetValues (list,XmNitemCount, &symNum, NULL); if ((fileName = UIFileSelection (select,true)) == NULL) return; if ((file = fopen (fileName,"r")) == NULL) { CMmsgPrint (CMmsgSysError, "File Openning Error in: %s %d",__FILE__,__LINE__); return; } sprintf (delimit,"%c%c",DBASCIISeparator,'\0'); while (fgets (buffer,sizeof (buffer),file) != NULL) { token = strtok (buffer,delimit); sscanf (token,"%d",&symbol); for (i = 0;i < symNum; ++i) if (editSymbols [i]->SymbolID () == symbol) { if ((token = strtok ((char *) NULL,delimit)) != (char *) NULL) { if (token [0] == '\"' || token [0] == '\'') {token [strlen (token) - 1] = '\0'; token++; } editSymbols [i]->Name (token); } if ((token = strtok ((char *) NULL,delimit)) != (char *) NULL) if (sscanf (token,"%d",&color) == 1) editSymbols [i]->Foreground (color); if ((token = strtok ((char *) NULL,delimit)) != (char *) NULL) if (sscanf (token,"%d",&color) == 1) editSymbols [i]->Background (color); xmString [0] = XmStringCreate (editSymbols [i]->Name (),UICharSetNormal); XmListReplaceItemsPos (list,xmString,1,i + 1); XmStringFree (xmString [0]); break; } } if (XmListGetSelectedPos (list,&selectPos,&selectCount)) { XmTextFieldSetString (XtNameToWidget (XtParent (XtParent (XtParent (list))),UISymTextFieldName),editSymbols [selectPos [0]]->Name ()); XtFree ((char *) selectPos); } }
static void clear_statusline(void) { if ((resource.expert_mode & XPRT_SHOW_STATUSLINE) != 0) { # ifdef MOTIF XmTextFieldSetString(statusline, " "); # else XtVaSetValues(statusline, XtNlabel, " ", NULL); # endif XFlush(DISP); } strcpy(g_string_savebuf, " "); }
static void _RGISARCInfoImportFileSelectCBK (Widget widget,Widget coverText,XmAnyCallbackStruct *callData) { static Widget fileSelect = NULL; char *infoFile; if (fileSelect == NULL) fileSelect = UIFileSelectionCreate ((char *) "ARC/Info Coverage",NULL,(char *) "*",XmFILE_DIRECTORY); if ((infoFile = UIFileSelection (fileSelect,true)) != NULL) { if (_RGISARCTempTable != (DBObjTable *) NULL) delete _RGISARCTempTable; _RGISARCTempTable = new DBObjTable ((char *) "ARCImp Temporary Table"); if (DBInfoGetFields (_RGISARCTempTable,DBInfoFileName (infoFile,_RGISARCDataType)) == DBFault) { UIMessage ((char *) "Missing Attribute Table"); delete _RGISARCTempTable; _RGISARCTempTable = ( DBObjTable *) NULL; return; } XmTextFieldSetString (coverText,infoFile); } else { XmTextFieldSetString (coverText,(char *) ""); if (_RGISARCTempTable != NULL) { delete _RGISARCTempTable; _RGISARCTempTable = NULL; } } }
static void handle_input(XtPointer client_data, int *source, XtInputId *id) { if (gps_poll(gpsdata) < 0) { XtRemoveInput(gps_input); (void)gps_close(gpsdata); XtRemoveTimeOut(timeout); XmTextFieldSetString(text_10, "No GPS data available"); (void)err_dialog(toplevel, "No GPS data available.\n\n" "Check the connection to gpsd and if gpsd is running"); gps_lost = true; gps_timeout = XtAppAddTimeOut(app, 3000, handle_gps, app); } }
static void initialize(Widget request, Widget new_w, ArgList args, Cardinal *num_args) { #ifdef DEBUG printf("%s:initialize(%d) - %s %ix%i\n", __FILE__, __LINE__, XtName(new_w), XtWidth(new_w), XtHeight(new_w)); #endif FilePicker_Label(new_w) = XmCreateLabel(new_w, XtName(new_w), args, *num_args); FilePicker_TextField(new_w) = XmCreateTextField(new_w, "TextField", args, *num_args); FilePicker_Button(new_w) = XltCreateBubbleButton(new_w, "Browse", args, *num_args); if (XtHeight(new_w) == 0) { XtHeight(new_w) = XtHeight(FilePicker_Label(new_w)) > XtHeight(FilePicker_TextField(new_w)) ? XtHeight(FilePicker_Label(new_w)) : XtHeight(FilePicker_TextField(new_w)); XtHeight(new_w) = XtHeight(new_w) > XtHeight(FilePicker_Button(new_w)) ? XtHeight(new_w) : XtHeight(FilePicker_Button(new_w)); } XtVaSetValues(FilePicker_Label(new_w), XmNalignment, XmALIGNMENT_BEGINNING, XmNtopAttachment, XmATTACH_FORM, XmNleftAttachment, XmATTACH_FORM, XmNrightAttachment, XmATTACH_WIDGET, XmNrightWidget, FilePicker_TextField(new_w), XmNbottomAttachment, XmATTACH_FORM, NULL); XtVaSetValues(FilePicker_Button(new_w), XmNtopAttachment, XmATTACH_FORM, XmNtopOffset, (int)((XtHeight(new_w) - XtHeight(FilePicker_Button(new_w))) / 2), XmNrightAttachment, XmATTACH_FORM, NULL); XtVaSetValues(FilePicker_TextField(new_w), XmNtopAttachment, XmATTACH_FORM, XmNtopOffset, (int)((XtHeight(new_w) - XtHeight(FilePicker_TextField(new_w))) / 2), XmNrightAttachment, XmATTACH_WIDGET, XmNrightWidget, FilePicker_Button(new_w), NULL); if (FilePicker_Value(new_w)) { XmTextFieldSetString(FilePicker_TextField(new_w), FilePicker_Value(new_w)); XmTextFieldSetInsertionPosition(FilePicker_TextField(new_w), XmTextFieldGetLastPosition(FilePicker_TextField(new_w))); } XtManageChild(FilePicker_Label(new_w)); XtManageChild(FilePicker_Button(new_w)); XtManageChild(FilePicker_TextField(new_w)); XtAddCallback(FilePicker_Button(new_w), XmNactivateCallback, (XtCallbackProc)BrowseCallback, NULL); /* XtAddCallback(new_w, XmNhelpCallback, (XtCallbackProc)Help, NULL); */ }
void FindDialog::clearCallback(Widget /*button*/, XtPointer closure, XtPointer /*call_data*/) { FindDialog *findData = (FindDialog *)closure; register unsigned int offset; for (offset = 0; offset < findData->_num_text_fields; offset++) { if (findData->_text_fields[offset] != NULL) { XmTextFieldSetString(findData->_text_fields[offset], ""); } } return; }
static Boolean set_values(Widget old, Widget request, Widget new_w, ArgList args, Cardinal *num_args) { Boolean refresh = False; #ifdef DEBUG printf("%s:set_values(%d) - %s\n", __FILE__,__LINE__, XtName(new_w)); #endif if (FilePicker_Value(new_w) != FilePicker_Value(old)) { XmTextFieldSetString(FilePicker_TextField(new_w), FilePicker_Value(new_w)); XmTextFieldSetInsertionPosition(FilePicker_TextField(new_w), XmTextFieldGetLastPosition(FilePicker_TextField(new_w))); } return (refresh); }
/**************************************** widget_cb ***************************************** Purpose: To process user interactions from the widgets used in the detail view. ****************************************/ void widget_cb (Widget w, XtPointer client_data, XtPointer call_data) { XmDrawingAreaCallbackStruct *cb; XButtonEvent *event; /* event */ int ndx; /* index into accts table */ static int old_time = -1; /* time of previous event */ cb = (XmDrawingAreaCallbackStruct *) call_data; event = (XButtonEvent *) cb->event; ndx = (int) client_data; /* only process on button-up */ if ((cb->reason == XmCR_INPUT) && (event->type == ButtonRelease)) { /* button 1 is used for selection; on double-click send message to */ /* custinfo */ if (event->button == Button1 || event->button == Button2) { toggle_selection (ndx); if (event->time < old_time + DOUBLE_CLICK_TIME) { send_account (&outbuf, &inbuf, accts[ndx].account_no, child); sprintf (buf, "Sending account <%s> to CustInfo", accts[ndx].external_id); XmTextFieldSetString(orgview_status, buf); } old_time = event->time; /* save time of event */ } /* button 3 is used to display more information about the account */ /* in a popup */ else if (event->button == Button3) display_selected_account (ndx); } else /* simple refresh */ if (XtWindow (accts[ndx].bb)) /* widget has been initialized */ { if (selected_acct == ndx) /* need to recolor background */ XtVaSetValues (accts[ndx].bb, XmNbackground, highlight, NULL); draw_widget_text (ndx, ndx == selected_acct); /* refresh the text */ } }