The Unofficial Newsletter of Delphi Users - by Robert
Vivrette
Give Your Editbox Some Attention!
by Herbert J. Beemster - HerbertJB@compuserve.com
Did you ever see an application with many editboxes on the screen, and was it easy to detect where the caret was? Which editbox had the focus? Ofcourse, when you move around with the tab-key you'll see the selected text in the editbox, that is: if there is text! When you click on an editbox, you only see the caret blinking.
I figured that there must be a beter way to show where you are! As you'll probably know a TEdit component has a property called BorderStyle with two values: bsSingle and bsNone. If you toggle between these values in the Object Inspector, you'll notice that there is a rectangle at the border of the editbox. In the descendant of TEdit I added two extra properties: BorderColor and BorderFocusColor. With BorderColor you can change the default clWindowFrame to any fancy color you like and with BorderFocusColor you'll be able to set the color of the border when the editbox has the focus.
In the Test project you can check it out. You don't have to install THJBEdit first because the program creates instances on the fly.
It's all freeware, enjoy! Click here for the source code.