[Lazarus] disabled vs readonly TDatetimeEd

svaa svaa at ciberpiula.net
Sun Feb 24 03:07:47 CET 2008


Hi:
(Just a little off topic about TDatetimeEd)

After deep  thoughts about how I use readonly and enabled;-) I have 
Concluded this:
enabled:=false > Invisible
readonly:=true > Label

Enabled
When I set a control to enabled:=false, it's because i think the user 
shouldn't  see or care about that control. A common use is speedbuttons 
. Some times depending upon some selection, some controls  have no 
sense, i.e.some checks or radio buttons disable other controls. For all 
purposes those controls could be invisible. Why do I disable them 
instead of setting visible:=false? Most times because there would be a 
lot of ugly blank spaces (or in autoaligns would move other controls, 
confusing the user), some times because I'm waiting some data before 
letting the user fill the disabled controls, and it's not bad to let 
user see whats going on.

Readonly
I could say that most times I should use a label but I am too lazy. I 
have made a form to input data, and I want to reuse the same form to 
display the data. Some times there are controls that I want dynamically 
set to readonly, contrary to disable the controls, the information shown 
is relevant for the user, but I don't want him to change it. The only 
difference with a label is that it looks like a control, so the user 
knows that in some circumstances he could change the data.

That is what I want to do, but things are not always that easy and clear 
. When there are controls readonly and not readonly in a form, they look 
the same so it's confusing for the user. To prevent this, sometimes I  
change the background to the form's backgound, others I replace it 
dynamically with label, other times I don't set it readonly but when the 
user tries to change it I pop message saying why he can't change it. I 
have seen (but I don't like) chekbuttons disabled, because they must be 
checked or unchecked compulsorily. I think it is not a good idea, if it 
is disabled the user could skip it as irrelevant.

Of course, it would be handy a way to show clearly that it is not 
editable. Unfortunately, most GUI lack of such concept, so we would have 
to come out with something new, that is seldom a good idea when talking 
about interfaces. If it is not a very clear "metaphor" instead of 
helping the user we will confuse him.

Just my 0.10 cents.

Santiago A.



More information about the Lazarus mailing list