move initialization of control into InitializeWnd, do not use CreateWnd for that

git-svn-id: trunk@8242 -
This commit is contained in:
micha 2005-11-29 22:20:01 +00:00
parent d6a3529e61
commit 258a8704a3
2 changed files with 7 additions and 11 deletions

View File

@ -648,6 +648,7 @@ type
procedure ItemKeyDown(Sender: TObject; var Key: Word; Shift: TShiftState);
procedure ItemResize(Sender: TObject);
protected
procedure InitializeWnd; override;
procedure UpdateRadioButtonStates; virtual;
procedure ReadState(Reader: TReader); override;
procedure SetItem(Value: TStrings);
@ -660,7 +661,6 @@ type
constructor Create(TheOwner: TComponent); override;
destructor Destroy; override;
function CanModify: boolean; virtual;
procedure CreateWnd; override;
function Rows: integer;
public
property AutoFill: Boolean read FAutoFill write SetAutoFill;

View File

@ -92,27 +92,27 @@ begin
end;
{------------------------------------------------------------------------------
Method: TCustomRadioGroup.CreateWnd
Method: TCustomRadioGroup.InitializeWnd
Params: none
Returns: Nothing
Create the visual component of the Radiogroup.
------------------------------------------------------------------------------}
procedure TCustomRadioGroup.CreateWnd;
procedure TCustomRadioGroup.InitializeWnd;
var
i : integer;
temp : TRadioButton;
begin
if FCreatingWnd then exit;
FCreatingWnd := true;
//DebugLn('[TCustomRadioGroup.CreateWnd] A ',Name,':',ClassName,' FItems.Count=',FItems.Count,' HandleAllocated=',HandleAllocated,' ItemIndex=',ItemIndex);
//DebugLn('[TCustomRadioGroup.InitializeWnd] A ',Name,':',ClassName,' FItems.Count=',FItems.Count,' HandleAllocated=',HandleAllocated,' ItemIndex=',ItemIndex);
// destroy radiobuttons, if there are too many
while FButtonList.Count>FItems.Count do begin
TRadioButton(FButtonList[FButtonList.Count-1]).Free;
FButtonList.Delete(FButtonList.Count-1);
end;
//DebugLn('[TCustomRadioGroup.CreateWnd] B ',Name,':',ClassName,' FItems.Count=',FItems.Count,' HandleAllocated=',HandleAllocated);
//DebugLn('[TCustomRadioGroup.InitializeWnd] B ',Name,':',ClassName,' FItems.Count=',FItems.Count,' HandleAllocated=',HandleAllocated);
// create as many TRadioButton as needed
while (FButtonList.Count<FItems.Count) do begin
@ -137,13 +137,9 @@ begin
end;
end;
//DebugLn('[TCustomRadioGroup.CreateWnd] C ',Name,':',ClassName,' FItems.Count=',FItems.Count,' HandleAllocated=',HandleAllocated);
//DebugLn('[TCustomRadioGroup.InitializeWnd] C ',Name,':',ClassName,' FItems.Count=',FItems.Count,' HandleAllocated=',HandleAllocated);
if (FItemIndex>=FItems.Count) then FItemIndex:=FItems.Count-1;
//DebugLn('[TCustomRadioGroup.CreateWnd] D ',Name,':',ClassName,' ',FItems.Count);
inherited CreateWnd;
//DebugLn('[TCustomRadioGroup.CreateWnd] E ',Name,':',ClassName,' ',FItems.Count,' ',FButtonList.Count);
if FItems.Count>0 then begin
for i:=0 to FItems.Count-1 do begin
Temp := TRadioButton(FButtonList[i]);
@ -167,7 +163,7 @@ begin
FHiddenButton.Checked:=(fItemIndex=-1);
UpdateTabStops;
end;
//DebugLn('[TCustomRadioGroup.CreateWnd] F ',Name,':',ClassName,' FItems.Count=',FItems.Count,' HandleAllocated=',HandleAllocated,' ItemIndex=',ItemIndex);
//DebugLn('[TCustomRadioGroup.InitializeWnd] F ',Name,':',ClassName,' FItems.Count=',FItems.Count,' HandleAllocated=',HandleAllocated,' ItemIndex=',ItemIndex);
FCreatingWnd := false;
end;