Solved

highlighting

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

Gigs: Get Your Project Delivered by an Expert

Select from freelancers specializing in everything from database administration to programming, who have proven themselves as experts in their field. Hire the best, collaborate easily, pay securely and get projects done right.

Question has a verified solution.

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

Suggested Solutions

Title # Comments Views Activity
Create Database on Android via Delphi dbExpress 3 88
Magic Software info 18 130
Firemonkey webbrowser scrollbars ? 1 38
Sending files from  idTcpServer Socket to idTcpClient 2 39
Objective: - This article will help user in how to convert their numeric value become words. How to use 1. You can copy this code in your Unit as function 2. than you can perform your function by type this code The Code   (CODE) The Im…
In this tutorial I will show you how to use the Windows Speech API in Delphi. I will only cover basic functions such as text to speech and controlling the speed of the speech. SAPI Installation First you need to install the SAPI type library, th…
The Email Laundry PDF encryption service allows companies to send confidential encrypted  emails to anybody. The PDF document can also contain attachments that are embedded in the encrypted PDF. The password is randomly generated by The Email Laundr…
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…

808 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