Using a FileListBox to Display a File Mask
Keywords: filelistbox itembox display file mask
Question:
Following Dialog Editor code shows all files instead of just "*.Csv". How do you get FileListBox to default to just the files returned by FileItemize?Changed = Dirchange("\\Pltxbdc01\Software\Utilities\Scripting\Delete Users\Logs") intcontrol(4,0,0,0,0) GivenDir=FileItemize("\\Pltxbdc01\Software\Utilities\Scripting\Delete Users\Logs\*.Csv") DeleteUserDialogFormat=`WWWDLGED,5.0` DeleteUserDialogCaption=`Choose an Output file` DeleteUserDialogX=109 DeleteUserDialogY=82 DeleteUserDialogWidth=204 DeleteUserDialogHeight=208 DeleteUserDialogNumControls=6 DeleteUserDialog01=`3,24,64,DEFAULT,EDITBOX,GivenDir,""` DeleteUserDialog02=`3,41,128,131,FILELISTBOX,GivenDir,DEFAULT` DeleteUserDialog03=`3,8,198,DEFAULT,VARYTEXT,GivenDir,"*.Csv"` DeleteUserDialog04=`72,25,116,DEFAULT,CHECKBOX,Report,"Report Only (Will not actually delete anything)",1` DeleteUserDialog05=`3,184,64,DEFAULT,PUSHBUTTON,DEFAULT,"&Ok",1` DeleteUserDialog06=`73,184,64,DEFAULT,PUSHBUTTON,DEFAULT,"&Cancel",0` ButtonPushed=Dialog("DeleteUserDialog")Answer:
hm. I don't think the FileListBox works that way (unfortunately). You could do it this way by using an ItemBox instead of the FileListBox:ReportFile = '*.csv' ChkFile = ReportFile givendir=FileItemize("c:\temp\*.csv") DeleteUserDialogFormat=`WWWDLGED,5.0` DeleteUserDialogCaption=`Choose an Output file` DeleteUserDialogX=109 DeleteUserDialogY=82 DeleteUserDialogWidth=204 DeleteUserDialogHeight=208 DeleteUserDialogNumControls=6 DeleteUserDialog01=`3,24,64,DEFAULT,EDITBOX,ReportFile,""` ; DeleteUserDialog02=`3,41,128,131,FILELISTBOX,GivenDir,DEFAULT` DeleteUserDialog02=`3,41,128,131,ITEMBOX,GivenDir,DEFAULT` DeleteUserDialog03=`3,8,198,DEFAULT,VARYTEXT,GivenDir,"*.Csv"` DeleteUserDialog04=`72,25,116,DEFAULT,CHECKBOX,Report,"Report Only (Will not actually delete anything)",1` DeleteUserDialog05=`3,184,64,DEFAULT,PUSHBUTTON,DEFAULT,"&Ok",1` DeleteUserDialog06=`73,184,64,DEFAULT,PUSHBUTTON,DEFAULT,"&Cancel",0` ButtonPushed=Dialog("DeleteUserDialog") message(ReportFile, GivenDir)
Article ID: W14837