Metal Window

Mac OSX specific forum
spacebuddy
Enthusiast
Enthusiast
Posts: 364
Joined: Thu Jul 02, 2009 5:42 am

Metal Window

Post by spacebuddy »

Is this possible with the latest version of PB?
User avatar
Shardik
Addict
Addict
Posts: 2076
Joined: Thu Apr 21, 2005 2:38 pm
Location: Germany

Re: Metal Window

Post by Shardik »

I posted already a code example which changes several window attributes including switching to the metal skin:
http://www.purebasic.fr/english/viewtop ... 84#p393084

The above example also works with PB 5.21. For your conveniance I have reduced the code to the following example which changes the normal window appearence to metal look. I have tested it successfully with OS X 10.6.8 (Snow Leopard) and OS X 10.8.5 (Mountain Lion) in both 32 bit and 64 bit mode.

Code: Select all

#NSTexturedBackgroundWindowMask = 1 << 8

WindowTitle$ = "Change window skin"
OpenWindow(0, 270, 100, 220, 80, WindowTitle$)
ButtonGadget(0, 40, 30, 140, 25, "Enable metal look")

Repeat
  Select WaitWindowEvent()
    Case #PB_Event_CloseWindow
      Break
    Case #PB_Event_Gadget
      If EventGadget() = 0 And EventType() = #PB_EventType_LeftClick
        CocoaMessage(0, WindowID(0), "setStyleMask:", CocoaMessage(0, WindowID(0),
          "styleMask") ! #NSTexturedBackgroundWindowMask)
        CocoaMessage(0, WindowID(0), "display")
        DisableGadget(0, #True)
      EndIf
  EndSelect
ForEver
Post Reply