October 30, 2025, 04:24:48 PM

News:

Own IWBasic 2.x ? -----> Get your free upgrade to 3.x now.........


Filerequest dialog

Started by Brian, September 27, 2013, 01:02:42 PM

Previous topic - Next topic

0 Members and 1 Guest are viewing this topic.

Brian

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!

LarryMc

Is this what you are wanting it to look like?
LarryMc
Larry McCaughn :)
Author of IWB+, Custom Button Designer library, Custom Chart Designer library, Snippet Manager, IWGrid control library, LM_Image control library

Brian

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

Brian

September 28, 2013, 02:48:18 AM #3 Last Edit: September 28, 2013, 04:01:47 AM by Brian Pugh
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

Brian

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

LarryMc

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.
LarryMc
Larry McCaughn :)
Author of IWB+, Custom Button Designer library, Custom Chart Designer library, Snippet Manager, IWGrid control library, LM_Image control library

Brian

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

LarryMc

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)
LarryMc
Larry McCaughn :)
Author of IWB+, Custom Button Designer library, Custom Chart Designer library, Snippet Manager, IWGrid control library, LM_Image control library