IonicWind Software

IWBasic => General Questions => Topic started by: Brian on September 27, 2013, 01:02:42 PM

Title: Filerequest dialog
Post by: Brian on September 27, 2013, 01:02:42 PM
Hi,

Does anyone have working code for the FILEREQUEST dialog, or a modification of it, that will allow me to see a thumbnail
of the image before I click open? I assume it will need a callback of some kind (not my forte!)

I want to be able to see a thumbnail of my images as I click though the files, and then select the one I require

Any ideas?

Brian

PS: I have seen some code of Sapero's, but it was way beyond me!
Title: Re: Filerequest dialog
Post by: LarryMc on September 27, 2013, 01:42:10 PM
Is this what you are wanting it to look like?
Title: Re: Filerequest dialog
Post by: Brian on September 27, 2013, 04:34:18 PM
Larry,

Anything like that will do - just so the user can see what's going on. I want to use
it to load pics into your IWGrid. Got it working kind of using hard-coded paths

Brian
Title: Re: Filerequest dialog
Post by: Brian on September 28, 2013, 02:48:18 AM
Larry,

Got Sapero's code working somewhat, but the Dialog says "Save As" where I want it to be "Open File"

Also, can't get it to change the directory from the GETSTARTPATH, as in GETSTARTPATH+"My Folder"
I would like it to open a folder of my choice without the user having to click to get there

Brian

Edit: Fixed the Save As - now shows Open File
Title: Re: Filerequest dialog
Post by: Brian on September 28, 2013, 05:40:19 AM
OK, worked it out. You can change the line szPath=GETSTARTPATH+"My Folder\*.jpg"
and it will open the folder required

Only thing I don't get is what variable/parameter holds the filename that you click open
on, and how it is returned

Any ideas?

Brian
Title: Re: Filerequest dialog
Post by: LarryMc on September 28, 2013, 07:16:28 AM
Here's the code for a subroutine that I use set up as a demo.

You can use the FILEREQUEST section of the help file to see how to use it.
Title: Re: Filerequest dialog
Post by: Brian on September 28, 2013, 08:29:37 AM
Thanks, Larry. That's a lot of code for what I want to do! I only need to see and then
open an image, but I am sure it will work a lot better than anything I could cobble up

Brian
Title: Re: Filerequest dialog
Post by: LarryMc on September 28, 2013, 12:13:15 PM
My post above will work for both load and save and on all the versions of windows.

It you want to use yours then you'll need something like this to get the path of the selected file

g_hook=_SetWindowsHookEx(WH_CBT,&OfnCbtProc,0,_GetCurrentThreadID())
'get the file
if _GetOpenFileName(ofn)
pointer ptr
ptr =ofn.lpstrFile
?#<string>ptr
else

endif
'uninstall the hook
_UnhookWindowsHookEx(g_hook)