I tried to Add TCustomCheckBox a published Readonly property
wich checks and sets ClicksDisabled ... but it didn't work...
yosi
procedure SetChecked(Value: Boolean); override;
procedure GetChecked(Value: Boolean); override;
Yosi Taguri <yo...@writeme.com> wrote in message
news:7peqrc$27...@forums.borland.com...
Why do you want to do that? Anyway here's a simple solution. Have two global
variables.. FChecked and FEnabled (boolean). When you want to stop the user
changing the value of the checkbox but not disable it set the FChecked
variable to the value you want (either checked or unchecked) and then the
FEnabled value to false.
Put this code in the CheckBox1Click procedure:
if not FEnabled then
checkbox1.checked := FChecked;
-- Raj
--
~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
Parampreet Sidhu (Programmer Consultant)
CITYPRO International Ltd, 107-112 Leadenhall Street, London, UK
Tel: +44 171 891 2466 Fax: +44 171 891 2467
email: psi...@citypro.com
~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
Yosi Taguri escribió en mensaje <7peqrc$27...@forums.borland.com>...
Ing. Víctor M. Ojeda Valiente <voj...@uaa.edu.py> wrote in message
news:7ph25b$4k...@forums.borland.com...
>how can I make it them Readonly without making them Enable:=False
Override the Toggle method of TCheckBox. In Toggle, exit if the
control is in a readonly state, otherwise call inherited.
Regards,
D.B.
> how can I make it them Readonly without making them Enable:=False
>
> I tried to Add TCustomCheckBox a published Readonly property
> wich checks and sets ClicksDisabled ... but it didn't work...
>
> yosi
How about putting it on a panel and disabling the panel?
Chris.
also the toggle works...
thnks...
procedure TCustomCheckBox.SetChecked(Value: Boolean);
begin
if not FReadOnly then
if Value then State := cbChecked else State := cbUnchecked;
end;
OR
procedure TCustomCheckBox.Toggle;
begin
if FreadOnly then Exit;
case State of
cbUnchecked:
if AllowGrayed then State := cbGrayed else State := cbChecked;
cbChecked: State := cbUnchecked;
cbGrayed: State := cbChecked;
end;
end;
yosi
David Baer <db...@speartechnologies.com> wrote in message
news:37bc215f...@forums.borland.com...
> Yosi,
>
> >how can I make it them Readonly without making them Enable:=False
>