Programming on the Mac platform

Mac OSX specific forum
User avatar
Shardik
Addict
Addict
Posts: 1991
Joined: Thu Apr 21, 2005 2:38 pm
Location: Germany

Re: Programming on the Mac platform

Post by Shardik »

WilliamL wrote:Platform limitations:
-color in gadgets is generally not supported (in pb - but see API list) (see examples at http://www.purebasic.fr/english/viewtop ... 63#p340163 )
freak wrote:The color options on OSX are very poor. If it does not work, its probably not possible. I spent quite some time implementing coloring wherever possible.
I can confirm freak's findings but nevertheless I would suggest to change the help for Mac. Especially for a beginner it is annoying and frustrating to read in the help for SetGadgetColor:
PB help for SetGadgetColor wrote:Supported OS
all
And this function is not contained in "Platform-dependant functions" with a hint that most Gadgets don't work with SetGadgetColor...

I have therefore compiled a html table (in the style of "Platform-dependant functions") which indicates for each gadget whether it works or doesn't work with SetGadgetColor and SetGadgetFont or whether an API workaround exists. Unfortunately I don't know a way to display this table as html on this board. Therefore I had to include it as an image...

Hint to Andre: it would be nice if you could integrate this table into the help files. Please send me a PM if you are interested... :wink:

Image

Update 1: I have added SetGadgetItemColor to my table.
Update 2: I have changed the status of SetGadgetFont for the HyperLinkGadget to Red
Last edited by Shardik on Mon Aug 01, 2011 9:55 pm, edited 2 times in total.
User avatar
Andre
PureBasic Team
PureBasic Team
Posts: 2071
Joined: Fri Apr 25, 2003 6:14 pm
Location: Germany (Saxony, Deutscheinsiedel)
Contact:

Re: Programming on the Mac platform

Post by Andre »

@Shardik: thanks for your effort and the offer with the table :o)

But before I change the help, there is needed an official statement by the developers Fred / Timo. E.g. if they want such extensions in the help, if they will add (by workarounds...) mure functionality about the colors, etc.
Bye,
...André
(PureBasicTeam::Docs & Support - PureArea.net | Order:: PureBasic | PureVisionXP)
freak
PureBasic Team
PureBasic Team
Posts: 5929
Joined: Fri Apr 25, 2003 5:21 pm
Location: Germany

Re: Programming on the Mac platform

Post by freak »

Andre wrote:@Shardik: thanks for your effort and the offer with the table :o)

But before I change the help, there is needed an official statement by the developers Fred / Timo. E.g. if they want such extensions in the help, if they will add (by workarounds...) mure functionality about the colors, etc.
I don't think there will be many changes in this area anymore (at least not until the day we switch to Cocoa as the underlying framework). So feel free to update the help accordingly.

> Hint to Andre: it would be nice if you could integrate this table into the help files. Please send me a PM if you are interested...

Don't add that table. Add a note in the topic for each function instead.
quidquid Latine dictum sit altum videtur
User avatar
Shardik
Addict
Addict
Posts: 1991
Joined: Thu Apr 21, 2005 2:38 pm
Location: Germany

Re: Programming on the Mac platform

Post by Shardik »

freak wrote:I don't think there will be many changes in this area anymore (at least not until the day we switch to Cocoa as the underlying framework).
Timo,

I fully understand that there won't be many changes implemented in the
current Mac version of PB with its Carbon framework base. But do you
already have any plans in which PB version the porting from Carbon to
Cocoa will happen? I know that this task will take a lot of work because
all Gadgets will have to be reprogrammed and adapted to utilize the object
oriented Cocoa framework. In principle I would guess that this is almost as
much work as to develop a new Mac version of PureBasic from scratch...

Do you already know whether Carbon support will be ended completely or
will there exist a possibility to chose Carbon as an alternate subsystem? :)
freak wrote:Don't add that table. Add a note in the topic for each function instead.
That would be indeed the most user friendly solution... :wink:
User avatar
Andre
PureBasic Team
PureBasic Team
Posts: 2071
Joined: Fri Apr 25, 2003 6:14 pm
Location: Germany (Saxony, Deutscheinsiedel)
Contact:

Re: Programming on the Mac platform

Post by Andre »

Informations about (restricted) coloring possibilities on MacOS were added to the manual, for PB4.61... :)
Bye,
...André
(PureBasicTeam::Docs & Support - PureArea.net | Order:: PureBasic | PureVisionXP)
Lebostein
Addict
Addict
Posts: 807
Joined: Fri Jun 11, 2004 7:07 am

Re: Programming on the Mac platform

Post by Lebostein »

