[Search for users] [Overall Top Noters] [List of all Conferences] [Download this site]

Conference bulova::decw_jan-89_to_nov-90

Title:DECWINDOWS 26-JAN-89 to 29-NOV-90
Notice:See 1639.0 for VMS V5.3 kit; 2043.0 for 5.4 IFT kit
Moderator:STAR::VATNE
Created:Mon Oct 30 1989
Last Modified:Mon Dec 31 1990
Last Successful Update:Fri Jun 06 1997
Number of topics:3726
Total number of notes:19516

416.0. "File Selection Widget Questions" by RABBET::FARRELL (Money, there is no substitute!) Thu Mar 16 1989 09:53

A couple of questions on the file selection widget using UIL.


	1) When I get the return value of the selected file passed back to
	   my C program, the filename is in the string, but it has garbage
	   in the front of the string and the ->value_len parameter seems to
	   be consistently 21 higher than it should.

	   For example, if I select nothing at all and press OK, I get returned
	   a string full of garbage, and the ->value_len is 21.  If I select
	   a valid file and press return, I get a string ->value of the 
	   correct filename, but there is garbage in the string and the 
	   ->value_len is 21 higher then the length of the filename.

	   What is the deal?

	2) When the file selection widget comes up, the listing area is wide
	   enough to fit the entire filenames, but only the end of the file
	   names appear in the shown area (the rest are off to the left).  This
	   leaves a large margin in the right side of the shown area.
	  
	   I can understand this happening if the filename is too large, but
	   the filename can easily fit, it is just being put in the wrong place.

	   What can I do?

Thanks in advance,

		$$$$ ted $$$$

T.RTitleUserPersonal
Name
DateLines
416.1It's a Compound StringTBD1::BURLEIGHDave, DECwindows TrainingThu Mar 16 1989 10:0327
    The File Selection widget returns the file name in a
    Compound String, not a simple string. The following code will
    extract it (assuming it really *is* a simple string in disguise):
       
    static XtCallbackProc FileSelectionActivated(widget,tag,reason)
       Widget widget;
       caddr_t tag;
       DwtFileSelectionCallbackStruct *reason;
    {
       char *filename;
       DwtCompStringContext context;
    
       /* Extract the filename from the compound string */
    
       if (DwtInitGetSegment(&context,reason->value) == DwtSuccess) {
          int n,charset,direction,language,rendition;
    
          DwtGetNextSegment(&context,&filename,
                            &charset,&direction,&language,&rendition);
          if (filename && (n = strlen(filename))) {
             /* do something with the filename */
          }
       }
    }
    
    Dave