Text Selection/Highlight Color for Editor or String Gadget
Text Selection/Highlight Color for Editor or String Gadget
I've found posts for changing the text selection/highlight color for EditorGadget and TextGadget on Windows. Is there any way to do this on MacOS?
Re: Text Selection/Highlight Color for Editor or String Gadg
MacBook Pro-M1 (2021), Sonoma 14.3.1 (CLT 15.3), PB 6.10b7 M1
Re: Text Selection/Highlight Color for Editor or String Gadg
or if you mean just changing which part of the text is selected (using the default highlight/selection color) see the last code snippet here https://purebasic.developpez.com/faq/?p ... ing-Gadget
Re: Text Selection/Highlight Color for Editor or String Gadg
I'm looking to change the HIGHLIGHT color when text in the editor or string gadget is SELECTED when we PRESS THE LEFT MOUSE BUTTON AND DRAG or when we PRESS THE SHIFT AND ARROW KEYS.
The Windows version done by Sparkie is here:
http://forums.purebasic.com/english/vie ... 6a#p215974
Could this be done in MacOS?
The Windows version done by Sparkie is here:
http://forums.purebasic.com/english/vie ... 6a#p215974
Could this be done in MacOS?
Re: Text Selection/Highlight Color for Editor or String Gadg
Something like this ?
Code: Select all
If OpenWindow(0, 0, 0, 322, 150, "EditorGadget", #PB_Window_SystemMenu | #PB_Window_ScreenCentered)
EditorGadget(0, 8, 8, 306, 133)
Attributes = CocoaMessage(0, 0, "NSDictionary dictionaryWithObject:",
CocoaMessage(0, 0, "NSColor orangeColor"),
"forKey:$", @"NSBackgroundColor")
CocoaMessage(0, GadgetID(0), "setSelectedTextAttributes:", Attributes)
For a = 0 To 5
AddGadgetItem(0, a, "Line "+Str(a))
Next
Repeat : Until WaitWindowEvent() = #PB_Event_CloseWindow
EndIf
Windows (x64)
Raspberry Pi OS (Arm64)
Raspberry Pi OS (Arm64)
Re: Text Selection/Highlight Color for Editor or String Gadg
EXACTLY! That did it!wilbert wrote:Something like this ?Code: Select all
If OpenWindow(0, 0, 0, 322, 150, "EditorGadget", #PB_Window_SystemMenu | #PB_Window_ScreenCentered) EditorGadget(0, 8, 8, 306, 133) Attributes = CocoaMessage(0, 0, "NSDictionary dictionaryWithObject:", CocoaMessage(0, 0, "NSColor orangeColor"), "forKey:$", @"NSBackgroundColor") CocoaMessage(0, GadgetID(0), "setSelectedTextAttributes:", Attributes) For a = 0 To 5 AddGadgetItem(0, a, "Line "+Str(a)) Next Repeat : Until WaitWindowEvent() = #PB_Event_CloseWindow EndIf
Thank you wilbert. You're my savior.