Submitted by Anonymous on Thu, 04/03/2003 - 18:51.
Hi,
I develop IRIX applications, and there`s an issue which has been for *years* in my to-do list
"Implementing auto-updating to FileSelectionBoxes, so that if some file is created or deleted in the current directory, the dialog box contents are updated".
I`m aware of the FAM daemon (file alteration monitor), although never used it in my apps. Also, I think the XmFileSelectionDoSearch function is not guaranteed to update the dialog if the current directory is the same.
Anybody tried/achieved this? This is standard in MS-Windows, so I hope somebody already did it on Unix/Linux.
Mon, 04/07/2003 - 19:27#1
ICS_support
Updating a FileSelectionBox
You could set a timer to check the (cached) last-touched date on the directory itself. You can then force a change by passing in NULL data and then the real directory; or recreate the widget. Both of these are really overkill. Are you sure that the DoSearch function doesn`t work?
Wed, 04/09/2003 - 21:57#2
Anonymous
Updating a FileSelectionBox
Thanks a lot for your comments!!! Btw, I just tested that XmFileSelectionDoSearch() does work. I don`t remember why I said it didn`t.
The code I`m using for updating a FileSelectionBox is as follows (I first get the dialog`s current directory, because if I pass NULL to the DoSearch function, the *application* current directory would be used instead, which would be very annoying to the user).
It works, although I`m not sure if it`s "perfect"
Arg argarray[100];
int n;
XmString dir;
n=0;
XtSetArg(argarray[n],XmNdirectory,&dir);
n++;
XtGetValues(w,argarray,n);
XmFileSelectionDoSearch(w,dir);
XmStringFree(dir);