> Instead of using Enabled use ReadOnly, Color and Font.Color.
>
> This also allows the user to select the text from the edit, or combo but
> they can't change it.
>
> If you don't want to go "if Blah is TWhatever then begin" for all
components
> that support ReadOnly take a look at SetOrdinalProperty with uses RTTI to
> decide if a component has the ReadOnly property.
>
> eg. SetOrdinalProperty(PComponent, 'ReadOnly', System.TypeInfo(Boolean),
> Integer(False));
>
> I believe that this is fairly slow though and shouldn't be used in tight
> loops.
>
> Stacey
>
This is a possibility and is in fact what I was doing in a limited number of
cases where an edit box absolutely had to look grey. However I would prefer
to do it through SetEnabled because it is a little cleaner. For example you
also need to turn off TabStop if you do it the ReadOnly etc way. Then of
course when you enable the control again you need to remember whether it
should have TabStop set (either by storing the old value or handling it in
GetTabStop). You also have the problem that the user can still click in a
control which is ReadOnly, which they wouldn't be able to do if it was
correctly disabled.
Of course if I can't work out how to do it through SetEnabled then I may end
up going back to ReadOnly etc.
Thanks,
David.
---------------------------------------------------------------------------
New Zealand Delphi Users group - Delphi List - [EMAIL PROTECTED]
Website: http://www.delphi.org.nz
To UnSub, send email to: [EMAIL PROTECTED]
with body of "unsubscribe delphi"