Level Extreme platform
Subscription
Corporate profile
Products & Services
Support
Legal
Français
Better getpict()
Message
 
To
07/02/2020 06:05:51
Dragan Nedeljkovich (Online)
Now officially retired
Zrenjanin, Serbia
General information
Forum:
Visual FoxPro
Category:
Pictures and Image processing
Miscellaneous
Thread ID:
01672915
Message ID:
01672977
Views:
55
>I decided to use the common dialog, as it seems to be a wrapper for the current system dialog, so it looks the way such dialogs look elsewhere in the current edition of the windows. Now the preview window is there (not by default, but I guess that's my setting that I changed long ago, reverted to on) but it doesn't show any images except bmp... But okay, perhaps its just my minimal instance of W7 where I do this, maybe it will work elsewhere.

FoxPro's GetFile() (but not GetPict()) uses the standard Common Dialogs.

>Since this is just a VM windows (the host system is Kubuntu), it's case blind and I'm copying the selected images into a private subfolder, building a repository), I can live with that. Though I do hate what Fox does with filename cases - I'd almost instantiate a filesystem object just to get the properly cased path of a file, if it mattered.

Yeah Windows is case blind too but the problem is that if you end up creating new files you then can't capture the case that they user typed. Or when you move files, you can't capture the original file's case. It still works, just is ugly to use all upper (returned from File functions) or force all lower (a little bit nicer).

This is why I have a bunch of Helper Functions in my tools that use .NET to do path resolution. `OpenFileDialog()` and `SaveFileDialog()`, `GetFullPath()` etc. that will properly resolve the OS filenames. Fox returns either upper case, or what you pass in for a lot of its file functions which is infuriating at times (it's also the reason why PRG files in the Fox editor often change case for filename or extensions so it's an internal problem in the Fox APIs too).

>Opposite here - the save-to location is fixed and invisible to the user, it's the source folders that will probably get revisited many times, so I'll maintain my own MRU list. The one in the dialog ("Recent places") is not working, and even in the cases when I saw it work, it would be polluted by places completely unrelated to job at hand. I'll have only those from which some pictures were already taken.

Yeah the Windows MRU list can be controlled - it lives in the registry and you can add and remove stuff from it. But it's not easy to get that right. I did that in Markdown Monster and success is spotty at best. Mainly so the start menu on the bottom shows the recent file list for my app, but the same thing applies to all the MRU lists.


>I was thinking of building something like that and gave up. Nobody likes frankenstein monsters in the GUI :).

Yup...

Since I'm building this for just two guys' (myself and the client) private use, both quite old, I'm going for as simple as possible. It'll be either a listbox with MRU of locations plus a commandbutton, or for ten wide buttons, with "add from {location here}".

>The simplest I've seen is the best - Gimp. It has a button with Recent places on the left pane, and when you click it it unfolds into a short MRU of places you used last but in Gimp only. So you save/load your pics where you did before, not where you had your video, sound, text or whatever unrelated stuff you may have done.

Either way it looks like your application has to track the locations and present them...

All of that's for the application to keep track off as I mentioned. When you open or save you keep track of the folder and when you display the dialog again you CD into that folder then back to your orig folder when you're done and GetFile() should respect that if I recall. If you use the WinAPI (or .NET one you can specify the 'start' folder).

The best UI is one that doesn't have to navigate and is already in the correct file location when you open the dialog. I find last used location usually works best for that with some additional overrides that come if that's not yet set or unavailable.

>The one remaining trouble I haven't solved is how to show all the formats at once. The Common dialog shows only one at a time.
>update: found it, it's very clumsy but it works.
>
.Filter = "BMP|*.bmp|GIF|*.gif|JPG|*.jpg;*.jpeg|PNG|*.png|TIFF|*.tif;*.tiff|"+;
>   "All Graphics Types|*.bmp;*.jpg;*.jpeg;*.png;*.tif;*.tiff"
>.FilterIndex=6
That also works with GetFile() by providing file extensions.

GETFILE() is one of those crazy APIs that you have to experiment with to find the right combination because the flags change behavior. But that's why I use the .NET APIs because it's simply cleaner and gives more options that GetFile doesn't support.

Anyway - good luck. Let us know which route you went. This is one of my pet peeve issues in Fox, because I have a number of document centric applications that need to load and save a lot of files.

+++ Rick ---
+++ Rick ---

West Wind Technologies
Maui, Hawaii

west-wind.com/
West Wind Message Board
Rick's Web Log
Markdown Monster
---
Making waves on the Web

Where do you want to surf today?
Previous
Reply
Map
View

Click here to load this message in the networking platform