Explorertreegadget

Mac OSX specific forum
collectordave
Addict
Addict
Posts: 1310
Joined: Fri Aug 28, 2015 6:10 pm
Location: Portugal

Explorertreegadget

Post by collectordave »

Now taken the plunge and bought a MACBook Pro.

Looking at the explorer treegadge,t loaded the code from the help file and managed to get a blank gadget on screen.

Is there a default directory\folder for the MAC as on windows?

Asking as I wish to get my image file selector working on the MAC as well as windows.

Any help with code appreciated.

Regards

CD
Any intelligent fool can make things bigger and more complex. It takes a touch of genius — and a lot of courage to move in the opposite direction.
User avatar
Shardik
Addict
Addict
Posts: 2058
Joined: Thu Apr 21, 2005 2:38 pm
Location: Germany

Re: Explorertreegadget

Post by Shardik »

collectordave wrote:Looking at the explorer treegadge,t loaded the code from the help file and managed to get a blank gadget on screen.

Is there a default directory\folder for the MAC as on windows?
No, you have to supply at least "/" for the Directory$ parameter. The Windows example from help doesn't work and should be replaced by a working one in MacOS help.
collectordave wrote:Asking as I wish to get my image file selector working on the MAC as well as windows.
Unfortunately that's currently not possible. A pattern with file extensions doesn't work on MacOS. This should be documented in the MacOS help for ExplorerTreeGadget() and ExplorerListGadget() like it is documented for the OpenFileRequester():
[color=#0040FF]MacOS help for OpenFileRequester[/color] wrote:Several extensions can be specified for a single type by using the ; (semi-colon) separator (not supported on OSX, the requester always displays all files).
An alternative to the ExplorerTreeGadget for MacOS would be to use an NSOpenPanel. Wilbert already demonstrated in this example code how to let the user choose files with predefined file extensions although ALL files will be visible. But the files with the predefined extensions are the only ones the user will be able to select...
collectordave
Addict
Addict
Posts: 1310
Joined: Fri Aug 28, 2015 6:10 pm
Location: Portugal

Re: Explorertreegadget

Post by collectordave »

Thanks Shardik

The start folder I have managed a get around by using an application global constant dependant on OS which with #PBnofiles gets me what I want.

Code on forum updated http://www.purebasic.fr/english/viewtop ... +module%3A

Regards

CD
Any intelligent fool can make things bigger and more complex. It takes a touch of genius — and a lot of courage to move in the opposite direction.
User avatar
Shardik
Addict
Addict
Posts: 2058
Joined: Thu Apr 21, 2005 2:38 pm
Location: Germany

Re: Explorertreegadget

Post by Shardik »

You don't need to use CompilerIfs to display the root folder for Linux, MacOS and Windows. The slash ("/" ) works cross-plattform on all 3 platforms. I thus modified the code example from help to work cross-platform (without the file extension patterns which don't work on MacOS):

Code: Select all

If OpenWindow(0, 0, 0, 300, 300, "ExplorerTreeGadget", #PB_Window_SystemMenu | #PB_Window_ScreenCentered)
  ExplorerTreeGadget(0, 10, 10, 280, 280, "/")
  Repeat : Until WaitWindowEvent() = #PB_Event_CloseWindow
EndIf
Alternatively you may use GetHomeDirectory() or GetTemporaryDirectory() which of course also work cross-platform... :wink:
Post Reply