Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Property AllowTabKey to allow the inner FMX form to handle Tab key events #11

Open
wants to merge 1 commit into
base: master
Choose a base branch
from
Open
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
5 changes: 5 additions & 0 deletions Parnassus.FMXContainer.pas
Original file line number Diff line number Diff line change
Expand Up @@ -58,6 +58,7 @@ TFireMonkeyContainer = class(TWinControl)
FOnDestroyForm : TOnDestroyFMXFormEvent;
FCreateFormCalled : Boolean;
FHandlingFMXActivation : Boolean;
FAllowTabKey : Boolean;

procedure DoOnCreate;
procedure DoOnDestroy;
Expand Down Expand Up @@ -98,6 +99,7 @@ TFireMonkeyContainer = class(TWinControl)
property FireMonkeyFormHandle : HWND read GetHostedFMXFormWindowHandle;
property OnCreateFMXForm : TOnCreateFMXFormEvent read FOnCreateForm write FOnCreateForm;
property OnDestroyFMXForm : TOnDestroyFMXFormEvent read FOnDestroyForm write FOnDestroyForm;
property AllowTabKey: Boolean read FAllowTabKey write FAllowTabKey default False;
property Align;
property Anchors;
property Constraints;
Expand Down Expand Up @@ -232,6 +234,7 @@ constructor TFireMonkeyContainer.Create(Owner: TComponent);
FNewFMXWndProc := nil;
FCreateFormCalled := false;
FHandlingFMXActivation := false;
FAllowTabKey := False; //if true Tab is handled inside the FMX form
TabStop := true; // Want to be focused on tabs
end;

Expand Down Expand Up @@ -674,6 +677,8 @@ procedure TFireMonkeyContainer.WMGetDlgCode(var Msg: TMessage);
begin
// From http://stackoverflow.com/questions/5632411/arrow-key-not-working-in-component
Msg.Result := DLGC_WANTALLKEYS or DLGC_WANTARROWS or DLGC_WANTCHARS;
if FAllowTabKey then
Msg.Result := Msg.Result or DLGC_WANTTAB; //handle Tabs
if Msg.lParam <> 0 then
begin
M := PMsg(Msg.lParam);
Expand Down