Author Topic: About "Opening files"  (Read 3507 times)

0 Members and 1 Guest are viewing this topic.

Offline euklides

  • Forum Regular
  • Posts: 128
    • View Profile
About "Opening files"
« on: May 02, 2021, 10:39:14 am »

Please see:
https://www.qb64.org/forum/index.php?topic=2689.msg119268#top  (locked)

Well, the program given by bplus works fine, but you can select only ONE file.

Is there a way to select directly multiple files (located  in a directory, of course) ?

Why not yes ?

Offline bplus

  • Global Moderator
  • Forum Resident
  • Posts: 8053
  • b = b + ...
    • View Profile
Re: About "Opening files"
« Reply #1 on: May 02, 2021, 04:18:59 pm »
There is a way to select multiple files but not directly, something you would have to code unless the API guy has something through Windows?

I am thinking of a UDT array with file names and some little symbol place next to each to indicate if user selected it or not, or you might try shading the items that are selected with each redraw in loop.

Offline euklides

  • Forum Regular
  • Posts: 128
    • View Profile
Re: About "Opening files"
« Reply #2 on: May 03, 2021, 02:48:02 am »
For output the selection of multiple files:
Using _CLIPBOARD$, you put all the file name selected.
_CLIPBOARD$ = <file name 1> + chr$(0) + <file name 2> + chr$(0)  ... aso
then splitting...
------------------------------
But how select multiple files ?

in the program you have:
CONST OFN_ALLOWMULTISELECT = &H200& '  Allows the user to select more than one file, not recommended! 

But impossible to select more than on file...
Why not yes ?

Offline bplus

  • Global Moderator
  • Forum Resident
  • Posts: 8053
  • b = b + ...
    • View Profile
Re: About "Opening files"
« Reply #3 on: May 03, 2021, 10:50:06 am »
Quote
in the program you have:
CONST OFN_ALLOWMULTISELECT = &H200& '  Allows the user to select more than one file, not recommended!

OK that's not my program, but it would be good exercise to have multi-file selection and cross platform and select paths too!
« Last Edit: May 03, 2021, 10:51:55 am by bplus »

Offline NOVARSEG

  • Forum Resident
  • Posts: 509
    • View Profile
Re: About "Opening files"
« Reply #4 on: May 03, 2021, 10:49:28 pm »
Quote
Is there a way to select directly multiple files (located  in a directory, of course) ?

Yep sure why not.  You can select multiple files that can also be opened at the same time.


Offline euklides

  • Forum Regular
  • Posts: 128
    • View Profile
Re: About "Opening files"
« Reply #5 on: May 04, 2021, 03:37:14 am »
Of course, if you change
  Flags& = OFN_FILEMUSTEXIST + OFN_NOCHANGEDIR + OFN_READONLY
with
  Flags& = OFN_ALLOWMULTISELECT + OFN_FILEMUSTEXIST + OFN_NOCHANGEDIR + OFN_READONLY
before using  GetOpenFileName$(...) command, you can select multiple files and see them in the OFile$ variable. (file names separated with space)

BUT... sometime you can get only the short name of the files (ex: demontration number 1.jpg--> demontr~1.jgp)
« Last Edit: May 04, 2021, 03:39:38 am by euklides »
Why not yes ?