mirror of
https://gitlab.com/freepascal.org/lazarus/lazarus.git
synced 2025-08-18 03:39:21 +02:00
TPageControl: AutoSizing is now delayed until page handle was added to the parent handle
git-svn-id: trunk@9635 -
This commit is contained in:
parent
8b1f47f873
commit
1ecaec575c
@ -110,7 +110,7 @@ type
|
|||||||
function IndexOf(ARelation: TKeyCommandRelation): integer;
|
function IndexOf(ARelation: TKeyCommandRelation): integer;
|
||||||
function CommandToShortCut(ACommand: word): TShortCut;
|
function CommandToShortCut(ACommand: word): TShortCut;
|
||||||
function LoadFromXMLConfig(XMLConfig:TXMLConfig; const Prefix: String):boolean;
|
function LoadFromXMLConfig(XMLConfig:TXMLConfig; const Prefix: String):boolean;
|
||||||
function SaveToXMLConfig(XMLConfig:TXMLConfig; const Prefix: String):boolean;
|
function SaveToXMLConfig(XMLConfig:TXMLConfig; const Path: String):boolean;
|
||||||
procedure AssignTo(ASynEditKeyStrokes:TSynEditKeyStrokes;
|
procedure AssignTo(ASynEditKeyStrokes:TSynEditKeyStrokes;
|
||||||
IDEWindowClass: TCustomFormClass);
|
IDEWindowClass: TCustomFormClass);
|
||||||
procedure Assign(List: TKeyCommandRelationList);
|
procedure Assign(List: TKeyCommandRelationList);
|
||||||
@ -198,7 +198,7 @@ implementation
|
|||||||
|
|
||||||
|
|
||||||
const
|
const
|
||||||
KeyMappingFormatVersion = 3;
|
KeyMappingFormatVersion = 4;
|
||||||
|
|
||||||
VirtualKeyStrings: TStringHashList = nil;
|
VirtualKeyStrings: TStringHashList = nil;
|
||||||
|
|
||||||
@ -2475,7 +2475,7 @@ var a,b,p:integer;
|
|||||||
Result:=IntToStr(ShortcutA.Key1) + ',' + ShiftStateToStr(ShortcutA.Shift1) + ',' +
|
Result:=IntToStr(ShortcutA.Key1) + ',' + ShiftStateToStr(ShortcutA.Shift1) + ',' +
|
||||||
IntToStr(ShortcutB.Key1) + ',' + ShiftStateToStr(ShortcutB.Shift1);
|
IntToStr(ShortcutB.Key1) + ',' + ShiftStateToStr(ShortcutB.Shift1);
|
||||||
end;
|
end;
|
||||||
|
|
||||||
// LoadFromXMLConfig
|
// LoadFromXMLConfig
|
||||||
var
|
var
|
||||||
FileVersion: integer;
|
FileVersion: integer;
|
||||||
@ -2527,15 +2527,18 @@ begin
|
|||||||
end;
|
end;
|
||||||
|
|
||||||
function TKeyCommandRelationList.SaveToXMLConfig(
|
function TKeyCommandRelationList.SaveToXMLConfig(
|
||||||
XMLConfig:TXMLConfig; const Prefix: String):boolean;
|
XMLConfig:TXMLConfig; const Path: String):boolean;
|
||||||
var a,b: integer;
|
var a,b: integer;
|
||||||
Name: String;
|
Name: String;
|
||||||
CurKeyStr: String;
|
CurKeyStr: String;
|
||||||
DefaultKeyStr: string;
|
DefaultKeyStr: string;
|
||||||
TheKeyA, TheKeyB: TIDEShortCut;
|
TheKeyA, TheKeyB: TIDEShortCut;
|
||||||
|
//SavedCount: Integer;
|
||||||
|
//SubPath: String;
|
||||||
begin
|
begin
|
||||||
XMLConfig.SetValue(Prefix+'Version/Value',KeyMappingFormatVersion);
|
XMLConfig.SetValue(Path+'Version/Value',KeyMappingFormatVersion);
|
||||||
XMLConfig.SetDeleteValue(Prefix+'ExternalToolCount/Value',ExtToolCount,0);
|
XMLConfig.SetDeleteValue(Path+'ExternalToolCount/Value',ExtToolCount,0);
|
||||||
|
//SavedCount:=0;
|
||||||
for a:=0 to FRelations.Count-1 do begin
|
for a:=0 to FRelations.Count-1 do begin
|
||||||
Name:=lowercase(Relations[a].Name);
|
Name:=lowercase(Relations[a].Name);
|
||||||
for b:=1 to length(Name) do
|
for b:=1 to length(Name) do
|
||||||
@ -2545,9 +2548,16 @@ begin
|
|||||||
GetDefaultKeyForCommand(Command,TheKeyA,TheKeyB);
|
GetDefaultKeyForCommand(Command,TheKeyA,TheKeyB);
|
||||||
DefaultKeyStr:=KeyValuesToStr(TheKeyA, TheKeyB);
|
DefaultKeyStr:=KeyValuesToStr(TheKeyA, TheKeyB);
|
||||||
end;
|
end;
|
||||||
//debugln(['TKeyCommandRelationList.SaveToXMLConfig A ',Prefix+Name,' ',CurKeyStr=DefaultKeyStr]);
|
XMLConfig.SetDeleteValue(Path+Name+'/Value',CurKeyStr,DefaultKeyStr);
|
||||||
XMLConfig.SetDeleteValue(Prefix+Name+'/Value',CurKeyStr,DefaultKeyStr);
|
//debugln(['TKeyCommandRelationList.SaveToXMLConfig A ',Path+Name,' ',CurKeyStr=DefaultKeyStr]);
|
||||||
|
{if CurKeyStr<>DefaultKeyStr then begin
|
||||||
|
inc(SavedCount);
|
||||||
|
SubPath:=Path+'Item'+IntToStr(SavedCount);
|
||||||
|
XMLConfig.SetDeleteValue(SubPath+'/Name',Name,'');
|
||||||
|
XMLConfig.SetValue(SubPath+'/Value',CurKeyStr);
|
||||||
|
end;}
|
||||||
end;
|
end;
|
||||||
|
//XMLConfig.SetDeleteValue(Path+'KeyMap/Count',SavedCount,0);
|
||||||
Result:=true;
|
Result:=true;
|
||||||
end;
|
end;
|
||||||
|
|
||||||
|
@ -44,6 +44,7 @@ type
|
|||||||
|
|
||||||
TPageFlag = (
|
TPageFlag = (
|
||||||
pfAdded, // page handle added to notebook handle
|
pfAdded, // page handle added to notebook handle
|
||||||
|
pfAdding, // currently page handle adding to notebook handle
|
||||||
pfRemoving
|
pfRemoving
|
||||||
);
|
);
|
||||||
TPageFlags = set of TPageFlag;
|
TPageFlags = set of TPageFlag;
|
||||||
@ -69,6 +70,7 @@ type
|
|||||||
constructor Create(TheOwner: TComponent); override;
|
constructor Create(TheOwner: TComponent); override;
|
||||||
procedure AdjustClientRect(var ARect: TRect); override;
|
procedure AdjustClientRect(var ARect: TRect); override;
|
||||||
function CanTab: boolean; override;
|
function CanTab: boolean; override;
|
||||||
|
function AutoSizeDelayed: boolean; override;
|
||||||
function IsVisible: Boolean; override;
|
function IsVisible: Boolean; override;
|
||||||
function VisibleIndex: integer;
|
function VisibleIndex: integer;
|
||||||
property PageIndex: Integer read GetPageIndex write SetPageIndex;
|
property PageIndex: Integer read GetPageIndex write SetPageIndex;
|
||||||
|
@ -423,10 +423,11 @@ begin
|
|||||||
if fPageIndex = AValue then exit;
|
if fPageIndex = AValue then exit;
|
||||||
if not CanChangePageIndex then exit;
|
if not CanChangePageIndex then exit;
|
||||||
//debugln('TCustomNotebook.SetPageIndex B ',dbgsName(Self),' AValue=',dbgs(AValue),' fPageIndex=',dbgs(fPageIndex),' PageCount=',dbgs(PageCount),' HandleAllocated=',dbgs(HandleAllocated));
|
//debugln('TCustomNotebook.SetPageIndex B ',dbgsName(Self),' AValue=',dbgs(AValue),' fPageIndex=',dbgs(fPageIndex),' PageCount=',dbgs(PageCount),' HandleAllocated=',dbgs(HandleAllocated));
|
||||||
if not Page[AValue].TabVisible and not (csDesigning in ComponentState) then exit;
|
if Page[AValue].TabVisible or (csDesigning in ComponentState) then begin
|
||||||
fPageIndex := AValue;
|
fPageIndex := AValue;
|
||||||
UpdateAllDesignerFlags;
|
UpdateAllDesignerFlags;
|
||||||
DoSendPageIndex;
|
DoSendPageIndex;
|
||||||
|
end;
|
||||||
end;
|
end;
|
||||||
|
|
||||||
{------------------------------------------------------------------------------
|
{------------------------------------------------------------------------------
|
||||||
@ -510,8 +511,10 @@ begin
|
|||||||
if (not (csDestroying in APage.ComponentState))
|
if (not (csDestroying in APage.ComponentState))
|
||||||
and (APage.TabVisible or (csDesigning in ComponentState)) then begin
|
and (APage.TabVisible or (csDesigning in ComponentState)) then begin
|
||||||
if (pfAdded in APage.FFlags) then exit;
|
if (pfAdded in APage.FFlags) then exit;
|
||||||
Include(APage.FFlags,pfAdded);
|
Include(APage.FFlags,pfAdding);
|
||||||
TWSCustomNotebookClass(WidgetSetClass).AddPage(Self, APage, APage.VisibleIndex);
|
TWSCustomNotebookClass(WidgetSetClass).AddPage(Self, APage, APage.VisibleIndex);
|
||||||
|
APage.FFlags:=APage.FFlags+[pfAdded]-[pfAdding];
|
||||||
|
APage.ResizeDelayedAutoSizeChildren
|
||||||
end else begin
|
end else begin
|
||||||
if not (pfAdded in APage.FFlags) then exit;
|
if not (pfAdded in APage.FFlags) then exit;
|
||||||
Exclude(APage.FFlags,pfAdded);
|
Exclude(APage.FFlags,pfAdded);
|
||||||
|
@ -226,4 +226,9 @@ begin
|
|||||||
Result:=false;
|
Result:=false;
|
||||||
end;
|
end;
|
||||||
|
|
||||||
|
function TCustomPage.AutoSizeDelayed: boolean;
|
||||||
|
begin
|
||||||
|
Result:=(not (pfAdded in FFlags)) or (inherited AutoSizeDelayed);
|
||||||
|
end;
|
||||||
|
|
||||||
// included by extctrls.pp
|
// included by extctrls.pp
|
||||||
|
Loading…
Reference in New Issue
Block a user