Skip to content

Commit a9e7334

Browse files
committed
active new tab option added to demo
1 parent cd7cee7 commit a9e7334

File tree

2 files changed

+54
-36
lines changed

2 files changed

+54
-36
lines changed

Demo/frmMainU.dfm

Lines changed: 42 additions & 21 deletions
Original file line numberDiff line numberDiff line change
@@ -11,6 +11,7 @@ object frmMain: TfrmMain
1111
Font.Name = 'Segoe UI'
1212
Font.Style = []
1313
OldCreateOrder = False
14+
Position = poDesktopCenter
1415
OnCreate = FormCreate
1516
PixelsPerInch = 96
1617
TextHeight = 15
@@ -808,15 +809,15 @@ object frmMain: TfrmMain
808809
object Label2: TLabel
809810
Left = 11
810811
Top = 70
811-
Width = 67
812+
Width = 68
812813
Height = 15
813814
Caption = 'Image Index:'
814815
FocusControl = edtImageIndex
815816
end
816817
object Label3: TLabel
817818
Left = 135
818819
Top = 70
819-
Width = 110
820+
Width = 111
820821
Height = 15
821822
Caption = 'Image Overlay Index:'
822823
FocusControl = edtImageOverlayIndex
@@ -969,31 +970,31 @@ object frmMain: TfrmMain
969970
object lblMinTabWidth: TLabel
970971
Left = 8
971972
Top = 21
972-
Width = 81
973+
Width = 80
973974
Height = 15
974975
Caption = 'Min Tab Width:'
975976
FocusControl = edtMinTabWidth
976977
end
977978
object Label17: TLabel
978979
Left = 278
979980
Top = 20
980-
Width = 119
981+
Width = 118
981982
Height = 15
982983
Caption = 'Tab/Container Offsets:'
983984
FocusControl = edtTabOffsetTop
984985
end
985986
object Label51: TLabel
986987
Left = 283
987988
Top = 131
988-
Width = 114
989+
Width = 113
989990
Height = 15
990991
Caption = 'Tab Content Margins:'
991992
FocusControl = edtTabOffsetTop
992993
end
993994
object Label71: TLabel
994995
Left = 108
995996
Top = 76
996-
Width = 66
997+
Width = 65
997998
Height = 15
998999
Caption = 'Tab Overlap:'
9991000
FocusControl = edtTabOverlap
@@ -1217,7 +1218,7 @@ object frmMain: TfrmMain
12171218
Top = 185
12181219
Width = 731
12191220
Height = 216
1220-
ActivePage = TabSheet17
1221+
ActivePage = TabSheet16
12211222
Align = alTop
12221223
TabOrder = 1
12231224
object TabSheet16: TTabSheet
@@ -1265,7 +1266,7 @@ object frmMain: TfrmMain
12651266
object Label78: TLabel
12661267
Left = 163
12671268
Top = 2
1268-
Width = 113
1269+
Width = 112
12691270
Height = 15
12701271
Caption = 'Animation Ease Type:'
12711272
FocusControl = cbModifiedGlowEaseType
@@ -1907,7 +1908,7 @@ object frmMain: TfrmMain
19071908
object Label67: TLabel
19081909
Left = 13
19091910
Top = 99
1910-
Width = 89
1911+
Width = 88
19111912
Height = 15
19121913
Caption = 'Trimming Mode:'
19131914
FocusControl = cbTextTrimming
@@ -2747,7 +2748,7 @@ object frmMain: TfrmMain
27472748
object Label80: TLabel
27482749
Left = 16
27492750
Top = 26
2750-
Width = 308
2751+
Width = 307
27512752
Height = 15
27522753
Caption = 'This feature is only supported in Delphi versions from 2010'
27532754
Font.Charset = ANSI_CHARSET
@@ -2824,6 +2825,26 @@ object frmMain: TfrmMain
28242825
TabOrder = 0
28252826
OnClick = OnCommonControlPropertyChange
28262827
end
2828+
object btnSetActivePageIndex: TButton
2829+
Left = 3
2830+
Top = 222
2831+
Width = 153
2832+
Height = 25
2833+
Caption = 'Set ActivePageIndex to -1'
2834+
TabOrder = 6
2835+
OnClick = btnSetActivePageIndexClick
2836+
end
2837+
object chkActiveNewTab: TCheckBox
2838+
Left = 3
2839+
Top = 199
2840+
Width = 142
2841+
Height = 17
2842+
Caption = 'Activate new Tab'
2843+
Checked = True
2844+
State = cbChecked
2845+
TabOrder = 7
2846+
OnClick = OnCommonControlPropertyChange
2847+
end
28272848
end
28282849
object TabSheet8: TTabSheet
28292850
Caption = 'Animation'
@@ -2855,23 +2876,23 @@ object frmMain: TfrmMain
28552876
object Label23: TLabel
28562877
Left = 8
28572878
Top = 23
2858-
Width = 102
2879+
Width = 101
28592880
Height = 15
28602881
Caption = 'Update Timer (ms):'
28612882
FocusControl = edtAnimationUpdate
28622883
end
28632884
object Label70: TLabel
28642885
Left = 164
28652886
Top = 76
2866-
Width = 156
2887+
Width = 155
28672888
Height = 15
28682889
Caption = 'Default Movement Ease Type:'
28692890
FocusControl = cbMovementEaseType
28702891
end
28712892
object Label72: TLabel
28722893
Left = 164
28732894
Top = 127
2874-
Width = 123
2895+
Width = 122
28752896
Height = 15
28762897
Caption = 'Default Style Ease Type:'
28772898
FocusControl = cbStyleEaseType
@@ -3007,7 +3028,7 @@ object frmMain: TfrmMain
30073028
object Label73: TLabel
30083029
Left = 24
30093030
Top = 103
3010-
Width = 115
3031+
Width = 114
30113032
Height = 15
30123033
Caption = 'Movement Ease Type:'
30133034
FocusControl = cbMoveTabEase
@@ -3087,7 +3108,7 @@ object frmMain: TfrmMain
30873108
object Label75: TLabel
30883109
Left = 24
30893110
Top = 103
3090-
Width = 115
3111+
Width = 114
30913112
Height = 15
30923113
Caption = 'Movement Ease Type:'
30933114
FocusControl = cbDeleteTabEase
@@ -3167,7 +3188,7 @@ object frmMain: TfrmMain
31673188
object Label77: TLabel
31683189
Left = 24
31693190
Top = 103
3170-
Width = 115
3191+
Width = 114
31713192
Height = 15
31723193
Caption = 'Movement Ease Type:'
31733194
FocusControl = cbAddTabEase
@@ -3269,15 +3290,15 @@ object frmMain: TfrmMain
32693290
object Label32: TLabel
32703291
Left = 140
32713292
Top = 5
3272-
Width = 87
3293+
Width = 88
32733294
Height = 15
32743295
Caption = 'Drag Start Pixels:'
32753296
FocusControl = edtDragStartPixels
32763297
end
32773298
object Label33: TLabel
32783299
Left = 6
32793300
Top = 62
3280-
Width = 113
3301+
Width = 114
32813302
Height = 15
32823303
Caption = 'External Drag Display:'
32833304
FocusControl = cbExternalDragDisplay
@@ -3532,15 +3553,15 @@ object frmMain: TfrmMain
35323553
object Label7: TLabel
35333554
Left = 16
35343555
Top = 8
3535-
Width = 116
3556+
Width = 115
35363557
Height = 15
35373558
Caption = 'Tab Container Height:'
35383559
FocusControl = edtTabHeight
35393560
end
35403561
object Label5: TLabel
3541-
Left = 31
3562+
Left = 32
35423563
Top = 88
3543-
Width = 89
3564+
Width = 88
35443565
Height = 15
35453566
Alignment = taRightJustify
35463567
Caption = 'Glass Height Top'

