Read Only Text Controls ; Article No. 3

by Ian Roberts - GUI Computing

As part of a recent project I had to build an entry form that, depending on the status of the record that was being displayed, various text controls had to be disabled.

All editable controls were to have the standard windows background and foreground colours, and non-editable controls were to have a grey background and standard foreground. Non-editable controls also were not to get focus and be skipped over in the tab sequence.

I know I could have used labels for the non-editable controls but that meant two controls for every field, and setting the visible property according to which control I wanted displayed. Effective but it can become a mess. Another way was to set enabled to false for non-editable, but that set the forecolour to grey and made the text disappear when the back colour was set, not the desired result. A third party text control some kind may have done the job but for the fact that I was extending an already existing app and adding more controls was not really encouraged.

The final option and the one I used was the sendmessage API, as documented by Stephan Grieger in our last issue.


Written by: Ian Roberts
Oct 95



[HOME] [TABLE OF CONTENTS] [SEARCH]