2
votes

a firemonkey android project in delphi xe8 or xe10 or seattle, have two form. one is Form1:

procedure TForm1.FormKeyUp(Sender: TObject; var Key: Word; var KeyChar: Char;
  Shift: TShiftState);
var
  Fservice: IFMXVirtualKeyboardService;
begin
  if Key = vkHardwareBack then
  begin
    Key := 0;
    Form2.Show;
  end;
end;  

Other is Form2:

1. set Transparency=true;
2. put a layout1 on form, set Align=Contents, set Opacity=0.5
3. put a rectangle in layout1, set Align=Client, set fill color to black
4. put an other rectangle in form, set fill color to white

Now,I run it on nexus 4, i press back button, form2 show, press back button again, now form2 is gone.

now I press home button, send app to background, then send it back, press back button,but form2 does not show.or, when form2 is showing, send app to background and send it back ,the form2 disappear. Why?

Thank you.

1
if set form2.transparency=false, then the form2 shows normal.Monday Woo

1 Answers

0
votes

when you are pressing back on form2 u're invoking the sendtobackground state on android ..

you should handle also the hardwarebackkey again on form2 .. so that let's say it shows form1 again

 if Key = vkHardwareBack then
  begin
    Key := 0;
    Form1.Show;
    close;  //to close form2
  end;