mirror of
https://gitlab.com/freepascal.org/lazarus/lazarus.git
synced 2025-08-26 05:00:25 +02:00
move taborder and tabstop to twincontrol
git-svn-id: trunk@6509 -
This commit is contained in:
parent
1ac4c9fdda
commit
9a6dc5eb4a
@ -851,8 +851,6 @@ type
|
||||
FSessionProperties: string;
|
||||
FShowHint: Boolean;
|
||||
FSizeLock: integer;
|
||||
FTabOrder: integer;
|
||||
FTabStop: Boolean;
|
||||
FTBDockHeight: Integer;
|
||||
FTop: Integer;
|
||||
FUndockHeight: Integer;
|
||||
@ -868,7 +866,6 @@ type
|
||||
function GetLRDockWidth: Integer;
|
||||
function GetMouseCapture: Boolean;
|
||||
function GetTBDockHeight: Integer;
|
||||
function GetTabOrder: TTabOrder;
|
||||
function GetText: TCaption;
|
||||
function GetUndockHeight: Integer;
|
||||
function GetUndockWidth: Integer;
|
||||
@ -909,13 +906,10 @@ type
|
||||
procedure SetParentColor(Value: Boolean);
|
||||
procedure SetPopupMenu(Value: TPopupMenu);
|
||||
procedure SetShowHint(Value: Boolean);
|
||||
Procedure SetTabOrder(Value: TTabOrder);
|
||||
procedure SetTabStop(Value: Boolean);
|
||||
procedure SetText(const Value: TCaption);
|
||||
procedure SetTop(Value: Integer);
|
||||
procedure SetVisible(Value: Boolean);
|
||||
procedure SetWidth(Value: Integer);
|
||||
Procedure UpdateTabOrder(value: TTabOrder);
|
||||
protected
|
||||
FControlState: TControlState;
|
||||
protected
|
||||
@ -1195,8 +1189,6 @@ type
|
||||
property Parent: TWinControl read FParent write SetParent;
|
||||
property PopupMenu: TPopupmenu read GetPopupmenu write SetPopupMenu;
|
||||
property ShowHint: Boolean read FShowHint write SetShowHint stored IsShowHintStored default False;
|
||||
property TabOrder: TTabOrder read GetTabOrder write SetTaborder default -1;
|
||||
property TabStop: Boolean read FTabStop write SetTabStop default false;
|
||||
property Visible: Boolean read FVisible write SetVisible stored IsVisibleStored default True;
|
||||
property WindowProc: TWndMethod read FWindowProc write FWindowProc;
|
||||
public
|
||||
@ -1427,6 +1419,8 @@ type
|
||||
FHandle: Hwnd;
|
||||
FShowing: Boolean;
|
||||
FShowingValid: Boolean;
|
||||
FTabOrder: integer;
|
||||
FTabStop: Boolean;
|
||||
FTabList: TList;
|
||||
FUseDockManager: Boolean;
|
||||
FWinControls: TList;
|
||||
@ -1445,8 +1439,10 @@ type
|
||||
procedure SetHandle(NewHandle: HWND);
|
||||
procedure SetBorderWidth(Value: TBorderWidth);
|
||||
procedure SetParentCtl3D(Value: Boolean);
|
||||
Procedure SetTabOrder(NewTabOrder: TTabOrder);
|
||||
procedure SetTabStop(NewTabStop: Boolean);
|
||||
procedure SetUseDockManager(const AValue: Boolean);
|
||||
procedure UpdateTabOrder(NewTabValue: TTabOrder);
|
||||
procedure UpdateTabOrder(NewTabOrder: TTabOrder);
|
||||
function WantsKeyBeforeInterface(Key: word; Shift: TShiftState): boolean;
|
||||
protected
|
||||
procedure AssignTo(Dest: TPersistent); override;
|
||||
@ -1613,6 +1609,8 @@ type
|
||||
property DoubleBuffered: Boolean read FDoubleBuffered write FDoubleBuffered;
|
||||
property Handle: HWND read GetHandle write SetHandle;
|
||||
property IsResizing: Boolean read GetIsResizing;
|
||||
property TabOrder: TTabOrder read GetTabOrder write SetTaborder default -1;
|
||||
property TabStop: Boolean read FTabStop write SetTabStop default false;
|
||||
property OnDockDrop: TDockDropEvent read FOnDockDrop write FOnDockDrop;
|
||||
property OnDockOver: TDockOverEvent read FOnDockOver write FOnDockOver;
|
||||
property OnEnter: TNotifyEvent read FOnEnter write FOnEnter;
|
||||
@ -2810,6 +2808,9 @@ end.
|
||||
{ =============================================================================
|
||||
|
||||
$Log$
|
||||
Revision 1.265 2005/01/08 14:23:56 micha
|
||||
move taborder and tabstop to twincontrol
|
||||
|
||||
Revision 1.264 2005/01/07 21:02:48 micha
|
||||
add tcontrolclass, needed by codetoolsdefines
|
||||
|
||||
|
@ -491,14 +491,6 @@ begin
|
||||
//Implemented by TWinControl, or other descendent
|
||||
end;
|
||||
|
||||
procedure TControl.SetTabStop(Value : Boolean);
|
||||
begin
|
||||
If FTabStop = Value then
|
||||
exit;
|
||||
|
||||
FTabStop := Value;
|
||||
end;
|
||||
|
||||
{------------------------------------------------------------------------------}
|
||||
{ TControl.GetClientHeight }
|
||||
{------------------------------------------------------------------------------}
|
||||
@ -645,17 +637,6 @@ begin
|
||||
Result := (ActionLink = nil) or not ActionLink.IsVisibleLinked;
|
||||
end;
|
||||
|
||||
{------------------------------------------------------------------------------}
|
||||
{ TControl GetTabOrder }
|
||||
{------------------------------------------------------------------------------}
|
||||
Function TControl.GetTabOrder : TTabOrder;
|
||||
Begin
|
||||
If Parent <> nil then
|
||||
Result := TTabOrder(ListIndexOf(Parent.FTabList, Self))
|
||||
else
|
||||
Result := -1;
|
||||
end;
|
||||
|
||||
function TControl.GetUndockHeight: Integer;
|
||||
begin
|
||||
if FUndockHeight>0 then
|
||||
@ -682,41 +663,6 @@ begin
|
||||
Result := FVisible and ((Parent = nil) or (Parent.IsVisible));
|
||||
end;
|
||||
|
||||
{------------------------------------------------------------------------------
|
||||
TControl SetTabOrder
|
||||
------------------------------------------------------------------------------}
|
||||
Procedure TControl.SetTabOrder(Value : TTabOrder);
|
||||
Begin
|
||||
if csLoading in ComponentState then
|
||||
FTabOrder := Value
|
||||
else
|
||||
UpdateTabOrder(Value);
|
||||
end;
|
||||
|
||||
{------------------------------------------------------------------------------
|
||||
TControl UpdateTabOrder
|
||||
------------------------------------------------------------------------------}
|
||||
Procedure TControl.UpdateTabOrder(Value : TTabOrder);
|
||||
var
|
||||
CurentOrder,
|
||||
OrderCount : Integer;
|
||||
begin
|
||||
If (Parent = nil) or not CanTab then
|
||||
exit;
|
||||
CurentOrder := GetTabOrder;
|
||||
If CurentOrder >= 0 then begin
|
||||
OrderCount := ListCount(Parent.FTabList);
|
||||
If (Value < 0) or (Value >= OrderCount) then
|
||||
Value := OrderCount - 1;
|
||||
If Value <> CurentOrder then begin
|
||||
ListRemove(Parent.FTabList, Self);
|
||||
ListInsert(Parent.FTabList, Value,Self);
|
||||
end;
|
||||
end
|
||||
else
|
||||
ListAdd(Parent.FTabList, Self);
|
||||
end;
|
||||
|
||||
{------------------------------------------------------------------------------}
|
||||
{ TControl.LMCaptureChanged }
|
||||
{------------------------------------------------------------------------------}
|
||||
@ -3247,8 +3193,6 @@ begin
|
||||
FIsControl := False;
|
||||
FEnabled := True;
|
||||
FHelpType := htContext;
|
||||
FTabOrder := -1;
|
||||
FTabStop := False;
|
||||
FDragCursor := crDrag;
|
||||
FFloatingDockSiteClass := TCustomDockForm;
|
||||
//DebugLn('TControl.Create END ',Name,':',ClassName);
|
||||
@ -3459,6 +3403,9 @@ end;
|
||||
|
||||
{ =============================================================================
|
||||
$Log$
|
||||
Revision 1.232 2005/01/08 14:23:56 micha
|
||||
move taborder and tabstop to twincontrol
|
||||
|
||||
Revision 1.231 2005/01/07 01:31:44 mattias
|
||||
implemented TCheckBox.State=cbGrayed for gtk intf without visual representation
|
||||
|
||||
|
@ -109,7 +109,6 @@ begin
|
||||
FButtonType := ButtonType;
|
||||
|
||||
Parent := FUpDown;
|
||||
TabStop := False;
|
||||
ControlStyle := ControlStyle + [csNoFocus];
|
||||
OnMouseDown := @ButtonMouseDown;
|
||||
OnMouseUp := @ButtonMouseUp;
|
||||
|
@ -1168,6 +1168,53 @@ begin
|
||||
end;
|
||||
end;
|
||||
|
||||
{------------------------------------------------------------------------------
|
||||
TControl SetTabOrder
|
||||
------------------------------------------------------------------------------}
|
||||
procedure TWinControl.SetTabOrder(NewTabOrder: TTabOrder);
|
||||
begin
|
||||
if csLoading in ComponentState then
|
||||
FTabOrder := NewTabOrder
|
||||
else
|
||||
UpdateTabOrder(NewTabOrder);
|
||||
end;
|
||||
|
||||
procedure TWinControl.SetTabStop(NewTabStop: Boolean);
|
||||
begin
|
||||
if FTabStop = NewTabStop then
|
||||
exit;
|
||||
|
||||
FTabStop := NewTabStop;
|
||||
UpdateTabOrder(FTabOrder);
|
||||
end;
|
||||
|
||||
{------------------------------------------------------------------------------
|
||||
TControl UpdateTabOrder
|
||||
------------------------------------------------------------------------------}
|
||||
procedure TWinControl.UpdateTabOrder(NewTabOrder: TTabOrder);
|
||||
var
|
||||
Count: Integer;
|
||||
begin
|
||||
if FParent <> nil then
|
||||
begin
|
||||
FTabOrder := GetTabOrder;
|
||||
if NewTabOrder < 0 then NewTabOrder := 0;
|
||||
Count := FParent.FTabList.Count;
|
||||
if FTabOrder = -1 then Inc(Count);
|
||||
if NewTabOrder >= Count then NewTabOrder := Count - 1;
|
||||
if NewTabOrder <> FTabOrder then
|
||||
begin
|
||||
if FTabOrder <> - 1 then
|
||||
FParent.FTabList.Delete(FTabOrder);
|
||||
if NewTabOrder <> -1 then
|
||||
begin
|
||||
FParent.FTabList.Insert(NewTabOrder, Self);
|
||||
FTabOrder := NewTabOrder;
|
||||
end;
|
||||
end;
|
||||
end;
|
||||
end;
|
||||
|
||||
{-------------------------------------------------------------------------------
|
||||
procedure TWinControl.SendMoveSizeMessages(SizeChanged, PosChanged: boolean);
|
||||
|
||||
@ -1389,7 +1436,7 @@ Function TWinControl.FindNextControl(CurrentControl: TControl;
|
||||
GoForward, CheckTabStop, CheckParent, OnlyWinControls: Boolean) : TControl;
|
||||
var
|
||||
List : TList;
|
||||
Next : TControl;
|
||||
Next : TWinControl;
|
||||
I, J : Longint;
|
||||
begin
|
||||
Try
|
||||
@ -1414,7 +1461,7 @@ begin
|
||||
end;
|
||||
if I=J then exit;
|
||||
|
||||
Next := TControl(List[I]);
|
||||
Next := TWinControl(List[I]);
|
||||
{DebugLn('TWinControl.FindNextControl B ',Next.Name,' ',dbgs(I),
|
||||
+' ChckTabStop='+dbgs(CheckTabStop)+' TabStop='+dbgs(Next.TabStop)
|
||||
+' ChckParent='+dbgs(CheckParent)+' Parent=Self='+dbgs(Next.Parent = Self)
|
||||
@ -1424,7 +1471,7 @@ begin
|
||||
+' TestEnVi='+dbgs(Next.Enabled and Next.IsVisible)
|
||||
+' TestWinC='+dbgs((not OnlyWinControls) or (Next is TWinControl))
|
||||
);}
|
||||
If (((Not CheckTabStop) or Next.TabStop)
|
||||
If (((not CheckTabStop) or Next.TabStop)
|
||||
and ((not CheckParent) or (Next.Parent = Self)))
|
||||
and (Next.Enabled and Next.IsVisible)
|
||||
and ((not OnlyWinControls) or (Next is TWinControl)) then
|
||||
@ -1483,15 +1530,14 @@ end;
|
||||
Procedure TWinControl.GetTabOrderList(List: TList);
|
||||
var
|
||||
I : Integer;
|
||||
Control : TControl;
|
||||
lWinControl : TWinControl;
|
||||
begin
|
||||
If FTabList <> nil then
|
||||
For I := 0 to FTabList.Count - 1 do begin
|
||||
Control := TControl(FTabList[I]);
|
||||
If Control.CanTab and Control.TabStop then
|
||||
List.Add(Control);
|
||||
If Control is TWinControl then
|
||||
TWinControl(Control).GetTabOrderList(List);
|
||||
lWinControl := TWinControl(FTabList[I]);
|
||||
If lWinControl.CanTab and lWinControl.TabStop then
|
||||
List.Add(lWinControl);
|
||||
lWinControl.GetTabOrderList(List);
|
||||
end;
|
||||
end;
|
||||
|
||||
@ -2170,25 +2216,6 @@ Begin
|
||||
end;
|
||||
end;
|
||||
|
||||
procedure TWinControl.UpdateTabOrder(NewTabValue: TTabOrder);
|
||||
var
|
||||
CurIndex, Count: Integer;
|
||||
begin
|
||||
if FParent=nil then exit;
|
||||
CurIndex := GetTabOrder;
|
||||
if CurIndex >= 0 then
|
||||
begin
|
||||
if NewTabValue < 0 then NewTabValue := 0;
|
||||
Count := FParent.FTabList.Count;
|
||||
if NewTabValue >= Count then NewTabValue := Count - 1;
|
||||
if NewTabValue <> CurIndex then
|
||||
begin
|
||||
FParent.FTabList.Delete(CurIndex);
|
||||
FParent.FTabList.Insert(NewTabValue, Self);
|
||||
end;
|
||||
end;
|
||||
end;
|
||||
|
||||
procedure TWinControl.AssignTo(Dest: TPersistent);
|
||||
begin
|
||||
inherited AssignTo(Dest);
|
||||
@ -2611,7 +2638,12 @@ begin
|
||||
FWinControls.Insert(Index,AControl)
|
||||
else
|
||||
ListAdd(FWinControls, AControl);
|
||||
ListAdd(FTabList, AControl);
|
||||
if TWinControl(AControl).TabOrder <> -1 then
|
||||
ListAdd(FTabList, AControl);
|
||||
|
||||
if (csDesigning in ComponentState) and (not (csLoading in ComponentState))
|
||||
and AControl.CanTab then
|
||||
TWinControl(AControl).TabStop := true;
|
||||
end else begin
|
||||
if (FControls<>nil) and (Index<FControls.Count) then
|
||||
FControls.Insert(Index,AControl)
|
||||
@ -2620,10 +2652,6 @@ begin
|
||||
end;
|
||||
|
||||
AControl.FParent := Self;
|
||||
|
||||
If (csDesigning in ComponentState) and (not (csLoading in ComponentState))
|
||||
and AControl.CanTab then
|
||||
AControl.TabStop := True;
|
||||
end;
|
||||
|
||||
{------------------------------------------------------------------------------
|
||||
@ -2902,6 +2930,9 @@ begin
|
||||
FChildSizing.OnChange:=@DoChildSizingChange;
|
||||
FBrush := nil; // Brush will be created on demand. Only few controls need it.
|
||||
FParentCtl3D:=true;
|
||||
FTabOrder := -1;
|
||||
FTabStop := False;
|
||||
FTabList := TList.Create;
|
||||
end;
|
||||
|
||||
{------------------------------------------------------------------------------}
|
||||
@ -2970,6 +3001,7 @@ begin
|
||||
FreeThenNil(FBrush);
|
||||
FreeThenNil(FChildSizing);
|
||||
FreeThenNil(FDockClients);
|
||||
FreeThenNil(FTabList);
|
||||
//DebugLn('[TWinControl.Destroy] D ',Name,':',ClassName);
|
||||
inherited Destroy;
|
||||
//DebugLn('[TWinControl.Destroy] END ',Name,':',ClassName);
|
||||
@ -3881,7 +3913,7 @@ begin
|
||||
if FParent <> nil then
|
||||
Result := TTabOrder(FParent.FTabList.IndexOf(Self))
|
||||
else
|
||||
Result := -1;
|
||||
Result := FTabOrder;
|
||||
end;
|
||||
|
||||
{------------------------------------------------------------------------------
|
||||
@ -4232,6 +4264,9 @@ end;
|
||||
{ =============================================================================
|
||||
|
||||
$Log$
|
||||
Revision 1.296 2005/01/08 14:23:56 micha
|
||||
move taborder and tabstop to twincontrol
|
||||
|
||||
Revision 1.295 2005/01/04 11:26:26 micha
|
||||
let canfocus imply that setfocus can be called
|
||||
|
||||
|
@ -269,7 +269,7 @@ procedure NotebookTabChanged(Notebook: TCustomNotebook; NewIndex: integer);
|
||||
var
|
||||
Page: TCustomPage;
|
||||
ControlList: TList;
|
||||
Control: TControl;
|
||||
lWinControl: TWinControl;
|
||||
I: integer;
|
||||
begin
|
||||
Page := Notebook.CustomPage(NewIndex);
|
||||
@ -279,11 +279,10 @@ begin
|
||||
I := 0;
|
||||
while I < ControlList.Count do
|
||||
begin
|
||||
Control := TControl(ControlList[I]);
|
||||
if Control.TabStop and Control.Enabled and
|
||||
(Control is TWinControl) and TWinControl(Control).CanFocus then
|
||||
lWinControl := TWinControl(ControlList[I]);
|
||||
if lWinControl.TabStop and lWinControl.Enabled and lWinControl.CanFocus then
|
||||
begin
|
||||
TWinControl(Control).SetFocus;
|
||||
lWinControl.SetFocus;
|
||||
break;
|
||||
end;
|
||||
Inc(I);
|
||||
|
Loading…
Reference in New Issue
Block a user