fixed TabPosition-change issue

git-svn-id: https://svn.code.sf.net/p/lazarus-ccr/svn@582 8e941d3f-bd1b-0410-a28a-d453659cc2b4
This commit is contained in:
eugene1
2008-10-05 17:29:37 +00:00
parent 7320cca41f
commit 07b9c83841
5 changed files with 168 additions and 71 deletions

View File

@ -1,7 +1,7 @@
object Form1: TForm1 object Form1: TForm1
Left = 165 Left = 270
Height = 506 Height = 506
Top = 182 Top = 98
Width = 898 Width = 898
Caption = 'Form1' Caption = 'Form1'
ClientHeight = 506 ClientHeight = 506
@ -29,6 +29,8 @@ object Form1: TForm1
ControlStyle = [csAcceptsControls] ControlStyle = [csAcceptsControls]
PageIndex = -1 PageIndex = -1
TabHeight = 30 TabHeight = 30
TabPosition = tpLeft
MoveIncrement = 1
end end
end end
object Panel2: TPanel object Panel2: TPanel

View File

@ -1,51 +1,51 @@
{ Das ist eine automatisch erzeugte Lazarus-Ressourcendatei } { Das ist eine automatisch erzeugte Lazarus-Ressourcendatei }
LazarusResources.Add('TForm1','FORMDATA',[ LazarusResources.Add('TForm1','FORMDATA',[
'TPF0'#6'TForm1'#5'Form1'#4'Left'#3#165#0#6'Height'#3#250#1#3'Top'#3#182#0#5 'TPF0'#6'TForm1'#5'Form1'#4'Left'#3#14#1#6'Height'#3#250#1#3'Top'#2'b'#5'Widt'
+'Width'#3#130#3#7'Caption'#6#5'Form1'#12'ClientHeight'#3#250#1#11'ClientWidt' +'h'#3#130#3#7'Caption'#6#5'Form1'#12'ClientHeight'#3#250#1#11'ClientWidth'#3
+'h'#3#130#3#8'OnCreate'#7#10'FormCreate'#9'OnDestroy'#7#11'FormDestroy'#10'P' +#130#3#8'OnCreate'#7#10'FormCreate'#9'OnDestroy'#7#11'FormDestroy'#10'Parent'
+'arentFont'#8#10'LCLVersion'#6#6'0.9.27'#0#6'TPanel'#6'Panel1'#6'Height'#3 +'Font'#8#10'LCLVersion'#6#6'0.9.27'#0#6'TPanel'#6'Panel1'#6'Height'#3#250#1#5
+#250#1#5'Width'#3#239#2#5'Align'#7#6'alLeft'#7'Anchors'#11#5'akTop'#6'akLeft' +'Width'#3#239#2#5'Align'#7#6'alLeft'#7'Anchors'#11#5'akTop'#6'akLeft'#7'akRi'
+#7'akRight'#8'akBottom'#0#7'Caption'#6#6'Panel1'#12'ClientHeight'#3#250#1#11 +'ght'#8'akBottom'#0#7'Caption'#6#6'Panel1'#12'ClientHeight'#3#250#1#11'Clien'
+'ClientWidth'#3#239#2#8'TabOrder'#2#0#7'OnClick'#7#9'BewegeBtn'#0#15'TGradTa' +'tWidth'#3#239#2#8'TabOrder'#2#0#7'OnClick'#7#9'BewegeBtn'#0#15'TGradTabCont'
+'bControl'#15'GradTabControl1'#4'Left'#2#1#6'Height'#3#248#1#3'Top'#2#1#5'Wi' +'rol'#15'GradTabControl1'#4'Left'#2#1#6'Height'#3#248#1#3'Top'#2#1#5'Width'#3
+'dth'#3#237#2#5'Align'#7#8'alClient'#12'ControlStyle'#11#17'csAcceptsControl' +#237#2#5'Align'#7#8'alClient'#12'ControlStyle'#11#17'csAcceptsControls'#0#9
+'s'#0#9'PageIndex'#2#255#9'TabHeight'#2#30#0#0#0#6'TPanel'#6'Panel2'#4'Left' +'PageIndex'#2#255#9'TabHeight'#2#30#11'TabPosition'#7#6'tpLeft'#13'MoveIncre'
+#3#244#2#6'Height'#3#250#1#5'Width'#3#142#0#5'Align'#7#8'alClient'#7'Caption' +'ment'#2#1#0#0#0#6'TPanel'#6'Panel2'#4'Left'#3#244#2#6'Height'#3#250#1#5'Wid'
+#6#6'Panel2'#12'ClientHeight'#3#250#1#11'ClientWidth'#3#142#0#8'TabOrder'#2#2 +'th'#3#142#0#5'Align'#7#8'alClient'#7'Caption'#6#6'Panel2'#12'ClientHeight'#3
+#7'OnClick'#7#11'Panel2Click'#0#6'TLabel'#6'Label1'#4'Left'#2#15#6'Height'#2 +#250#1#11'ClientWidth'#3#142#0#8'TabOrder'#2#2#7'OnClick'#7#11'Panel2Click'#0
+#14#3'Top'#3'0'#1#5'Width'#2'O'#7'Caption'#6#14'Move Increment'#11'ParentCol' +#6'TLabel'#6'Label1'#4'Left'#2#15#6'Height'#2#14#3'Top'#3'0'#1#5'Width'#2'O'
+'or'#8#0#0#9'TComboBox'#9'ComboBox1'#4'Left'#2#16#6'Height'#2#21#3'Top'#2#16 +#7'Caption'#6#14'Move Increment'#11'ParentColor'#8#0#0#9'TComboBox'#9'ComboB'
+#5'Width'#2'd'#10'ItemHeight'#2#13#9'MaxLength'#2#255#8'OnChange'#7#15'Combo' +'ox1'#4'Left'#2#16#6'Height'#2#21#3'Top'#2#16#5'Width'#2'd'#10'ItemHeight'#2
+'Box1Change'#5'Style'#7#14'csDropDownList'#8'TabOrder'#2#0#0#0#11'TRadioGrou' +#13#9'MaxLength'#2#255#8'OnChange'#7#15'ComboBox1Change'#5'Style'#7#14'csDro'
+'p'#11'RadioGroup1'#4'Left'#2#17#6'Height'#2'q'#3'Top'#2'P'#5'Width'#2'd'#8 +'pDownList'#8'TabOrder'#2#0#0#0#11'TRadioGroup'#11'RadioGroup1'#4'Left'#2#17
+'AutoFill'#9#7'Caption'#6#12'Tab Position'#28'ChildSizing.LeftRightSpacing'#2 +#6'Height'#2'q'#3'Top'#2'P'#5'Width'#2'd'#8'AutoFill'#9#7'Caption'#6#12'Tab '
+#6#28'ChildSizing.TopBottomSpacing'#2#6#29'ChildSizing.EnlargeHorizontal'#7 +'Position'#28'ChildSizing.LeftRightSpacing'#2#6#28'ChildSizing.TopBottomSpac'
+#24'crsHomogenousChildResize'#27'ChildSizing.EnlargeVertical'#7#24'crsHomoge' +'ing'#2#6#29'ChildSizing.EnlargeHorizontal'#7#24'crsHomogenousChildResize'#27
+'nousChildResize'#28'ChildSizing.ShrinkHorizontal'#7#14'crsScaleChilds'#26'C' +'ChildSizing.EnlargeVertical'#7#24'crsHomogenousChildResize'#28'ChildSizing.'
+'hildSizing.ShrinkVertical'#7#14'crsScaleChilds'#18'ChildSizing.Layout'#7#29 +'ShrinkHorizontal'#7#14'crsScaleChilds'#26'ChildSizing.ShrinkVertical'#7#14
+'cclLeftToRightThenTopToBottom'#27'ChildSizing.ControlsPerLine'#2#1#12'Clien' +'crsScaleChilds'#18'ChildSizing.Layout'#7#29'cclLeftToRightThenTopToBottom'
+'tHeight'#2'_'#11'ClientWidth'#2'`'#9'ItemIndex'#2#0#13'Items.Strings'#1#6#5 +#27'ChildSizing.ControlsPerLine'#2#1#12'ClientHeight'#2'_'#11'ClientWidth'#2
+'tpTop'#6#8'tpBottom'#6#6'tpLeft'#6#7'tpRight'#0#7'OnClick'#7#16'RadioGroup1' +'`'#9'ItemIndex'#2#0#13'Items.Strings'#1#6#5'tpTop'#6#8'tpBottom'#6#6'tpLeft'
+'Click'#8'TabOrder'#2#2#0#0#9'TCheckBox'#9'CheckBox1'#4'Left'#2#15#6'Height' +#6#7'tpRight'#0#7'OnClick'#7#16'RadioGroup1Click'#8'TabOrder'#2#2#0#0#9'TChe'
+#2#19#3'Top'#3#20#1#5'Width'#2'K'#7'Caption'#6#9'Long Tabs'#7'Enabled'#8#7'O' +'ckBox'#9'CheckBox1'#4'Left'#2#15#6'Height'#2#19#3'Top'#3#20#1#5'Width'#2'K'
+'nClick'#7#14'CheckBox1Click'#8'TabOrder'#2#3#0#0#9'TSpinEdit'#9'SpinEdit1'#4 +#7'Caption'#6#9'Long Tabs'#7'Enabled'#8#7'OnClick'#7#14'CheckBox1Click'#8'Ta'
+'Left'#2'_'#6'Height'#2#19#3'Top'#3#20#1#5'Width'#2'"'#7'Enabled'#8#8'MaxVal' +'bOrder'#2#3#0#0#9'TSpinEdit'#9'SpinEdit1'#4'Left'#2'_'#6'Height'#2#19#3'Top'
+'ue'#2'2'#13'OnEditingDone'#7#20'SpinEdit1EditingDone'#8'TabOrder'#2#1#5'Val' +#3#20#1#5'Width'#2'"'#7'Enabled'#8#8'MaxValue'#2'2'#13'OnEditingDone'#7#20'S'
+'ue'#2'2'#0#0#11'TGradButton'#11'GradButton1'#4'Left'#2#16#6'Height'#2#25#3 +'pinEdit1EditingDone'#8'TabOrder'#2#1#5'Value'#2'2'#0#0#11'TGradButton'#11'G'
+'Top'#2'0'#5'Width'#2'h'#7'Caption'#6#8'New Page'#7'OnClick'#7#9'BewegeBtn'#8 +'radButton1'#4'Left'#2#16#6'Height'#2#25#3'Top'#2'0'#5'Width'#2'h'#7'Caption'
+'TabOrder'#2#4#7'TabStop'#9#11'NormalBlend'#5#0#0#0#0#0#0#0#128#254'?'#9'Ove' +#6#8'New Page'#7'OnClick'#7#9'BewegeBtn'#8'TabOrder'#2#4#7'TabStop'#9#11'Nor'
+'rBlend'#5'5^'#186'I'#12#2'+'#167#254'?'#9'BaseColor'#7#6'clBlue'#5'Color'#7 +'malBlend'#5#0#0#0#0#0#0#0#128#254'?'#9'OverBlend'#5'5^'#186'I'#12#2'+'#167
+#6'clBlue'#16'NormalBlendColor'#7#7'clWhite'#14'OverBlendColor'#7#8'clSilver' +#254'?'#9'BaseColor'#7#6'clBlue'#5'Color'#7#6'clBlue'#16'NormalBlendColor'#7
+#15'BackgroundColor'#7#9'clBtnFace'#11'BorderSides'#11#9'bsTopLine'#12'bsBot' +#7'clWhite'#14'OverBlendColor'#7#8'clSilver'#15'BackgroundColor'#7#9'clBtnFa'
+'tomLine'#10'bsLeftLine'#11'bsRightLine'#0#15'ShowFocusBorder'#9#20'GlyphBac' +'ce'#11'BorderSides'#11#9'bsTopLine'#12'bsBottomLine'#10'bsLeftLine'#11'bsRi'
+'kgroundColor'#7#7'clWhite'#10'ClickColor'#7#6'clBlue'#22'AutoWidthBorderSpa' +'ghtLine'#0#15'ShowFocusBorder'#9#20'GlyphBackgroundColor'#7#7'clWhite'#10'C'
+'cing'#2#15#0#0#9'TSpinEdit'#9'SpinEdit2'#4'Left'#2#15#6'Height'#2#23#3'Top' +'lickColor'#7#6'clBlue'#22'AutoWidthBorderSpacing'#2#15#0#0#9'TSpinEdit'#9'S'
+#3'@'#1#5'Width'#2'O'#8'MinValue'#2#156#8'OnChange'#7#15'SpinEdit2Change'#8 +'pinEdit2'#4'Left'#2#15#6'Height'#2#23#3'Top'#3'@'#1#5'Width'#2'O'#8'MinValu'
+'TabOrder'#2#5#0#0#0#9'TSplitter'#9'Splitter1'#4'Left'#3#239#2#6'Height'#3 +'e'#2#156#8'OnChange'#7#15'SpinEdit2Change'#8'TabOrder'#2#5#0#0#0#9'TSplitte'
+#250#1#5'Width'#2#5#0#0#10'TPopupMenu'#10'PopupMenu1'#4'left'#3#222#2#3'top' +'r'#9'Splitter1'#4'Left'#3#239#2#6'Height'#3#250#1#5'Width'#2#5#0#0#10'TPopu'
+#3#141#1#0#9'TMenuItem'#9'MenuItem1'#7'Caption'#6#9'New Item1'#0#0#0#10'TSyn' +'pMenu'#10'PopupMenu1'#4'left'#3#222#2#3'top'#3#141#1#0#9'TMenuItem'#9'MenuI'
+'PHPSyn'#10'SynPHPSyn1'#13'DefaultFilter'#6'CPHP-Dateien (*.php,*.php3,*.pht' +'tem1'#7'Caption'#6#9'New Item1'#0#0#0#10'TSynPHPSyn'#10'SynPHPSyn1'#13'Defa'
+'ml,*.inc)|*.php;*.php3;*.phtml;*.inc'#7'Enabled'#8#4'left'#2's'#3'top'#3#255 +'ultFilter'#6'CPHP-Dateien (*.php,*.php3,*.phtml,*.inc)|*.php;*.php3;*.phtml'
+#0#0#0#0 +';*.inc'#7'Enabled'#8#4'left'#2's'#3'top'#3#255#0#0#0#0
]); ]);

