It is currently Fri Apr 03, 2020 6:10 am

All times are UTC + 1 hour




Post new topic Reply to topic  [ 3 posts ] 
Author Message
 Post subject: [Done] Same background color in StatusBar as in Window
PostPosted: Sat Aug 11, 2018 2:48 pm 
Offline
Addict
Addict
User avatar

Joined: Thu Apr 21, 2005 2:38 pm
Posts: 1695
Location: Germany
Beginning with PB 5.40 the background color of the StatusBar is always the same as in the window. Up to PB 5.31 the background color of the StatusBar was the same as the background color (or style like brushed metal) of the window title bar. This problem is independant from the MacOS version. I used the following simple test code:
Code:
OpenWindow(0, 270, 100, 260, 50, "Window with StatusBar")
CreateStatusBar(0, WindowID(0))
AddStatusBarField(#PB_Ignore)
StatusBarText(0, 0, "StatusBar", #PB_StatusBar_Center)

Repeat
Until WaitWindowEvent() = #PB_Event_CloseWindow


MacOS 10.6.8 'Snow Leopard' with PB 5.31:
Image
MacOS 10.13.6 'High Sierra' with PB 5.31:
Image
MacOS 10.6.8 'Snow Leopard' with PB 5.62:
Image
MacOS 10.13.6 'High Sierra' with PB 5.62:
Image

This is a workaround for setting the StatusBar's background color to a similar one as in the title bar (tested on MacOS 10.13.6 with PB 5.62):
Image
Code:
EnableExplicit

ImportC ""
  NSRectFill(x.CGFloat, y.CGFloat, Width.CGFloat, Height.CGFloat)
EndImport

Define SubclassedStatusBar.I

ProcedureC StatusBarDrawingCallback(Object.I, Selector.I, x.CGFloat, y.CGFloat,
  Width.CGFloat, Height.CGFloat)
  Protected ChannelValue.CGFloat = 0.85
  Protected Alpha.CGFloat = 1

  CocoaMessage(0, CocoaMessage(0, 0, "NSColor colorWithDeviceRed:@", @ChannelValue,
    "green:@", @ChannelValue,
    "blue:@", @ChannelValue,
    "alpha:@", @Alpha), "setFill")
  NSRectFill(x, y, Width, Height)
EndProcedure

OpenWindow(0, 270, 100, 200, 70, "Gray StatusBar")

If CreateStatusBar(0, WindowID(0))
  AddStatusBarField(#PB_Ignore)
  StatusBarText(0, 0, "StatusBar", #PB_StatusBar_Center)
EndIf

; ----- Subclass StatusBar

SubclassedStatusBar = objc_allocateClassPair_(CocoaMessage(0,
  StatusBarID(0), "class"), "SubclassedStatusBar", 0)
objc_registerClassPair_(SubclassedStatusBar)
object_setClass_(StatusBarID(0), SubclassedStatusBar)

; ----- Initialize callback for drawing StatusBar rectangle

class_addMethod_(SubclassedStatusBar,
  sel_registerName_("drawRect:"),
  @StatusBarDrawingCallback(), "v@:@")

Repeat
Until WaitWindowEvent() = #PB_Event_CloseWindow


Last edited by Shardik on Mon Dec 31, 2018 12:41 pm, edited 1 time in total.

Top
 Profile  
Reply with quote  
 Post subject: Re: Same background color in StatusBar as in Window
PostPosted: Sat Aug 11, 2018 3:00 pm 
Offline
New User
New User

Joined: Fri Aug 10, 2018 3:55 pm
Posts: 4
I can confirm this behaviour , it makes the status bar gadget largely unusable


Top
 Profile  
Reply with quote  
 Post subject: Re: Same background color in StatusBar as in Window
PostPosted: Fri Apr 26, 2019 3:17 pm 
Offline
Administrator
Administrator

Joined: Fri May 17, 2002 4:39 pm
Posts: 14014
Location: France
Fixed.


Top
 Profile  
Reply with quote  
Display posts from previous:  Sort by  
Post new topic Reply to topic  [ 3 posts ] 

All times are UTC + 1 hour


Who is online

Users browsing this forum: No registered users and 4 guests


You cannot post new topics in this forum
You cannot reply to topics in this forum
You cannot edit your posts in this forum
You cannot delete your posts in this forum

Search for:
Jump to:  

 


Powered by phpBB © 2008 phpBB Group
subSilver+ theme by Canver Software, sponsor Sanal Modifiye