Page 1 of 1
selection display in Editorgadget in Windows
Posted: Fri May 31, 2024 7:36 am
by a_carignan
Good morning,
Is there an easy way to change the text selection display in Editorgadget in Windows?
Re: selection display in Editorgadget in Windows
Posted: Fri May 31, 2024 9:19 am
by boddhi
Hello,
This topic and SendMessage_(GadgetID(X),#EM_REPLACESEL, 0,@String) use can do the job.
Re: selection display in Editorgadget in Windows
Posted: Fri May 31, 2024 9:43 am
by boddhi
A quick example:
Code: Select all
If OpenWindow(0, 0, 0, 322, 200, "EditorGadget", #PB_Window_SystemMenu | #PB_Window_ScreenCentered)
EditorGadget(0, 8, 8, 306, 133,#PB_Editor_WordWrap)
SetGadgetText(0,"Lorem ipsum dolor sit amet, consectetur adipiscing elit, sed do eiusmod tempor incididunt ut labore et dolore magna aliqua."+
" Ut enim ad minim veniam, quis nostrud exercitation ullamco laboris nisi ut aliquip ex ea commodo consequat. Duis aute irure dolor in reprehenderit in voluptate velit esse cillum dolore eu fugiat nulla pariatur."+
" Excepteur sint occaecat cupidatat non proident, sunt in culpa qui officia deserunt mollit anim id est laborum.")
ButtonGadget(1, 8, 160, 306, 20, "Change text")
SendMessage_(GadgetID(0), #EM_SETSEL, 28, 39)
Repeat
If WaitWindowEvent()=#PB_Event_Gadget And EventGadget()=1 And EventType()=#PB_EventType_LeftClick
SendMessage_(GadgetID(0), #EM_SETSEL, 28, 39)
SendMessage_(GadgetID(0), #EM_REPLACESEL, 0, @"New text")
EndIf
Until WaitWindowEvent() = #PB_Event_CloseWindow
EndIf
Re: selection display in Editorgadget in Windows
Posted: Tue Jun 04, 2024 9:15 pm
by a_carignan
Oops, I'm not talking about how to select text. I'm talking about how to change text highlighting when selected. Sorry for my mistake.

Re: selection display in Editorgadget in Windows
Posted: Tue Jun 04, 2024 9:25 pm
by boddhi
a_carignan wrote:
change text highlighting when selected.
Be more explicit. What do you want to change? Color, text (for this see my code), position, ?
Re: selection display in Editorgadget in Windows
Posted: Tue Jun 04, 2024 10:41 pm
by a_carignan
The color of the selection highlight box.
Re: selection display in Editorgadget in Windows
Posted: Tue Jun 04, 2024 11:10 pm
by boddhi
a_carignan wrote:
The color of the selection highlight box.
Box? What do you mean by box? Can you give a little code with comments?
Re: selection display in Editorgadget in Windows
Posted: Wed Jun 05, 2024 4:43 am
by a_carignan
I want to change the appearance of the text selection.
https://1drv.ms/i/s!Atmzt_kAwqmYtPAhj3p ... A?e=EGSPS4
Re: selection display in Editorgadget in Windows
Posted: Wed Jun 05, 2024 10:18 am
by boddhi
If I've understood correctly, it's a question of changing the background color used when selecting text.
However, I don't think this is only possible for a gadget. It's a system color. So changing this color will apply to the whole system.
Re: selection display in Editorgadget in Windows
Posted: Wed Jun 12, 2024 11:58 pm
by a_carignan
Yes, that's right, I want to change the color of the selected text. Too bad it's not a gadget attribute.

THANKS
