[Okta Webinar] Learn how to a build a cloud-first strategyRegister Now

x
  • Status: Solved
  • Priority: Medium
  • Security: Public
  • Views: 265
  • Last Modified:

highlighting

How do you change the background color of highlighted text in an Edit Box?  Something like Edit1.HIGHLIGHT_Color := clWhite.  It must be easy, but I can't find the answer.
Thanks.
0
ajax052397
Asked:
ajax052397
  • 2
  • 2
1 Solution
 
slpCommented:
AFAIK, this depends on what color settings the USER has set for "Selected Items" (Win95) or the Hilight= and HilightText= settings in WIN.INI (Win3.1).  I don't recommend changing these without a VERY GOOD reason, it's very unfriendly for your program to presume to change this since it has global implications.  

That being said, you can use the GetSysColor() API to retrieve and the SetSysColors() API to change these.

SLP

0
 
ajax052397Author Commented:
So the direct answer is you can't do it thru Delphi without creating a descendant to the EditBox, and then use an API call
whenever it's selected?  Any idea how the routine would look with the API call?  Sorry, but I'm trying to get the hang of Delphi.

0
 
slpCommented:
Basically you'd have to do your own custom selection drawing to get colors other than the ones set in the system, which is doable but not especially easy.  Perhaps we're going about this the wrong way; what is the need for having selection colors other than the default?  Maybe there's some other way of going about this.
0
 
ajax052397Author Commented:
You are right, especially since it's not all that easy.  I had hoped there was a hidden Delphi routine that would be pretty
straightforward.  Thanks for responding, and I appreciate your helpful advice.  (I hope this experts-exchange thing works out.)
0

Featured Post

Concerto Cloud for Software Providers & ISVs

Can Concerto Cloud Services help you focus on evolving your application offerings, while delivering the best cloud experience to your customers? From DevOps to revenue models and customer support, the answer is yes!

Learn how Concerto can help you.

  • 2
  • 2
Tackle projects and never again get stuck behind a technical roadblock.
Join Now