selection display in Editorgadget in Windows

Just starting out? Need help? Post your questions and find answers here.
User avatar
a_carignan
User
User
Posts: 98
Joined: Sat Feb 21, 2009 2:01 am
Location: Canada

selection display in Editorgadget in Windows

Post by a_carignan »

Good morning,
Is there an easy way to change the text selection display in Editorgadget in Windows?
boddhi
Enthusiast
Enthusiast
Posts: 524
Joined: Mon Nov 15, 2010 9:53 pm

Re: selection display in Editorgadget in Windows

Post by boddhi »

Hello,

This topic and SendMessage_(GadgetID(X),#EM_REPLACESEL, 0,@String) use can do the job.
If my English syntax and lexicon are incorrect, please bear with Google translate and DeepL. They rarely agree with each other!
Except on this sentence...
boddhi
Enthusiast
Enthusiast
Posts: 524
Joined: Mon Nov 15, 2010 9:53 pm

Re: selection display in Editorgadget in Windows

Post 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 
If my English syntax and lexicon are incorrect, please bear with Google translate and DeepL. They rarely agree with each other!
Except on this sentence...
User avatar
a_carignan
User
User
Posts: 98
Joined: Sat Feb 21, 2009 2:01 am
Location: Canada

Re: selection display in Editorgadget in Windows

Post 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. :?
boddhi
Enthusiast
Enthusiast
Posts: 524
Joined: Mon Nov 15, 2010 9:53 pm

Re: selection display in Editorgadget in Windows

Post 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, ?
If my English syntax and lexicon are incorrect, please bear with Google translate and DeepL. They rarely agree with each other!
Except on this sentence...
User avatar
a_carignan
User
User
Posts: 98
Joined: Sat Feb 21, 2009 2:01 am
Location: Canada

Re: selection display in Editorgadget in Windows

Post by a_carignan »

The color of the selection highlight box.
boddhi
Enthusiast
Enthusiast
Posts: 524
Joined: Mon Nov 15, 2010 9:53 pm

Re: selection display in Editorgadget in Windows

Post 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?
If my English syntax and lexicon are incorrect, please bear with Google translate and DeepL. They rarely agree with each other!
Except on this sentence...
User avatar
a_carignan
User
User
Posts: 98
Joined: Sat Feb 21, 2009 2:01 am
Location: Canada

Re: selection display in Editorgadget in Windows

Post by a_carignan »

I want to change the appearance of the text selection.
https://1drv.ms/i/s!Atmzt_kAwqmYtPAhj3p ... A?e=EGSPS4
boddhi
Enthusiast
Enthusiast
Posts: 524
Joined: Mon Nov 15, 2010 9:53 pm

Re: selection display in Editorgadget in Windows

Post 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.
If my English syntax and lexicon are incorrect, please bear with Google translate and DeepL. They rarely agree with each other!
Except on this sentence...
User avatar
a_carignan
User
User
Posts: 98
Joined: Sat Feb 21, 2009 2:01 am
Location: Canada

Re: selection display in Editorgadget in Windows

Post 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 :)
Post Reply