读书人

关于使用Frame怎么实现Tab功能

发布时间: 2012-02-19 19:43:38 作者: rapoo

关于使用Frame如何实现Tab功能
目前在Form下使用一个Frame,在Frame里发现无法实现跳转到外部的Tab

void __fastcall Frame::EditKeyDown(TObject *Sender, WORD &Key,
TShiftState Shift)
{
if(Key == 13)
{
//Perform(WM_NEXTDLGCTL, 0, 0);
SelectNext(Form-> ActiveControl, true, true);
}
}

求指教

[解决办法]
看看delphi的内核,不可能实现了。

Delphi(Pascal) code
function TWinControl.FindNextControl(CurControl: TWinControl;  GoForward, CheckTabStop, CheckParent: Boolean): TWinControl;var  I, StartIndex: Integer;  List: TList;begin  Result := nil;  List := TList.Create;  try    GetTabOrderList(List);    if List.Count > 0 then    begin      StartIndex := List.IndexOf(CurControl);      if StartIndex = -1 then        if GoForward then StartIndex := List.Count - 1 else StartIndex := 0;      I := StartIndex;      repeat        if GoForward then        begin          Inc(I);          if I = List.Count then I := 0;        end else        begin          if I = 0 then I := List.Count;          Dec(I);        end;        CurControl := List[I];        if CurControl.CanFocus and          (not CheckTabStop or CurControl.TabStop) and          (not CheckParent or (CurControl.Parent = Self)) then          Result := CurControl;      until (Result <> nil) or (I = StartIndex);    end;  finally    List.Free;  end;end;procedure TWinControl.GetTabOrderList(List: TList);var  I: Integer;  Control: TWinControl;begin  if FTabList <> nil then    for I := 0 to FTabList.Count - 1 do    begin      Control := FTabList[I];      List.Add(Control);      Control.GetTabOrderList(List);    end;end; 

读书人网 >C++ Builder

热点推荐