0

In VCL I used TOpenPictureDialog for loading of image files because it's useful to see a preview when selecting from a long list of files. I also used it for loading my own binary file format by creating a class derived from TGraphic, overriding the load and draw functions and registering it with TPicture. Now I've moved to FMX and would like a similar preview, but there is no TOpenPictureDialog. My only alternative currently seems to be to create a custom form for loading these files, including the ability to browse folders, etc, which seems like a big job to replicate all the functionaly of TOpenPictureDialog. Before I do that I wonder if anyone knows of a pre-existing component that does this? I'd like to support Windows and OSX initially.

If I do end up making my own component, would it be easier to start from scratch or to derive from and extend TOpenDialog? It seems that TOpenDialog is just running the default Windows open dialog in Windows so it seems unlikely that I could do that.

This is one of the few things missing from FMX that is available in VCL.

XylemFlow
  • 963
  • 5
  • 12
  • Aren't the native system dialogs good enough? In Windows, *any* file dialog can be made into a previewing file dialog by pressing Alt+P (or clicking the corresponding toolbar button). – Andreas Rejbrand Jun 07 '21 at 14:25
  • That's fine for previewing normal image files, but not my custom file format. In VCL I created my own class derived from TGraphic and registered it with TPicture to get it to show up in the preview. TGraphic doesn't exist in FMX, unless there's another way to do it? – XylemFlow Jun 07 '21 at 14:38
  • In Windows, you can create a custom preview handler for your file format. Then your files can be previewed in any Explorer window (including, of course, any file dialog in any application). Don't know about Apple. I assume your custom format is an image file format (otherwise the `TOpenPictureDialog` approach seems rather unnatural)? Also, customizing the Windows file dialog is [perfectly doable](https://privat.rejbrand.se/win32custfd.png). – Andreas Rejbrand Jun 07 '21 at 14:42
  • Thanks. Yes, I've looked into creating a preview handler before, but this was more complex than just getting it to preview in TOpenPictureDialog. That's a good suggestion though so I'll look into that again. Do you have any code example for the custom file dialog you showed? – XylemFlow Jun 07 '21 at 14:50
  • Sorry, I don't have an example of that. As you say, it is more involved (and the Win32 handler obviously won't work on macOS), but I imagine it shouldn't be prohibitively difficult. After all, this is a fairly common type of shell extension. – Andreas Rejbrand Jun 07 '21 at 14:55

0 Answers0