2009. április 23., csütörtök

Navigate a TPageControl using Ctrl-Tab and Ctrl-Shift-Tab if several pagecontrols are on a form


I have a PageControl having 3 TabSheets. If this PageControl has a Panel as its parent, then I am able navigate between the tabsheets using Ctrl-Tab (forward) or Shift-Ctrl-Tab (backward) using the keyboard. But if the same pagecontrol has another Tabsheet of a Pagecontrol as its parent, then I am not able to navigate between the tabsheets of the child pagecontrol using the keyboard even though the focus is on the child pagecontrol.


Handling proper Ctrl-Tab and Ctrl-Shift-Tab switching of pages if several pagecontrols are on a form:

In form declaration:

procedure CMDialogKey(var msg: TCMDialogKey); message CM_DIALOGKEY;

procedure TForm1.CMDialogKey(var msg: TCMDialogKey);
  Control: TWinControl;
  with Msg do
    if (charcode = VK_TAB) and (GetKeyState(VK_CONTROL) < 0) then
      Control := ActiveControl;
      while Assigned(Control) do
        if Control is TPageControl then
          Control.Perform(CM_DIALOGKEY, charcode, keydata);
          Control := Control.Parent;

Nincsenek megjegyzések:

Megjegyzés küldése