View File

@ -302,7 +302,7 @@ begin
//WriteLn(R, ' ', G, ' ', B, ColorToString(RGBToColor(R,G,B))); //WriteLn(R, ' ', G, ' ', B, ColorToString(RGBToColor(R,G,B)));
GradTabControl1.CurrentPage.Caption:='tab_'+IntToStr(C); GradTabControl1.CurrentPage.Caption:='tab_'+IntToStr(C);
GradTabControl1.CurrentPage.Color:=RGBToColor(R, G, B); //GradTabControl1.CurrentPage.Color:=RGBToColor(R, G, B);
GradTabControl1.CurrentPage.TabPopupMenu := PopupMenu1; GradTabControl1.CurrentPage.TabPopupMenu := PopupMenu1;
GradTabControl1.CurrentPage.PopupMenu:= PopupMenu1; GradTabControl1.CurrentPage.PopupMenu:= PopupMenu1;

View File

@ -15,7 +15,7 @@
<VersionInfo> <VersionInfo>
<UseVersionInfo Value="True"/> <UseVersionInfo Value="True"/>
<AutoIncrementBuild Value="True"/> <AutoIncrementBuild Value="True"/>
<CurrentBuildNr Value="585"/> <CurrentBuildNr Value="607"/>
<ProjectVersion Value="0.0.0.0"/> <ProjectVersion Value="0.0.0.0"/>
</VersionInfo> </VersionInfo>
<PublishOptions> <PublishOptions>

