Solved

highlighting

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

How to run any project with ease

Manage projects of all sizes how you want. Great for personal to-do lists, project milestones, team priorities and launch plans.
- Combine task lists, docs, spreadsheets, and chat in one
- View and edit from mobile/offline
- Cut down on emails

Join & Write a Comment

A lot of questions regard threads in Delphi.   One of the more specific questions is how to show progress of the thread.   Updating a progressbar from inside a thread is a mistake. A solution to this would be to send a synchronized message to the…
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…
In this seventh video of the Xpdf series, we discuss and demonstrate the PDFfonts utility, which lists all the fonts used in a PDF file. It does this via a command line interface, making it suitable for use in programs, scripts, batch files — any pl…
Access reports are powerful and flexible. Learn how to create a query and then a grouped report using the wizard. Modify the report design after the wizard is done to make it look better. There will be another video to explain how to put the final p…

762 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

Need Help in Real-Time?

Connect with top rated Experts

18 Experts available now in Live!

Get 1:1 Help Now