[Mac] Window live resize

Got an idea for enhancing PureBasic? New command(s) you'd like to see?
User avatar
Shardik
Addict
Addict
Posts: 2058
Joined: Thu Apr 21, 2005 2:38 pm
Location: Germany

Re: [Mac] Window live resize

Post by Shardik »

Polo wrote:Only on PB apps the grow box background color is white, and it doesn't look really good.
You may use this workaround to obtain a transparent grow box:

Code: Select all

EnableExplicit

ImportC ""
  HIViewGetFirstSubview(ViewRef.L)
  HIViewGetKind(ViewRef.L, *HIViewKind)
  HIViewGetNextView(ViewRef.L)
  HIViewGetRoot(WindowRef.L)
  HIGrowBoxViewSetTransparent(GrowBoxRef.L, Transparent.L)
EndImport

Structure HIViewKind
  Signature.L
  Kind.L
EndStructure

Procedure SetGrowBoxTransparent(WindowID.L)
  Protected RootView.L
  Protected SubView.L
  Protected ViewKind.HIViewKind

  RootView = HIViewGetRoot(WindowID(WindowID))
  
  If RootView
    SubView = HIViewGetFirstSubview(RootView)
    
    While SubView <> 0
      If HIViewGetKind(SubView, @ViewKind) = 0
        If ViewKind\Kind = 'grow'
          HIGrowBoxViewSetTransparent(SubView, #True)
          Break
        EndIf
      EndIf

      SubView = HIViewGetNextView(SubView)
    Wend
  EndIf
EndProcedure

OpenWindow(0, 270, 100, 250, 120, "Transparent grow box", #PB_Window_SystemMenu | #PB_Window_SizeGadget)
SetGrowBoxTransparent(0)

Repeat
Until WaitWindowEvent() = #PB_Event_CloseWindow
Polo
Addict
Addict
Posts: 2422
Joined: Tue May 06, 2003 5:07 pm
Location: UK

Re: [Mac] Window live resize

Post by Polo »

Nice trick! :)
Polo
Addict
Addict
Posts: 2422
Joined: Tue May 06, 2003 5:07 pm
Location: UK

Re: [Mac] Window live resize

Post by Polo »

Still about resizing, the resize arrows doesn't show up when trying to resize the window, unlike any other Mac program (OSX Lion).
Post Reply