mirror of
https://gitlab.com/freepascal.org/lazarus/lazarus.git
synced 2025-08-16 19:09:19 +02:00
move initialization of control into InitializeWnd, do not use CreateWnd for that
git-svn-id: trunk@8242 -
This commit is contained in:
parent
d6a3529e61
commit
258a8704a3
@ -648,6 +648,7 @@ type
|
|||||||
procedure ItemKeyDown(Sender: TObject; var Key: Word; Shift: TShiftState);
|
procedure ItemKeyDown(Sender: TObject; var Key: Word; Shift: TShiftState);
|
||||||
procedure ItemResize(Sender: TObject);
|
procedure ItemResize(Sender: TObject);
|
||||||
protected
|
protected
|
||||||
|
procedure InitializeWnd; override;
|
||||||
procedure UpdateRadioButtonStates; virtual;
|
procedure UpdateRadioButtonStates; virtual;
|
||||||
procedure ReadState(Reader: TReader); override;
|
procedure ReadState(Reader: TReader); override;
|
||||||
procedure SetItem(Value: TStrings);
|
procedure SetItem(Value: TStrings);
|
||||||
@ -660,7 +661,6 @@ type
|
|||||||
constructor Create(TheOwner: TComponent); override;
|
constructor Create(TheOwner: TComponent); override;
|
||||||
destructor Destroy; override;
|
destructor Destroy; override;
|
||||||
function CanModify: boolean; virtual;
|
function CanModify: boolean; virtual;
|
||||||
procedure CreateWnd; override;
|
|
||||||
function Rows: integer;
|
function Rows: integer;
|
||||||
public
|
public
|
||||||
property AutoFill: Boolean read FAutoFill write SetAutoFill;
|
property AutoFill: Boolean read FAutoFill write SetAutoFill;
|
||||||
|
@ -92,27 +92,27 @@ begin
|
|||||||
end;
|
end;
|
||||||
|
|
||||||
{------------------------------------------------------------------------------
|
{------------------------------------------------------------------------------
|
||||||
Method: TCustomRadioGroup.CreateWnd
|
Method: TCustomRadioGroup.InitializeWnd
|
||||||
Params: none
|
Params: none
|
||||||
Returns: Nothing
|
Returns: Nothing
|
||||||
|
|
||||||
Create the visual component of the Radiogroup.
|
Create the visual component of the Radiogroup.
|
||||||
------------------------------------------------------------------------------}
|
------------------------------------------------------------------------------}
|
||||||
procedure TCustomRadioGroup.CreateWnd;
|
procedure TCustomRadioGroup.InitializeWnd;
|
||||||
var
|
var
|
||||||
i : integer;
|
i : integer;
|
||||||
temp : TRadioButton;
|
temp : TRadioButton;
|
||||||
begin
|
begin
|
||||||
if FCreatingWnd then exit;
|
if FCreatingWnd then exit;
|
||||||
FCreatingWnd := true;
|
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
|
// destroy radiobuttons, if there are too many
|
||||||
while FButtonList.Count>FItems.Count do begin
|
while FButtonList.Count>FItems.Count do begin
|
||||||
TRadioButton(FButtonList[FButtonList.Count-1]).Free;
|
TRadioButton(FButtonList[FButtonList.Count-1]).Free;
|
||||||
FButtonList.Delete(FButtonList.Count-1);
|
FButtonList.Delete(FButtonList.Count-1);
|
||||||
end;
|
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
|
// create as many TRadioButton as needed
|
||||||
while (FButtonList.Count<FItems.Count) do begin
|
while (FButtonList.Count<FItems.Count) do begin
|
||||||
@ -137,13 +137,9 @@ begin
|
|||||||
end;
|
end;
|
||||||
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;
|
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
|
if FItems.Count>0 then begin
|
||||||
for i:=0 to FItems.Count-1 do begin
|
for i:=0 to FItems.Count-1 do begin
|
||||||
Temp := TRadioButton(FButtonList[i]);
|
Temp := TRadioButton(FButtonList[i]);
|
||||||
@ -167,7 +163,7 @@ begin
|
|||||||
FHiddenButton.Checked:=(fItemIndex=-1);
|
FHiddenButton.Checked:=(fItemIndex=-1);
|
||||||
UpdateTabStops;
|
UpdateTabStops;
|
||||||
end;
|
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;
|
FCreatingWnd := false;
|
||||||
end;
|
end;
|
||||||
|
Loading…
Reference in New Issue
Block a user