Welcome to Experts Exchange

Add your voice to the tech community where 5M+ people, just like you, are talking about what matters.

  • Help others & share knowledge
  • Earn cash & points
  • Learn & ask questions
Solved

highlighting

Posted on 1997-05-23
4
256 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

Free Tool: Subnet Calculator

The subnet calculator helps you design networks by taking an IP address and network mask and returning information such as network, broadcast address, and host range.

One of a set of tools we're offering as a way of saying thank you for being a part of the community.

Question has a verified solution.

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

Have you ever had your Delphi form/application just hanging while waiting for data to load? This is the article to read if you want to learn some things about adding threads for data loading in the background. First, I'll setup a general applica…
In my programming career I have only very rarely run into situations where operator overloading would be of any use in my work.  Normally those situations involved math with either overly large numbers (hundreds of thousands of digits or accuracy re…

828 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