Page 1 of 1
ExplorerTreeGadget color
Posted: Mon Dec 22, 2025 10:08 am
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
Re: ExplorerTreeGadget color
Posted: Tue Dec 23, 2025 7:08 pm
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?
Re: ExplorerTreeGadget color
Posted: Tue Dec 23, 2025 7:29 pm
by miso
Just for reference, on windows both code work with the colors. (I'm using 6.30 beta 6 x64, Win 10 tested.)
Re: ExplorerTreeGadget color
Posted: Fri Dec 26, 2025 6:36 pm
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
Re: ExplorerTreeGadget color
Posted: Fri Dec 26, 2025 8:30 pm
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
Re: ExplorerTreeGadget color
Posted: Sat Dec 27, 2025 9:58 am
by Wolfram
Here, under macOS 14.8.2, I can't see any problem.
Re: ExplorerTreeGadget color
Posted: Sat Dec 27, 2025 12:35 pm
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
Re: ExplorerTreeGadget color
Posted: Sat Dec 27, 2025 6:46 pm
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.