Solved

highlighting

Posted on 1997-05-23
4
257 Views
Last Modified: 2010-04-04
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
Comment
Question by:ajax052397
  • 2
  • 2
4 Comments
 
LVL 1

Accepted Solution

by:
slp earned 50 total points
ID: 1336563
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
 

Author Comment

by:ajax052397
ID: 1336564
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
 
LVL 1

Expert Comment

by:slp
ID: 1336565
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
 

Author Comment

by:ajax052397
ID: 1336566
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

Technology Partners: We Want Your Opinion!

We value your feedback.

Take our survey and automatically be enter to win anyone of the following:
Yeti Cooler, Amazon eGift Card, and Movie eGift Card!

Question has a verified solution.

If you are experiencing a similar issue, please ask a related question

Suggested Solutions

The uses clause is one of those things that just tends to grow and grow. Most of the time this is in the main form, as it's from this form that all others are called. If you have a big application (including many forms), the uses clause in the in…
Introduction Raise your hands if you were as upset with FireMonkey as I was when I discovered that there was no TListview.  I use TListView in almost all of my applications I've written, and I was not going to compromise by resorting to TStringGrid…
Email security requires an ever evolving service that stays up to date with counter-evolving threats. The Email Laundry perform Research and Development to ensure their email security service evolves faster than cyber criminals. We apply our Threat…
Finds all prime numbers in a range requested and places them in a public primes() array. I've demostrated a template size of 30 (2 * 3 * 5) but larger templates can be built such 210  (2 * 3 * 5 * 7) or 2310  (2 * 3 * 5 * 7 * 11). The larger templa…

679 members asked questions and received personalized solutions in the past 7 days.

Join the community of 500,000 technology professionals and ask your questions.

Join & Ask a Question