View File

@ -704,14 +704,14 @@ procedure TGradTabPagesBar.InsertButton(AButton: TGradTabPageButton; Index: Inte
var var
LastLeft : Integer; LastLeft : Integer;
begin begin
Left := 0; LastLeft := 0;
if (Index >= 1) AND (FPageList.Count>=1) then if (Index >= 1) AND (FPageList.Count>=1) then
LastLeft := TGradTabPage(FPageList.Items[Index-1]).TabButton.Left; LastLeft := TGradTabPage(FPageList.Items[Index-1]).TabButton.Left;
with AButton do with AButton do
begin begin
Left := -123; Left := LastLeft;
Parent := Self; Parent := Self;
ShowFocusBorder:=false; ShowFocusBorder:=false;
AutoWidth:=true; AutoWidth:=true;
@ -805,16 +805,25 @@ end;
------------------------------------------------------------------------------} ------------------------------------------------------------------------------}
procedure TGradTabPagesBar.OrderButtons; procedure TGradTabPagesBar.OrderButtons;
var var
LastLeft, LastTop, i: Integer; LastLeft, LastTop, i, BarWidth, BarHeight: Integer;
NewDirection: TRotateDirection; NewDirection: TRotateDirection;
NewBorderSides: TBorderSides; NewBorderSides: TBorderSides;
NewGradientType: TGradientType; NewGradientType: TGradientType;
B : TGradButton;
begin begin
DebugLn('OrderButton Start'); DebugLn('OrderButton Start');
LastLeft:= FMovedTo; LastLeft:= FMovedTo;
LastTop := FMovedTo; LastTop := FMovedTo;
{ if FTabPosition in [tpTop, tpBottom] then begin
BarWidth:= Width;
BarHeight:= 0;
end else begin }
BarWidth := Width;
BarHeight:= Height;
//end;
case FTabPosition of case FTabPosition of
tpTop: tpTop:
begin begin
@ -843,33 +852,105 @@ begin
end; end;
for i := 0 to FPageList.Count - 1 do for i := 0 to FPageList.Count - 1 do
with TGradTabPage(FPageList.Items[i]).TabButton do
begin begin
if Visible then B := TGradTabPage(FPageList.Items[i]).TabButton;
begin
DebugLn('I: %d W: %d H: %d L: %d T: %d',[i,Width,Height,Left,Top]); if B.Visible then
begin
B.RotateDirection := NewDirection;
B.BorderSides := NewBorderSides;
B.GradientType := NewGradientType;
DebugLn('Begin I: %d W: %d H: %d L: %d T: %d, BW: %d, BH: %d',[i,B.Width,B.Height,B.Left,B.Top,BarWidth,BarHeight]);
case FTabPosition of
tpTop:
begin
B.Left := LastLeft;
LastLeft := LastLeft + B.Width + 1;
if FActiveIndex = i then begin
B.Top := 0;
B.Height:= BarHeight;
end else begin
B.Top := 3;
B.Height:= BarHeight-3;
end;
end;
tpBottom:
begin
B.Left := LastLeft;
LastLeft := LastLeft + B.Width + 1;
B.Top := 0;
if FActiveIndex = i then
B.Height := BarHeight
else
B.Height := BarHeight-3;
end;
tpLeft:
begin
B.Top := LastTop;
LastTop := LastTop + B.Height + 1;
if FActiveIndex = i then begin
B.Left := 0;
B.Width:= BarWidth;
end else begin
B.Left := 3;
B.Width:= BarWidth-3;
end;
end;
tpRight:
begin
B.Top := LastTop;
LastTop := LastTop + B.Height + 1;
B.Left := 0;
if FActiveIndex = i then
B.Width := BarWidth
else
B.Width := BarWidth-3;
end;
end;
RotateDirection := NewDirection;
{if FActiveIndex = i then {if FActiveIndex = i then
FocusButton(i) FocusButton(i)
else else
UnFocusButton(i); UnFocusButton(i);
} }
BorderSides := NewBorderSides;
GradientType := NewGradientType;
if FTabPosition in [tpTop, tpBottom] then
{if FTabPosition in [tpTop, tpBottom] then
begin begin
Left := LastLeft; B.Left := LastLeft;
LastLeft := LastLeft + Width + 1; LastLeft := LastLeft + B.Width + 1;
if FTabPosition = tpBottom then begin
end else begin
end;
end end
else else
begin begin
Top := LastTop;
LastTop := LastTop + Height + 1; if FTabPosition = tpRight then begin
end;
end else
end; }
DebugLn('End I: %d W: %d H: %d L: %d T: %d, BW: %d, BH: %d',[i,B.Width,B.Height,B.Left,B.Top,BarWidth,BarHeight])
end; end;
end; end;
DebugLn('OrderButton End'); DebugLn('OrderButton End');
@ -946,7 +1027,20 @@ end;
TGradTabPagesBar SetTabPosition(Value: TTabPosition) TGradTabPagesBar SetTabPosition(Value: TTabPosition)
------------------------------------------------------------------------------} ------------------------------------------------------------------------------}
procedure TGradTabPagesBar.SetTabPosition(Value: TTabPosition); procedure TGradTabPagesBar.SetTabPosition(Value: TTabPosition);
function DbgsTabPosition(V : TTabPosition) : String;
begin begin
case V of
tpTop : Result := 'tpTop';
tpBottom: Result := 'tpBottom';
tpRight: Result := 'tpRight';
tpLeft: Result := 'tpLeft';
end;
end;
begin
if FTabPosition = Value then Exit;
DebugLn('Change TabPosition from %s to %s',[DbgsTabPosition(FTabPosition),DbgsTabPosition(Value)]);
FTabPosition:=Value; FTabPosition:=Value;
OrderButtons; OrderButtons;
@ -1509,10 +1603,10 @@ begin
if (Value<0) or (Value>=fPageList.Count) then Exit; if (Value<0) or (Value>=fPageList.Count) then Exit;
if FPageIndex=Value then Exit; if FPageIndex=Value then Exit;
if FPageIndex <> -1 then if FPageIndex <> -1 then UnShowPage(FPageIndex);
UnShowPage(FPageIndex);
ShowPage(Value); ShowPage(Value);
FPagesBar.FocusButton(Value);
FPageIndex := Value; FPageIndex := Value;
@ -1800,8 +1894,7 @@ begin
end; end;
end; end;
FPagesBar.Align:=alClient; //FPagesBar.Align:=alClient;
FPagesBar.TabPosition:=Value;
case Value of case Value of
tpTop: begin tpTop: begin
@ -1834,6 +1927,8 @@ begin
end; end;
end; end;
FPagesBar.TabPosition:=Value;
{$IFDEF DEBUGTAB} {$IFDEF DEBUGTAB}
DebugLn('After'); DebugLn('After');
DebugLn('FBar Left %d Top %d Height %d Width %d',[ FBar.Left, Fbar.Top, FBar.Height, FBar.Width]); DebugLn('FBar Left %d Top %d Height %d Width %d',[ FBar.Left, Fbar.Top, FBar.Height, FBar.Width]);