Demo/frmMainU.pas

Lines changed: 12 additions & 15 deletions
Original file line numberDiff line numberDiff line change
@@ -27,15 +27,6 @@ interface
2727
{$DEFINE USE_GLASS_FORM}
2828
{$ifend}
2929

30-
// Fix to workaround compiler bug that re-introduces System.Actions
31-
{$if CompilerVersion >= 28.0}
32-
{$DEFINE USE_SYSTEM_ACTIONS}
33-
{$endif}
34-
35-
{$if CompilerVersion >= 29.0}
36-
{$DEFINE USE_SYSTEM_IMAGELIST}
37-
{$ifend}
38-
3930
uses
4031
Windows, Messages, SysUtils, Variants, Classes, Graphics, Controls, Forms,
4132
Dialogs, StdCtrls, ActnList, ComCtrls, Spin, Contnrs,
@@ -47,17 +38,12 @@ interface
4738

4839
{$IFDEF USE_GLASS_FORM}ChromeTabsGlassForm,{$ENDIF}
4940

50-
(* NOTE - If you get "unit xxx is redeclared errors", comment out the IFDEF lines
51-
below. This is due to a Delphi bug with the {$if CompilerVersion .. } *)
52-
{$IFDEF USE_SYSTEM_ACTIONS}System.Actions,{$ENDIF}
53-
{$IFDEF USE_SYSTEM_IMAGELIST}System.ImageList,{$ENDIF}
54-
5541
ChromeTabs,
5642
ChromeTabsTypes,
5743
ChromeTabsUtils,
5844
ChromeTabsControls,
5945
ChromeTabsClasses,
60-
ChromeTabsLog;
46+
ChromeTabsLog, Actions, ImageList;
6147

