Question

When data is to be viewed only, I'm disabling the text boxes on the form.

But during this time, the text is not very readable as it's very light.

Is there a way to change the color of these textboxes instead of using the default colors for DISABLED objects?

Subsequently, I presume this will apply to all objects - list boxes, drop down combos, date inputs, etc., but for now it's only for the textboxes.

Thanks!

Was it helpful?

Solution

From my own question, the purpose of disabling text boxes was to leave them locked to prevent user changes. However, the disabled text boxes were not readable.

The solution is NOT to change the colour of dsabled objects but to leave it locked. And the easiest way of doing this is to just change the ReadOnly property to true. Thus when ever there's a need to lock a text box, I can set the property like this example.

MyTextBox.ReadOnly := True;

Now the control remains white or whatever other colour and at the same time it is not editable by the user.

Strange, how simple this was and I hadn't figured this out earlier :)

Licensed under: CC-BY-SA with attribution
Not affiliated with StackOverflow
scroll top