-1

I am working on XE7 in Android v4.4.4.

I have a TEdit and a TButton on form1. The following is my step:

  1. Click TButton to show another form(Form2) using ShowModal(...) or Show;
  2. Close form2 by ModalResult:= mrOK or close;

After I return to form1, the TEdit cannot edit and without caret when I click on it. I mean there is no VirtualKeyboard show up when I click on it.

Anyone has this kind of problem or what's wrong of it.

jub0bs
  • 60,866
  • 25
  • 183
  • 186
michael mok
  • 171
  • 2
  • 3

2 Answers2

0

You don't state how you are calling the modal form. I can only assume you are missing something in the code.

The documentation is updated in XE7 to correctly call a modal form and close it after use.

From documentation, how to display a modal form:

procedure MyCurrentForm.MyButtonClick(Sender: TObject);
var
  dlg: TMyModalForm;
begin
  // Create an instance of a form.
  dlg := TMyModalForm.Create(nil);

  // Configure the form. For example, give it a display name.
  dlg.Caption := 'My Modal Dialog Box';

  // Show your dialog box and provide an anonymous method that handles the closing of your dialog box.
  dlg.ShowModal(
    procedure(ModalResult: TModalResult)
    begin
      // Do something.
    end
  );
end;

From documentation, how to free a modal dialog:

You cannot free the memory allocated for your modal dialog box form within the method than handles the closing of your modal dialog box form. To free your modal dialog box form, you must handle its OnClose event as follows:

procedure TMyModalForm.FormClose(Sender: TObject; var Action: TCloseAction);
begin
  Action := TCloseAction.caFree;
end;
LU RD
  • 34,438
  • 5
  • 88
  • 296
0

Rather close Form2 with this:

Form2.hide;

Most likely focus is still on Form2 when you return to form1..

When showing a different form, i always do this:

Add this to the button that should take you to Form2

Form1.hide;
Form2.show;

Add this to form2's OnClose Event:

Form2.hide;
form1.show;

This never failed me before