Page 1 of 1

OpenFileRequest PB 5.73 beta 2 x64

Posted: Sun Nov 01, 2020 6:31 am
by Andrew Lindsay
Hello group,

I am trying to select a file using the OpenFileRequest in a mac using the sample code in the manual.

Code: Select all

StandardFile$ = ""   ; set initial file+path to display
  ; With next string we will set the search patterns ("|" as separator) for file displaying:
  ;  1st: "Text (*.txt)" as name, ".txt" and ".bat" as allowed extension
  ;  2nd: "PureBasic (*.pb)" as name, ".pb" as allowed extension
  ;  3rd: "All files (*.*) as name, "*.*" as allowed extension, valid for all files
  Pattern$ = "Text (*.txt)|*.txt;*.bat|PureBasic (*.pb)|*.pb|All files (*.*)|*.*"
  Pattern = 0    ; use the first of the three possible patterns as standard
  File$ = OpenFileRequester("Please choose file to load", StandardFile$, Pattern$, Pattern)
  If File$
    MessageRequester("Information", "You have selected following file:" + Chr(10) + File$, 0)
  Else
    MessageRequester("Information", "The requester was canceled.", 0) 
  EndIf
I get the dialog to pop up to select a file, but the 'Open' button remains disabled. I am able to search around the directories, but I can never select a file to open.
Any assistance would be appreciated.

Re: OpenFileRequest PB 5.73 beta 2 x64

Posted: Sun Nov 01, 2020 12:13 pm
by mk-soft
With Catalina no problem ...

macOS don't support patterns!

Re: OpenFileRequest PB 5.73 beta 2 x64

Posted: Wed Nov 04, 2020 3:44 am
by Andrew Lindsay
OK, so what should the call look like, and if the call is wrong, why don't I get an error in my compile?

Re: OpenFileRequest PB 5.73 beta 2 x64

Posted: Wed Nov 04, 2020 12:38 pm
by collectordave
Running the code as shown I have no problems on Mojave or High sierra.

As soon as I select a file the open button is enabled.

The pattern bit threw me as well, Mac ignores the Pattern$ and select pattern.


CD

Re: OpenFileRequest PB 5.73 beta 2 x64

Posted: Wed Nov 04, 2020 3:57 pm
by Andrew Lindsay
Ok, some new information to add into the mix. I'm using Catalina.

It's weird behaviour. When the dialog first appears, I can not select a file, and yet I can open and close folders. I can also drag and move around the dialog, still without being able to select a file.

BUT, if I grab the lower left corner and resize the dialog, I am then able to select a file. This is weird.

Regards

Andrew

Re: OpenFileRequest PB 5.73 beta 2 x64

Posted: Sat Nov 07, 2020 11:15 am
by collectordave
That is a little weird.

When I upgraded to catalina i had some problems as well.

One thing I found was that Catalina was very slow so I down graded to mojave.

One other thing you can try is this link http://www.mediafire.com/file/47vqjoilz ... r.zip/file

I need the file requesters to be the same on both windows and mc so just rolling my own.

Regards

CD

Re: OpenFileRequest PB 5.73 beta 2 x64

Posted: Sat Nov 07, 2020 3:59 pm
by Paul
collectordave wrote: One other thing you can try is this link http://www.mediafire.com/file/47vqjoilz ... r.zip/file

I need the file requesters to be the same on both windows and mc so just rolling my own.
Just a note, your code crashes because you hard coded the location of one of the images used :wink:

Code: Select all

imgUpEnabled = LoadImage(#PB_Any,"/Users/williamatkin/Documents/PB Projects/FileRequester/arrow_up.png")

Re: OpenFileRequest PB 5.73 beta 2 x64

Posted: Sat Nov 07, 2020 4:10 pm
by collectordave
Thanks will remove and repost

CD

Re: OpenFileRequest PB 5.73 beta 2 x64

Posted: Sat Nov 07, 2020 4:20 pm
by collectordave
Hardcoded image removed.

May add it to data section later.

Also found you could not enter a filename to save also cleared.


Same link.


If anyone tries it on windows let me know.

CD

Re: OpenFileRequest PB 5.73 beta 2 x64

Posted: Sun Nov 08, 2020 7:38 am
by Andrew Lindsay
Cheers,

I'll have a look at that and see how things go.

Regards

Andrew