This thread is pinned and seems to be important.

All these facts are correct also in the current version 5.10? Both listings (limitations and gadget colors) are from the year 2011 (PB version 4.6)...
Thanks!
Fred
Administrator
Administrator
Posts: 16687
Joined: Fri May 17, 2002 4:39 pm
Location: France
Contact:

Re: Programming on the Mac platform

Post by Fred »

No, it's no more accurate as we switched to Cocoa inbetween.
User avatar
Shardik
Addict
Addict
Posts: 1991
Joined: Thu Apr 21, 2005 2:38 pm
Location: Germany

Re: Programming on the Mac platform

Post by Shardik »

Lebostein wrote:All these facts are correct also in the current version 5.10?
The limitations in the coloring of gadgets only apply if selecting subsystem Carbon. So SetGadgetColor() should work fine for all gadgets listed in the help for that command when using the Cocoa framework (default since PB 5.00).
collectordave
Addict
Addict
Posts: 1309
Joined: Fri Aug 28, 2015 6:10 pm
Location: Portugal

Re: Programming on the Mac platform

Post by collectordave »

Just stating out.

i have written a small program to display a splash screen using a .png image in an image gadget.

Works fine on windows 7. Moved whole thing to MAC and program runs but no image is displayed in the image gadget. If I add image at design time as i add the image gadget it works. Code as follows

;Imports/Using statements
UsePNGImageDecoder()
UseSQLiteDatabase()

;Add binaries to exe section
DataSection
splash: :IncludeBinary "Images\WorldC.png"
EndDataSection

;Display Splash Screen
window_Splash = OpenWindow(#PB_Any,0,0,500,200,"",#PB_Window_BorderLess|#PB_Window_ScreenCentered)
image_Splash = CatchImage(#PB_Any, ?splash)
gadget_Image = ImageGadget(#PB_Any,0,0,500,200,ImageID(image_Splash))

Delay(3000)

;Close Splash Screen
CloseWindow(window_Splash)

Looked at forum, not extensively but any help appreciated
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.
collectordave
Addict
Addict
Posts: 1309
Joined: Fri Aug 28, 2015 6:10 pm
Location: Portugal

Re: Programming on the Mac platform

Post by collectordave »

Quick update on the above.

When i create the executable .app the splash screen shows Ok! Just not when running in compile and run.
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
TI-994A
Addict
Addict
Posts: 2512
Joined: Sat Feb 19, 2011 3:47 am
Location: Singapore
Contact:

Re: Programming on the Mac platform

Post by TI-994A »

collectordave wrote:...program runs but no image is displayed in the image gadget...
It seems that the Delay() function is the culprit. Remove it and the image displays.

Instead, try implementing a timer for the splash screen. :wink:
Texas Instruments TI-99/4A Home Computer: the first home computer with a 16bit processor, crammed into an 8bit architecture. Great hardware - Poor design - Wonderful BASIC engine. And it could talk too! Please visit my YouTube Channel :D
collectordave
Addict
Addict
Posts: 1309
Joined: Fri Aug 28, 2015 6:10 pm
Location: Portugal

Re: Programming on the Mac platform

Post by collectordave »

It Works!

Thanks possibly saved me hours.
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.
collectordave
Addict
Addict
Posts: 1309
Joined: Fri Aug 28, 2015 6:10 pm
Location: Portugal

Re: Programming on the Mac platform

Post by collectordave »

Using PB 5.4 Beta.

Programmed a small Print and preview routine that takes lines, text and images etc on a windows machine then moved to MAC to test. Drawing stopped each time. Problem was that the drawing functions stopped after displaying a requester either font or file.

Not a restriction more my problem in my thinking. Not many programmes ask you to choose the font for text to be printed at the time you are printing. So moved requester code to front before drawing routines.

Just a slight difference between Windows and OSX to be aware of.
jack
Addict
Addict
Posts: 1337
Joined: Fri Apr 25, 2003 11:10 pm

Re: Programming on the Mac platform

Post by jack »

MachOView is a visual Mach-O file browser. It provides a complete solution for exploring and in-place editing Intel and ARM binaries.
collectordave
Addict
Addict
Posts: 1309
Joined: Fri Aug 28, 2015 6:10 pm
Location: Portugal

Re: Programming on the Mac platform

Post by collectordave »

Thanks all

Just another question.

Moved one of my programmes to the Mac and found that sizes of gadgets seem to be different. e.g. a spin gadget on windows displays three figures i.e. hundreds etc but the same prog on the mac shows only two. I also have scrunched up text and string gadgets.

Is there a rule of thumb for sizing gadgets so they display the same on both platforms?

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.
Post Reply