Plateforme Level Extreme
Abonnement
Profil corporatif
Produits & Services
Support
Légal
English
Alternative to GetFile() that allows multiselect?
Message
De
09/12/2013 08:18:58
 
 
À
04/12/2013 15:57:06
Information générale
Forum:
Visual FoxPro
Catégorie:
Codage, syntaxe et commandes
Versions des environnements
Visual FoxPro:
VFP 9 SP2
OS:
Windows 7
Network:
Windows 2008 Server
Database:
Visual FoxPro
Application:
Desktop
Divers
Thread ID:
01589308
Message ID:
01589549
Vues:
70
>Hi all,
>
>Is there an alternative to GetFile() where the user can multi-select a bunc h of files? In some old code I used comdlg32.ocx - and it is working (on the same PC no less) but cannot get the code to work on the new machine.
>
>First - if you have an alternative, that would be great.
>
>Secondly, if you don't, anyone have a clue why this code is failing me when placed into a new project?
>
>I get the error "class definition OLECOMMONDIALOGS is not found". I thought it was supposed to be in ComDlg32.ocx - maybe I am even wrong on this?
>
>>>>>>>>>>>>>>>>>>>>>>>>>
>
>WITH THISFORM
>
>* if no .ioGetFilesDialog property yet, need to create one; I tried to do this via defining a form property
>* .ioGetFilesDialog and then using CREATEOBJECT() to fill it with an object but this does not work with OLE controls
>* - they have to be dropped on the form during design time or added via .AddObject() at run time
>
>IF NOT PEMSTATUS(THISFORM,"ioGetFilesDialog",5)
> .NewObject("ioGetFilesDialog","oleCommonDialogs")
>ENDIF
>
>WITH .ioGetFilesDialog
>
>* override the dialog title
>STORE "Select files to to process" TO .DialogTitle
>
>* set the default directory to the current directory
>STORE SYS(5) + CURDIR() TO .InitDir
>
>* fire the getfiles dialog
>.GetFiles()
>
>* if user picked any files, process them; if no files, just return as we will not alert them if they choose Cancel
>IF .inFileCount = 0
> RETURN
>ENDIF


As one maybe harder but perhaps more rewarding option, you could build your won file picker dialog form on your own.
(using simple modal form)

At first you let user select folder, then you read all the files and offer them in a form of picklist (they love to tick/untick!). If you need it, It can contain also files from whole folder structure. With some nice design you can make it to come very close to native windows dialogs, whereas by building it
you will gain full control over the whole process. (filtering, selection validation etc).
See XDIR here in downloads, it is class that can help with these kind of tasks, but you can relatively simple build your own using some sort of recursive function/procs built around native ADIR(). No OCX needed and will work the same regardless of the windows version.

HTH
Sergio
*****************
Srdjan Djordjevic
Limassol, Cyprus

Free Reporting Framework for VFP9 ;
www.Report-Sculptor.Com
Précédent
Suivant
Répondre
Fil
Voir

Click here to load this message in the networking platform