BedouinDN
asked on
Read Only Checkbox
Hi all.
Hopefully this is an easy question..
I am writing an application that displays the status of true false attributes of an account using check boxes on a form.
I do not want the users to be able to uncheck - re-check the check boxes, but do not want the checkboxes to appear disabled as they tend to blend in with the form and look crappy.. (Technical term).
Is there a way to make the check boxes read only, or is there another check box component I can use for this??
Hopefully this is an easy question..
I am writing an application that displays the status of true false attributes of an account using check boxes on a form.
I do not want the users to be able to uncheck - re-check the check boxes, but do not want the checkboxes to appear disabled as they tend to blend in with the form and look crappy.. (Technical term).
Is there a way to make the check boxes read only, or is there another check box component I can use for this??
ASKER CERTIFIED SOLUTION
membership
This solution is only available to members.
To access this solution, you must be a member of Experts Exchange.
My solution to every problem is TPanel :)
Place CheckBoxes on a TPanel and set
Panel1.Enabled := False;
That's all
ASKER
Have accepted Shanes answer as I will be using this a lot and so will create a new derived Checkbox, Mokule - Your answer works beautifully and I will use yours for now until I get the time to create. Please look for "Points for Mokule" in the list for the same amount of points..
Steveaish, I have tried to do this but ended up in an endless loop until stack overflow - Seems setting the checked value calls the OnCLick method.. :-(
Thanks again guys..
Colin.
Steveaish, I have tried to do this but ended up in an endless loop until stack overflow - Seems setting the checked value calls the OnCLick method.. :-(
Thanks again guys..
Colin.
Why You don't like TPanel :(
ASKER
Beat ya..
:-)
:-)
Ooops. And yet You like it also. Thanks :))
I was too fast.
I was too fast.
I like Mokule solution as well, i may use that in the future for speediency.... <SMILE>
Shane
Shane
Wow :)
type
TForm1 = class(TForm)
CheckBox1: TCheckBox;
procedure FormCreate(Sender: TObject);
private
Check1Checked : Boolean;
when you make your checkbox checked or unchecked also set this variable (Check1Checked := Checkbox1.Checked)
in the OnClick event of the Checkbox
procedure TForm1.CheckBox1Click(Send
begin
if Checkbox1.Checked <> Check1Checked then
begin
Checkbox1.Checked := Check1Checked;
end;
end;