LCL: TTabControl: Fixed AV on creating control. Issue #32455.

git-svn-id: trunk@55892 -
This commit is contained in:
michl 2017-09-22 09:33:02 +00:00
parent de2ecafa18
commit 240f1fb4dd
2 changed files with 14 additions and 7 deletions

View File

@ -499,8 +499,6 @@ type
property TabHeight: Smallint read FTabHeight write SetTabHeight default 0;
property TabPosition: TTabPosition read FTabPosition write SetTabPosition default tpTop;
property TabWidth: Smallint read FTabWidth write SetTabWidth default 0;
published
property TabStop default true;
end;
{ TTabSheet }
@ -625,7 +623,7 @@ type
property TabIndex;
property TabOrder;
property TabPosition;
property TabStop;
property TabStop default true;
property TabWidth;
property Visible;
property OnChange;
@ -817,6 +815,7 @@ type
procedure Change; override;
procedure CreateWnd; override;
procedure DestroyHandle; override;
procedure GetTabOrderList(List: TFPList); override;
procedure Notification(AComponent: TComponent; Operation: TOperation); override;
procedure SetDragMode(Value: TDragMode); override;
procedure SetTabIndex(Value: Integer); virtual;
@ -862,7 +861,7 @@ type
property TabHeight: Smallint read FTabHeight write SetTabHeight default 0;
property TabIndex: Integer read GetTabIndex write SetTabIndex default -1;
property Tabs: TStrings read FTabs write SetTabs;
property TabStop: Boolean read GetTabStop write SetTabStop default true; // workaround, see #30305
property TabStop default true;
property TabWidth: Smallint read FTabWidth write SetTabWidth default 0;
//
property Align;

View File

@ -534,7 +534,8 @@ end;
procedure TTabControl.SetTabStop(AValue: Boolean);
begin
TTabControlNoteBookStrings(FTabs).NoteBook.TabStop := AValue;
if Assigned(FTabs) then
TTabControlNoteBookStrings(FTabs).NoteBook.TabStop := AValue;
end;
procedure TTabControl.SetTabWidth(AValue: Smallint);
@ -604,6 +605,14 @@ begin
EndUpdate;
end;
procedure TTabControl.GetTabOrderList(List: TFPList);
begin
// just the TTabControlNoteBookStrings not the container should be tabable, see issue #32455
List.Remove(Self);
if Assigned(FTabs) then
List.Add(TTabControlNoteBookStrings(FTabs).NoteBook);
end;
procedure TTabControl.Notification(AComponent: TComponent;
Operation: TOperation);
begin
@ -754,8 +763,7 @@ begin
FImageChangeLink := TChangeLink.Create;
FImageChangeLink.OnChange := @ImageListChange;
FTabs := CreateTabNoteBookStrings;
TWinControl(Self).TabStop := False; // workaround, see #30305
TTabControlNoteBookStrings(FTabs).NoteBook.TabStop := True;
TabStop := True;
with GetControlClassDefaultSize do
SetInitialBounds(0, 0, CX, CY);
BorderWidth:=0;