Page 2 of 2 FirstFirst 12
Results 11 to 15 of 15

Thread: Cross-platform way of getting list of all drives (A - Z) on a computer?

  1. #11
    Quote Originally Posted by Cybermonkey View Post
    Hm, I not sure if I understood correctly. You want the User first select the drive and then the file, right? But what about the ordinary TopenDialog? One can select all drives from within ... and this works on all OSs. But maybe I got something wrong ...

    Attachment 503
    Thanks Cybermonkey, but if I use the standard TOpenDialog, I need to close that dialog before I can let the user play a selected sound file...

    If I use a custom one, I can let the user play a selected sound and then if they are happy, close the dialog box, returning the file name

    cheers,
    Paul

  2. #12
    Then how about extending TOpenDialog to have a preview function?
    Imagine I've written something clever here inspiring you to make something awesome. If that happens give me credits

  3. #13
    hmm...interesting idea, thanks!

    I wonder how easy it would be to do under Lazarus? I am more familiar with Delphi controls

    cheers,
    Paul

  4. #14
    I can think of a few ways to handle it.

    - Specify drives with a string. Under Windows, it will be a single letter string. Under Unix, it will be the name of the volume. (Although Unix hides volumes, it is really just a directory in /Volumes etc.)
    - Index all volumes into an array, and index it using the drive letter. (Makes everything look more like Windows to you.)

    Of course, you must also handle path formats, using "\" or "/" and making it start right. There are quite a few things to handle, and making that transparent is a challenge.

    When I made a Windows port of an application (from Mac) I created full path strings in the file dialogs, and used that. As long as I didn't mess with the string contents, this was transparent. It is convenient to use a separate string for the file name without the path though. Also, on the Mac it isn't recommended to use path name strings, because the OS will handle files moved while in use (very elegant) but it can't change your own strings.

  5. #15
    Thanks for the tips Ingemar

    cheers,
    Paul

Page 2 of 2 FirstFirst 12

Bookmarks

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •