Re: UI design problem - exclusive checkboxes



Jon Shemitz wrote:

I know this is a DELPHI forum, but I'm a lot more familiar with .NET
these days (for obvious reasons).

Well, those two things aren't mutually exclusive, so you could've had
the courtesy of converting it first <vbg>

procedure TJonsForm.RadioButton_Click(Sender: TObject; E: EventArgs);
var
Button: RadioButton;
C: Control;
Peer: RadioButton;
begin
Button := RadioButton(Sender);
Button.Checked := not Button.Checked;
if Button.Checked then
for C in Button.Parent.Controls do
begin
Peer := C as RadioButton;
if Assigned(Peer) and (Peer <> Button) then
Peer.Checked := False;
end;
end;

There is also a fault with the logic, as when this event is called the
RadioButton.Checked property has already been updated, so the above
code toggles whatever the user really intended. Now *thats* an
unintuitive UI :-)

--
Cheers,
David Clegg
dclegg@xxxxxxxxx
http://cc.borland.com/Author.aspx?ID=72299

QualityCentral. The best way to bug Borland about bugs.
http://qc.borland.com

"Marge, your paintings look like the things they look like." - Homer
Simpson.
.


Quantcast