CONTROL+TAB en PAGECONTROL dentro de MDI-CHILD
El titulo lo dice todo!
Deseo utilizar CONTROL+TAB en un PAGECONTROL que está dentro de MDI-CHILD y en lugar de cambiar de tabsheet cambia se mdi activo (en el caso de que haya 2 mdi creado sino no hace nada)
No he visto nada en el foro sobre esto!
Pero he encontrado un trozo de codigo que no comprendí y no pude usar que segun dice sirve para solucionar mi problema!
Les agradeceria su ayuda
------------------------------------------------------------------------
To get around this one needs to intervene before IsMDIMsg is even called. There is only one opportunity to do this: the Application.OnMessage event. So add a handler for the main form OnCreate event, and add a private method to the form called AppMessage:
Código Delphi
[-]
procedure TMainForm.FormCreate(Sender: TObject);
begin
Application.OnMessage := AppMessage;
end;
procedure TMainform.Appmessage(var Msg: TMsg; var Handled: Boolean);
var
message: TWMKey;
begin
if (msg.message = WM_KEYDOWN) and (LoWord(msg.wparam) = VK_TAB) and
(GetKeyState(VK_CONTROL) < 0) and Assigned(ActiveMDIChild) then
begin
Move(msg.message, message.msg, 3 * sizeof(Cardinal));
message.result := 0;
Handled := ActiveMDIChild.IsShortcut(message);
end;
end;
This will redirect Ctrl+Tab (and Ctrl+Shift+Tab) to the active MDI childs IsShortcut function. This fires the OnShortcut event, so we can use that event on the child form to further handle the key event:
Código Delphi
[-]
function IsOnTabsheet(aControl: TWinControl; var pc: TPageControl): Boolean;
begin
while Assigned(aControl) and not (aControl is TTabsheet) do
aControl := aControl.Parent;
Result := Assigned(aControl);
if result then
pc := TTabSheet(aControl).Pagecontrol;
end;
procedure TMDIChild.FormShortCut(var Msg: TWMKey; var Handled: Boolean);
var
pc: TPageControl;
begin
if (msg.CharCode = VK_TAB) and (GetKeyState(VK_CONTROL) < 0) then
begin
if IsOnTabsheet(ActiveControl, pc) then
begin
pc.Perform(CM_DIALOGKEY, msg.CharCode, 0);
Handled := true;
end;
end;
end;
Desde ya Gracias