It is currently Mon Sep 23, 2019 12:16 pm

All times are UTC + 1 hour




Post new topic Reply to topic  [ 5 posts ] 
Author Message
 Post subject: macOS Mojave Dark mode and Gadgets
PostPosted: Thu Nov 22, 2018 8:27 pm 
Offline
Addict
Addict
User avatar

Joined: Fri May 12, 2006 6:51 pm
Posts: 1915
Location: Germany
Most gadgets support Mojave's darkmode without any problems.

There is little to customize.

1. TreeGadget item with images does not match the text color.
2. FrameGadget with the style #PB_Frame_Double is not supported and so the color and the design is not right.
Code:
;-TOP

; Workaround PB v5.62+ OSX Darkmode
; Version : v1.0
; Create  : 22.11.2018
; Update  :

; -----------------------------------------------------------------------------

Procedure IsDarkmode()
  CompilerSelect #PB_Compiler_OS
    CompilerCase #PB_OS_MacOS
      Protected UserDefaults, NSString, String.s
      UserDefaults = CocoaMessage(0, 0, "NSUserDefaults standardUserDefaults")
      NSString = CocoaMessage(0, UserDefaults, "stringForKey:$", @"AppleInterfaceStyle")
      If NSString
        String = PeekS(CocoaMessage(0, NSString, "UTF8String"), -1, #PB_UTF8)
        If String = "Dark"
          ProcedureReturn 1
        Else
          ProcedureReturn 0
        EndIf
      Else
        ProcedureReturn 0
      EndIf
     
    CompilerCase #PB_OS_Windows
      ProcedureReturn 0
    CompilerCase #PB_OS_Linux
      ProcedureReturn 0
     
  CompilerEndSelect
 
EndProcedure

; -----------------------------------------------------------------------------

CompilerIf #PB_Compiler_IsMainFile
 
  LoadImage(0, #PB_Compiler_Home + "examples/sources/Data/Drive.bmp")
  LoadImage(1, #PB_Compiler_Home + "examples/sources/Data/File.bmp")
 
  If OpenWindow(0, 0, 0, 355, 180, "TreeGadget", #PB_Window_SystemMenu | #PB_Window_ScreenCentered)
    TreeGadget(0, 10, 10, 160, 160)                                         ; TreeGadget Standard
    TreeGadget(1, 180, 10, 160, 160, #PB_Tree_CheckBoxes | #PB_Tree_NoLines); TreeGadget mit Checkboxen + ohne Linien
   
    If IsDarkmode()
      SetGadgetColor(0, #PB_Gadget_FrontColor, $E0E0E0)
      ;SetGadgetColor(1, #PB_Gadget_FrontColor, $E0E0E0)
    EndIf
   
    For ID = 0 To 1
      For a = 0 To 10
        AddGadgetItem (ID, -1, "Normal Item "+Str(a), 0, 0) ; wenn Sie ein Bild hinzufügen möchten, dann
        AddGadgetItem (ID, -1, "Node "+Str(a), 0, 0)        ; benutzen Sie ImageID(x) als 4. Parameter
        AddGadgetItem(ID, -1, "Sub-Item 1", ImageID(0), 1)  ; diese sind auf dem ersten Sublevel
        AddGadgetItem(ID, -1, "Sub-Item 2", ImageID(0), 1)
        AddGadgetItem(ID, -1, "Sub-Item 3", ImageID(0), 1)
        AddGadgetItem(ID, -1, "Sub-Item 4", ImageID(0), 1)
        AddGadgetItem (ID, -1, "File "+Str(a), ImageID(1), 0)  ; hier wieder Sublevel 0
      Next
    Next
    Repeat : Until WaitWindowEvent() = #PB_Event_CloseWindow
  EndIf
 
CompilerEndIf

_________________
My Projects ThreadToGUI / OOP-BaseClass / OOP-BaseClassDispatch / EventDesigner V3
PB v3.30 / v5.70 - OS Mac Mini OSX 10.xx - VM Window Pro / Linux Ubuntu
Downloads on my Webspace


Top
 Profile  
Reply with quote  
 Post subject: Re: macOS Mojave Dark mode and Gadgets
PostPosted: Fri Apr 12, 2019 4:08 pm 
Offline
Administrator
Administrator

Joined: Fri May 17, 2002 4:39 pm
Posts: 13614
Location: France
Fixed the TreeGadget() issue but I'm not sure about the FrameGadget() with #PB_Frame_Double, what do you expect ?


Top
 Profile  
Reply with quote  
 Post subject: Re: macOS Mojave Dark mode and Gadgets
PostPosted: Fri Apr 12, 2019 6:01 pm 
Offline
Addict
Addict
User avatar

Joined: Fri May 12, 2006 6:51 pm
Posts: 1915
Location: Germany
The style and background color of the FrameGadget with #PB_Frame_Double does not match the other styles in dark mode.

_________________
My Projects ThreadToGUI / OOP-BaseClass / OOP-BaseClassDispatch / EventDesigner V3
PB v3.30 / v5.70 - OS Mac Mini OSX 10.xx - VM Window Pro / Linux Ubuntu
Downloads on my Webspace


Top
 Profile  
Reply with quote  
 Post subject: Re: macOS Mojave Dark mode and Gadgets
PostPosted: Fri Apr 26, 2019 10:20 am 
Offline
Administrator
Administrator

Joined: Fri May 17, 2002 4:39 pm
Posts: 13614
Location: France
Could you post a screenshot of what you expect ?


Top
 Profile  
Reply with quote  
 Post subject: Re: macOS Mojave Dark mode and Gadgets
PostPosted: Fri Apr 26, 2019 6:11 pm 
Offline
Addict
Addict
User avatar

Joined: Fri May 12, 2006 6:51 pm
Posts: 1915
Location: Germany
Picture FrameGadget

Link: https://ibb.co/xzzJpj3

_________________
My Projects ThreadToGUI / OOP-BaseClass / OOP-BaseClassDispatch / EventDesigner V3
PB v3.30 / v5.70 - OS Mac Mini OSX 10.xx - VM Window Pro / Linux Ubuntu
Downloads on my Webspace


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

All times are UTC + 1 hour


Who is online

Users browsing this forum: No registered users and 1 guest


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