mirror of
https://gitlab.com/freepascal.org/lazarus/lazarus.git
synced 2025-12-03 14:27:18 +01:00
implemented tabstop
git-svn-id: trunk@2511 -
This commit is contained in:
parent
d99d6b8668
commit
22f5e24639
@ -988,26 +988,28 @@ begin
|
|||||||
List := TList.Create;
|
List := TList.Create;
|
||||||
GetTabOrderList(List);
|
GetTabOrderList(List);
|
||||||
If List.Count > 0 then begin
|
If List.Count > 0 then begin
|
||||||
J := List.IndexOf(CurrentControl) + 1;
|
J := List.IndexOf(CurrentControl);
|
||||||
If J >= List.Count then
|
if J<0 then exit;
|
||||||
J := -1
|
|
||||||
else
|
|
||||||
Dec(J);
|
|
||||||
I := J;
|
I := J;
|
||||||
Repeat
|
Repeat
|
||||||
If GoForward then
|
If GoForward then begin
|
||||||
Inc(I);
|
Inc(I);
|
||||||
If (I < List.Count) and (List[I] <> nil) then begin
|
if I>=List.Count then
|
||||||
Next := TControl(List[I]);
|
I:=0;
|
||||||
If ((Not CheckTabStop or Next.TabStop) and
|
end else begin
|
||||||
(not CheckParent or (Next.Parent = Self)))
|
Dec(I);
|
||||||
and (Next.Enabled and Next.Visible)
|
if I<0 then
|
||||||
then begin
|
I:=List.Count-1;
|
||||||
if not OnlyWinControls or (Next is TWinControl) then
|
|
||||||
Result := Next;
|
|
||||||
end;
|
|
||||||
end;
|
end;
|
||||||
until (Result <> nil) or (I = J) or (I >= List.Count);
|
if I=J then exit;
|
||||||
|
|
||||||
|
Next := TControl(List[I]);
|
||||||
|
If (((Not CheckTabStop) or Next.TabStop)
|
||||||
|
and ((not CheckParent) or (Next.Parent = Self)))
|
||||||
|
and (Next.Enabled and Next.Visible)
|
||||||
|
and ((not OnlyWinControls) or (Next is TWinControl)) then
|
||||||
|
Result := Next;
|
||||||
|
until (Result <> nil);
|
||||||
end;
|
end;
|
||||||
finally
|
finally
|
||||||
List.Free;
|
List.Free;
|
||||||
@ -1025,6 +1027,35 @@ begin
|
|||||||
GoForward,CheckTabStop,CheckParent,true));
|
GoForward,CheckTabStop,CheckParent,true));
|
||||||
end;
|
end;
|
||||||
|
|
||||||
|
procedure TWinControl.FixupTabList;
|
||||||
|
var
|
||||||
|
Count, I, J: Integer;
|
||||||
|
List: TList;
|
||||||
|
Control: TWinControl;
|
||||||
|
begin
|
||||||
|
if FWinControls <> nil then
|
||||||
|
begin
|
||||||
|
List := TList.Create;
|
||||||
|
try
|
||||||
|
Count := FWinControls.Count;
|
||||||
|
List.Count := Count;
|
||||||
|
for I := 0 to Count - 1 do
|
||||||
|
begin
|
||||||
|
Control := TWinControl(FWinControls[I]);
|
||||||
|
J := Control.FTabOrder;
|
||||||
|
if (J >= 0) and (J < Count) then List[J] := Control;
|
||||||
|
end;
|
||||||
|
for I := 0 to Count - 1 do
|
||||||
|
begin
|
||||||
|
Control := TWinControl(List[I]);
|
||||||
|
if Control <> nil then Control.UpdateTabOrder(I);
|
||||||
|
end;
|
||||||
|
finally
|
||||||
|
List.Free;
|
||||||
|
end;
|
||||||
|
end;
|
||||||
|
end;
|
||||||
|
|
||||||
{------------------------------------------------------------------------------
|
{------------------------------------------------------------------------------
|
||||||
TWinControl GetTabOrderList
|
TWinControl GetTabOrderList
|
||||||
------------------------------------------------------------------------------}
|
------------------------------------------------------------------------------}
|
||||||
@ -1539,6 +1570,25 @@ Begin
|
|||||||
end;
|
end;
|
||||||
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;
|
||||||
|
|
||||||
{------------------------------------------------------------------------------
|
{------------------------------------------------------------------------------
|
||||||
TWinControl KeyDown
|
TWinControl KeyDown
|
||||||
------------------------------------------------------------------------------}
|
------------------------------------------------------------------------------}
|
||||||
@ -2467,6 +2517,7 @@ end;
|
|||||||
procedure TWinControl.Loaded;
|
procedure TWinControl.Loaded;
|
||||||
begin
|
begin
|
||||||
inherited Loaded;
|
inherited Loaded;
|
||||||
|
FixupTabList;
|
||||||
if wcfColorChanged in FFlags then begin
|
if wcfColorChanged in FFlags then begin
|
||||||
CNSendMessage(LM_SETCOLOR, Self, nil);
|
CNSendMessage(LM_SETCOLOR, Self, nil);
|
||||||
Exclude(FFlags,wcfColorChanged);
|
Exclude(FFlags,wcfColorChanged);
|
||||||
@ -2591,6 +2642,14 @@ begin
|
|||||||
Result:=BoundsLockCount>0;
|
Result:=BoundsLockCount>0;
|
||||||
end;
|
end;
|
||||||
|
|
||||||
|
function TWinControl.GetTabOrder: TTabOrder;
|
||||||
|
begin
|
||||||
|
if FParent <> nil then
|
||||||
|
Result := FParent.FTabList.IndexOf(Self)
|
||||||
|
else
|
||||||
|
Result := -1;
|
||||||
|
end;
|
||||||
|
|
||||||
{------------------------------------------------------------------------------
|
{------------------------------------------------------------------------------
|
||||||
Method: TWinControl.SetBounds
|
Method: TWinControl.SetBounds
|
||||||
Params: aLeft, aTop, aWidth, aHeight
|
Params: aLeft, aTop, aWidth, aHeight
|
||||||
@ -2737,6 +2796,9 @@ end;
|
|||||||
{ =============================================================================
|
{ =============================================================================
|
||||||
|
|
||||||
$Log$
|
$Log$
|
||||||
|
Revision 1.134 2003/06/10 17:23:35 mattias
|
||||||
|
implemented tabstop
|
||||||
|
|
||||||
Revision 1.133 2003/06/10 12:28:23 mattias
|
Revision 1.133 2003/06/10 12:28:23 mattias
|
||||||
fixed anchoring controls
|
fixed anchoring controls
|
||||||
|
|
||||||
|
|||||||
Loading…
Reference in New Issue
Block a user