6248
type
6349
TFormType = {$IFDEF USE_GLASS_FORM}
@@ -387,6 +373,8 @@ TfrmMain = class(TFormType)
387373
TabSheetLookAndFeel: TTabSheet;
388374
TabSheetOptions: TTabSheet;
389375
tvLookAndFeelItems: TTreeView;
376+
btnSetActivePageIndex: TButton;
377+
chkActiveNewTab: TCheckBox;
390378
procedure FormCreate(Sender: TObject);
391379
procedure ChromeTabs1MouseMove(Sender: TObject; Shift: TShiftState; X, Y: Integer);
392380
procedure CommonTabPropertyChange(Sender: TObject);
@@ -472,6 +460,7 @@ TfrmMain = class(TFormType)
472460
procedure ChromeTabs2TabDragDrop(Sender: TObject; X, Y: Integer;
473461
DragTabObject: IDragTabObject; Cancelled: Boolean;
474462
var TabDropOptions: TTabDropOptions);
463+
procedure btnSetActivePageIndexClick(Sender: TObject);
475464
private
476465
FLastMouseX: Integer;
477466
FLastMouseY: Integer;
@@ -691,6 +680,12 @@ procedure TfrmMain.btnOpenFormClick(Sender: TObject);
691680
TfrmMain.Create(Application).Show;
692681
end;
693682

683+
procedure TfrmMain.btnSetActivePageIndexClick(Sender: TObject);
684+
begin
685+
if FCurrentTabs <> nil then
686+
FCurrentTabs.ActiveTabIndex := -1;
687+
end;
688+
694689
procedure TfrmMain.BuildLookAndFeelTree;
695690

696691
function AddTreeNode(Parent: TTreeNode; const Text: String; ID: Integer): TTreeNode;
@@ -1330,6 +1325,7 @@ procedure TfrmMain.ChromeTabControlPropertiesToGUI(ChromeTabs: TChromeTabs);
13301325
chkBackgroundDoubleClickMaxmise.Checked := ChromeTabs.Options.Behaviour.BackgroundDblClickMaximiseRestoreForm;
13311326
chkDraggingBackgoundMovesForm.Checked := ChromeTabs.Options.Behaviour.BackgroundDragMovesForm;
13321327
chkSmartResize.Checked := ChromeTabs.Options.Behaviour.TabSmartDeleteResizing;
1328+
chkActiveNewTab.Checked := ChromeTabs.Options.Behaviour.ActivateNewTab;
13331329
edtCloseButtonMouseLeaveDelay.Value := ChromeTabs.Options.Behaviour.TabSmartDeleteResizeCancelDelay;
13341330
chkRightClickSelect.Checked := ChromeTabs.Options.Behaviour.TabRightClickSelect;
13351331

@@ -1485,6 +1481,7 @@ procedure TfrmMain.GUIToChromeTabControlProperties(ChromeTabs: TChromeTabs);
14851481
ChromeTabs.Options.Behaviour.BackgroundDblClickMaximiseRestoreForm := chkBackgroundDoubleClickMaxmise.Checked;
14861482
ChromeTabs.Options.Behaviour.BackgroundDragMovesForm := chkDraggingBackgoundMovesForm.Checked;
14871483
ChromeTabs.Options.Behaviour.TabSmartDeleteResizing := chkSmartResize.Checked;
1484+
ChromeTabs.Options.Behaviour.ActivateNewTab := chkActiveNewTab.Checked;
14881485
ChromeTabs.Options.Behaviour.TabSmartDeleteResizeCancelDelay := edtCloseButtonMouseLeaveDelay.Value;
14891486
ChromeTabs.Options.Behaviour.TabRightClickSelect := chkRightClickSelect.Checked;
14901487

0 commit comments

Comments
 (0)