/******************************************************************************* SelectInstrument.c *******************************************************************************/ #include #include "UxLib.h" #include "UxSelBox.h" /******************************************************************************* Includes, Defines, and Global variables from the Declarations Editor: *******************************************************************************/ #include char *osmmget(); /******************************************************************************* The definition of the context structure: If you create multiple instances of your interface, the context structure ensures that your callbacks use the variables for the correct instance. For each swidget in the interface, each argument to the Interface function, and each variable in the Instance Specific section of the Declarations Editor, there is an entry in the context structure. and a #define. The #define makes the variable name refer to the corresponding entry in the context structure. *******************************************************************************/ typedef struct { swidget UxSelectInstrument; } _UxCSelectInstrument; #define SelectInstrument UxSelectInstrumentContext->UxSelectInstrument static _UxCSelectInstrument *UxSelectInstrumentContext; /******************************************************************************* Forward declarations of functions that are defined later in this file. *******************************************************************************/ swidget create_SelectInstrument(); /******************************************************************************* The following are callback functions. *******************************************************************************/ static void okCallback_SelectInstrument( UxWidget, UxClientData, UxCallbackArg ) Widget UxWidget; XtPointer UxClientData, UxCallbackArg; { _UxCSelectInstrument *UxSaveCtx, *UxContext; swidget UxThisWidget; UxThisWidget = UxWidgetToSwidget( UxWidget ); UxSaveCtx = UxSelectInstrumentContext; UxSelectInstrumentContext = UxContext = (_UxCSelectInstrument *) UxGetContext( UxThisWidget ); { char *value; char title[30],descr[257]; extern swidget ilist; extern int tidost,doI; int uni,null,actval,index; XmSelectionBoxCallbackStruct *cbs; cbs = (XmSelectionBoxCallbackStruct *)UxCallbackArg; XmStringGetLtoR(cbs->value,XmSTRING_DEFAULT_CHARSET,&value); if ( doI) { UxPutText(UxFindSwidget("clas_t1"),value); oscfill(descr,257,'\0'); SCDRDC(tidost,value,1,1,256,&actval,descr,&uni,&null); index = strbskip(descr,' '); descr[index+1] = '\0'; UxPutText(UxFindSwidget("clas_t1"),value); UxPutText(UxFindSwidget("criteria"),descr); redecomp(descr); } else { UxPutText(UxFindSwidget("text3"),value); UxPopdownInterface(ilist); } } UxSelectInstrumentContext = UxSaveCtx; } static void createCB_SelectInstrument( UxWidget, UxClientData, UxCallbackArg ) Widget UxWidget; XtPointer UxClientData, UxCallbackArg; { _UxCSelectInstrument *UxSaveCtx, *UxContext; swidget UxThisWidget; UxThisWidget = UxWidgetToSwidget( UxWidget ); UxSaveCtx = UxSelectInstrumentContext; UxSelectInstrumentContext = UxContext = (_UxCSelectInstrument *) UxGetContext( UxThisWidget ); { XmString *str; int item_no,i ; item_no = 2; /*str = (XmString *)XtMalloc(item_no * sizeof(XmString)); for (i=0; i