About   -   Contact   -   Purchase   -   Search   -   What's New

Indicating Focus to the User
This tip was sent in by Alexander Shender.

You probably noticed that whenever a control gets focus there are changes in its appearance i.e. a focus rectangle for command buttons, check boxes, radio buttons, vertical scrollbar in Multiline edit etc.

The most commonly used control the Datawindow in its most commonly used form w/o title bar does not have a clear automatic way to indicate that it has focus. If you have window with two Datawindows it is very difficult to tell which one has focus if you lost count of how many times you pressed tab. Well, this problem has a rather elegant solution. Place the following code in Datawindow control:

Getfocus event:     this.BorderStyle = StyleRaised!
Losefocus event:    this.BorderStyle = StyleLowered!

Now this control will change to raised border whenever it would get focus and back to lowered border when focus is lost. I recommend that you put this code in your framework to get consistent behavior across your application.


Top of Page

Legal Notice

Ken Howe 2011