[Lazarus] Opinions required on what the ReadOnly property should do for LCL controls.

Inoussa OUEDRAOGO inoussa12 at gmail.com
Fri Feb 22 04:01:03 CET 2008


2008/2/22, John <jszcmpr at netspace.net.au>:
>
>  svaa wrote:
>  Hello:
>
> For me there is no doubt. When I set a control as readonly, I expect
> that the user won't be able to change it at all.
>
> In fact, years ago I hacked rxlib to avoid pop a list when they where
> readonly. Particulary if they are attached to a database, it's confusing
> for the user to change it clicking the button but updating nothing. The
> downside is that they won't be able to show the calendar, but I think it
> is better than confusing user. If the popped calendar could show clearly
> that is not changeable, it would be the best, but a low priority
> enhacement. By the way, when I say TDateTimeEdit, I mean any control
> with a combo etc.
>
> Anyhow, if you want people see that a control is not usable, it is
> better to assign enable:=false. The pity of disabled controls it that
> they are not easily readable.
>
> Sometimes I think that there should be three colors to inform the user
> of the state of the control: enabled, disabled and readonly. Long time
> ago I played with the idea of changing the Dataware controls to have a
> yellow background when they where not editable (because they were
> readonly or because the TDatasource was not autoedit or because the
> underlaying table was readonly.)
>
> Just my 0.25 cents.
>
> Reagards
> Santiago A.
>
>  +1
>
>  I usually change the colour or background colour of a control if it
> *always* readonly, it would be great to have an easy way to do it.  I
> probably tend to disable a control if its mode changes, but it can still be
> useful to distinguish between "valid, but read only" and "invalid in this
> context".
>
>  I think the difference between the two views depends on whether you see the
> TDateEdit as two controls ( in which case I agree with Vincent) or a single
> control, in which case I agree with Gerard.
>
>  If it were two controls, you make the edit box readonly (to keystrokes),
> but the button is changing it programatically.  But if it is a single
> control, readonly = readonly = readonly - no user changes of any kind.
>
>  As it appears to only a single control - you can't disable the button
> without disabling the whole control - I think I have to agree with Gerard
>
>  cheers,
>  John Sunderland
>
>
>
>
>
>  There's a discussion going on about TDateTimeEdit.ReadOnly in Mantis
> report 10861.
> It's not a technical discussion, it's more about what ReadOnly should
> and shouldn't do.
>
> See. http://bugs.freepascal.org/view.php?id=10861
>
> The list is probably a better place to discuss this, so please read
> the report and give your opinion here.

IMHO, whenever "ReadOnly=True", user should not be able to modify the
value, be it by
 the text edit or by the button. I use code like
[code]
for i := 0 to Pred(ContrloCount) do begin
  ct := Control[i];
  if IsPublishedProp(ct,'ReadOnly') then
    SetProp(ct,'ReadnOnly',False);
end;
[/code]
to be sure the user cannot modify any value.
Example  : On a Edit form, I want the user to be able to modify
certain properties ( "color of your car") depending on the value of
other properties ( "Own a car" ).

I second the idea of a "DirectEdit" property.

Best regards.
-- 
Inoussa O.



More information about the Lazarus mailing list