[comp.windows.x.motif] FSB woes

david@lta.com (David B. Lewis) (11/01/90)

>From: krupczak@secola.Columbia.NCR.COM (Bobby Krupczak)
>Subject: Setting Directory in FileSelectionBox widget
>
>I am trying to use the FileSelectionBox Widget.  I am unable to figure out how
>to set the directory for file searching.  I have tried (in my OK callback)
>setting the XmNdirSpec resource using XtSetValues and then calling 
>XmFileSelectionDoFileSearch().
>
>My problem is that despite setting the XmNdirSpec resource, the file
>selection widget still uses the initial setting of XmNdirSpec.  I have
>read the man page on XmFileSelectionBox and it indicates that XtSetValues()
>should work for this resource.

In fact, it does work; if you do a GetValues immediately, you should see that
the value has changed. But that's not enough...

What you are trying to do fails because the internal default procedure
for XmNfileSearchProc blows away the value of XmNdirSpec and replaces it
with either NULL or the name of the current directory, neither of which
is useful if you have a specific file in mind to provide as the current
selection. This happens whether you hit the Filter button or whether you call 
XmFileSelectionDoFileSearch().  It also happens that the procedure doesn't 
handle an XmNdirSpec passed into as part of the XmFileSelectionCallbackStruct; 
the value is ignored in any case in preference for the current text string.

Compounding the latter problem are the incorrect instructions in the Prentice-
Hall Reference Manual regarding XmNfileSearchProc; probably compounding
the problem is that the resource is really more like an XmNfileSpec and
specifies a full file.

To get to the good stuff:

I've coincidentally just fixed the File Selection Box so that these problems 
are gone and so that XmNdirSpec can be set; in addition, the FSB now 
highlights properly on new items and clears out incorrect hightlighting. 
It also behaves properly when passed an XmNdirMask which is a complete file
specification (returns it as a match).

I don't see a way around the problem if you are a binary customer.

These patches haven't been fully tested yet (and problems remain with
the FileSelectionBox fudging memory in clearing out the internal List widget 
that have to be handled) but should wind up eventually in their final versions 
on the motif-archive server and available to source licensees. 

[These comments apply to the 1.0[.3] FSB; the 1.1 is sufficiently different 
that patches won't work.]

David B. Lewis  			Lewis, Trachtenberg & Associates (LTA)
					+1 617 225 0366
Note new address!:	david@lta.com 			(Real Soon Now)
			david@lta.UUCP			(Right Now)
			david%lta.uucp@uunet.uu.net	(Works for Now)