boote@bierstadt.scd.ucar.edu (Jeff W. Boote) (01/26/91)
>I'm sure this is an easy question for everyone but I haven't been able >to figure it out yet. How do you get the filename that the user picks >or types from a FileSelectionDialog? For instance, after the user clicks >on the "OK" button, I want to retrieve the name that was chosen. In your XmNokCallback routine the call_data parameter returns a pointer to the XmFileSelectionBoxCallbackStruct and the "value" member of this structure is the filename. This is how I normally do this. void send_fselectokCB(w, client_data, sboxstruct) Widget w; caddr_t client_data; XmFileSelectionBoxCallbackStruct *sboxstruct; { char *string; XtUnmanageChild(fileselect); XtRemoveGrab(fileselect); string = extractstring(sboxstruct->value); free(string); } where extractstring is: char *extractstring(str) XmString str; { XmStringContext context; XmStringCharSet charset; XmStringDirection direction; Boolean separator; static char *xm_string; XmStringInitContext (&context, str); XmStringGetNextSegment (context, &xm_string, &charset, &direction, &separator); XmStringFreeContext (context); return ((char *) xm_string); } -- Jeff W. Boote SCD/NCAR boote@ncar.ucar.edu Boulder, Colo