The scenario
I have a reasonably complex form that is used for either data entry or for viewing with no editing allowed, depending upon a state variable (the colour and headings on the form change depending upon the state). It contains many panels containing data entry type components. When in the viewing (non editing) state these panels are set to disabled, so preventing any of the components they contain from being changed.
One panel contains four TRadioButtons and a memo box with scroll bars. Because of the amount of text in the memo I still want to be able to scroll the memo box when in view mode in order to read it all. However I do not want either the memo text or the radio buttons to be changed.
What I have tried
Instead of disabling the whole panel I leave it enabled and just make the memo box read only. This allows scrolling but not editing of the memobox as desired.
However as the panel is enabled it means the radiobuttons are also enabled and can be changed.
If I set the enabled property of each radiobutton to false I can prevent them being changed as desired but this also changes their appearance and greys them out.
Question
How can I prevent a user from changing the radiobuttons on this panel whilst keeping their appearance unchanged as if they are enabled i.e. without them greying out?
Minimal reproducible example
procedure TFrmMember.ShowMemberForm(MemberDisplayMode: TMemberDisplayType);
begin
case FormDisplayMode of
<other stuff in a big case statement depending upon MemberDisplayMode>
ShowNoEdit: begin
SetFormDisplay(ShowNoEdit); //set colours and titles etc
DisableAllControls; //disable all panels on the form
//now enable scrolling of the comment memo content but don't allow edits
PanelComment.Enabled := True; //enable the panel containing the memo and 4 radiobuttons
MemoComment.ReadOnly := True; //don't allow editing of the memo
//now disable the radio buttons -THIS CHANGES APPEARANCE ??
RadioButtonCircEmail.Enabled := False;
RadioButtonCircPost.Enabled := False;
RadioButtonCircBoth.Enabled := False;
RadioButtonCircNone.Enabled := False;
<other stuff>
end;
<other stuff in a big case statement depending upon MemberDisplayMode>
end; //case
end; //procedure ShowMemberForm
Place a TPanel
on the existing Panel and move the RadioButtons to this new Panel. Or, use a single TRadioGroup
instead of placing individual buttons on a Panel.
Then you can disable just the new Panel/Group, while keeping the parent Panel enabled and setting the TMemo
to read-only.