Page 1 of 1

Metal Window

Posted: Thu Nov 28, 2013 2:07 am
by spacebuddy
Is this possible with the latest version of PB?

Re: Metal Window

Posted: Thu Dec 05, 2013 11:23 pm
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