This difference is in the below code snippet in Delphi XE:
procedure TCustomRadioGroup.ReadState(Reader: TReader);So, what is the deal of above difference?
begin
FReading := True;
inherited ReadState(Reader);
FReading := False;
if HandleAllocated then //<--- Delphi 2007 has no this checking!!!
UpdateButtons;
end;
The difference is, because of the checking, in Delphi XE and later version, the radio buttons will not be created until the handle of the radio group is allocated. The handle is not allocated when the radio group is just created, which means when TRadioGroup.Create is called, the buttons are not created yet. So the code like the below which is similar to Evert Etienne’s sample will failed in Delphi XE as the controls is not nil but has no items at all:
procedure TForm1.FormCreate(Sender: TObject);It is mystery to me that why it is doing that checking in Delphi XE.
begin
…
TRadioButton(RadioGroup1.Controls[2]) …
…
end;
No comments:
Post a Comment