ExplorerTreeGadget color

Mac OSX specific forum
User avatar
rndrei
Enthusiast
Enthusiast
Posts: 205
Joined: Thu Dec 28, 2023 9:04 pm

ExplorerTreeGadget color

Post by rndrei »

How to set the text color to the gadget?
This code doesn't work!

Code: Select all

 If OpenWindow(0, 0, 0, 300, 300, "ExplorerTreeGadget", #PB_Window_SystemMenu | #PB_Window_ScreenCentered)
   ExplorerTreeGadget(0, 10, 10, 280, 280, "*.pb;*.pbi")
   SetGadgetColor(0,#PB_Gadget_FrontColor,#Red)
    Repeat : Until WaitWindowEvent() = #PB_Event_CloseWindow
  EndIf
WilliamL
Addict
Addict
Posts: 1259
Joined: Mon Aug 04, 2008 10:56 pm
Location: Seattle, USA

Re: ExplorerTreeGadget color

Post by WilliamL »

No, I'm not getting any color either.

How about in the stringgadget?

Code: Select all

  If OpenWindow(0, 0, 0, 322, 235, "StringGadget", #PB_Window_SystemMenu | #PB_Window_ScreenCentered)
      StringGadget(0, 8,  10, 306, 20, "StringGadget no color")
      SetGadgetColor(0, #PB_Gadget_BackColor, $0000FF)
      StringGadget(1, 8,  40, 306, 20, "clicked-in StringGadget...")
      SetGadgetColor(1, #PB_Gadget_BackColor, $0000FF)
      TextGadget(2, 10,  70, 250, 20, "TextGadget looks normal") ; works fine with red square box filled
      SetGadgetColor(2, #PB_Gadget_BackColor, $0000FF)
    Repeat : Until WaitWindowEvent() = #PB_Event_CloseWindow
EndIf
What system are you using?
MacBook Pro-M1 (2021), Tahoe 26.2, PB 6.30b6
miso
Enthusiast
Enthusiast
Posts: 630
Joined: Sat Oct 21, 2023 4:06 pm
Location: Hungary

Re: ExplorerTreeGadget color

Post by miso »

Just for reference, on windows both code work with the colors. (I'm using 6.30 beta 6 x64, Win 10 tested.)
Wolfram
Enthusiast
Enthusiast
Posts: 610
Joined: Thu May 30, 2013 4:39 pm

Re: ExplorerTreeGadget color

Post by Wolfram »

Do you mean something like this?

Code: Select all

If OpenWindow(0, 0, 0, 300, 300, "ExplorerTreeGadget", #PB_Window_SystemMenu | #PB_Window_ScreenCentered)
  ExplorerTreeGadget(0, 10, 10, 280, 280, "*.pb;*.pbi")
  
  CocoaMessage(0, GadgetID(0), "setBackgroundColor:", CocoaMessage(0, 0, "NSColor systemRedColor"))
  
  Repeat : Until WaitWindowEvent() = #PB_Event_CloseWindow
EndIf
macOS Catalina 10.15.7
WilliamL
Addict
Addict
Posts: 1259
Joined: Mon Aug 04, 2008 10:56 pm
Location: Seattle, USA

Re: ExplorerTreeGadget color

Post by WilliamL »

Code: Select all

     If OpenWindow(0, 0, 0, 322, 340, "StringGadget", #PB_Window_SystemMenu | #PB_Window_ScreenCentered)
      StringGadget(0, 8,  10, 306, 20, "StringGadget no background color") ; gadget has rounded edges with very faint enclosing lines
      SetGadgetColor(0, #PB_Gadget_BackColor, #Red) ; no color
      SetGadgetColor(0, #PB_Gadget_FrontColor, #Blue) ; I get color
      StringGadget(1, 8,  40, 306, 20, "clicked-in to see color") ; no color till clicked
      CocoaMessage(1, GadgetID(1), "setBackgroundColor:", CocoaMessage(0, 0, "NSColor systemRedColor")) ; no color using this
      ;SetGadgetColor(1, #PB_Gadget_BackColor, $0000FF) ; no color using this
      TextGadget(2, 10,  70, 250, 20, "TextGadget looks normal") ; works fine with red square box filled
      SetGadgetColor(2, #PB_Gadget_BackColor, $0000FF)
      ExplorerTreeGadget(3,10, 100, 200, 200, "*.pb;*.pbi")
      SetGadgetColor(3,#PB_Gadget_FrontColor,#Red) ; no color using this
      SetGadgetColor(3,#PB_Gadget_BackColor,#Blue) ; I get color
      ;CocoaMessage(3, GadgetID(3), "setBackgroundColor:", CocoaMessage(0, 0, "NSColor systemRedColor")) ; I get color!
    Repeat : Until WaitWindowEvent() = #PB_Event_CloseWindow
EndIf
MacBook Pro-M1 (2021), Tahoe 26.2, PB 6.30b6
Wolfram
Enthusiast
Enthusiast
Posts: 610
Joined: Thu May 30, 2013 4:39 pm

Re: ExplorerTreeGadget color

Post by Wolfram »

Here, under macOS 14.8.2, I can't see any problem.
macOS Catalina 10.15.7
User avatar
mk-soft
Always Here
Always Here
Posts: 6493
Joined: Fri May 12, 2006 6:51 pm
Location: Germany

Re: ExplorerTreeGadget color

Post by mk-soft »

Not all Color features work on macOS.

Item Colors are not supported on Explorer[Tree]Gadget (Is in progress)
With SetGadgetColor, the FrontColor is not set. It's probably a bug.
But it is not always easy to correct them with the updates of macOS, since a lot has been tinkered with here in the NSTableView.

At StringGadget and TextGadget works here fine.
At ListIconGadget work SetGadgetItemColor for rows but not columns (Is in progress)

HM: Mac Mini 2018 (Intel)
OS: Sequioa v15.7.3
My Projects ThreadToGUI / OOP-BaseClass / EventDesigner V3
PB v3.30 / v5.75 - OS Mac Mini OSX 10.xx - VM Window Pro / Linux Ubuntu
Downloads on my Webspace / OneDrive
WilliamL
Addict
Addict
Posts: 1259
Joined: Mon Aug 04, 2008 10:56 pm
Location: Seattle, USA

Re: ExplorerTreeGadget color

Post by WilliamL »

Thanks for your input mk-soft.

Everything seemed to be ok until I got to Tahoe 26.1. Then when a new Command Line Tools was released I figured there would be changes that screw up PB. I'm kind of reluctant to compile my needed programs and lose them to corrupted code. So I'm in a waiting situation.
MacBook Pro-M1 (2021), Tahoe 26.2, PB 6.30b6
Post Reply