Icon View Thread

The following is the text of the current message along with any replies.
Messages 1 to 5 of 5 total
Thread Can I handle the "back" button?
Tue, May 15 2018 8:31 AMPermanent Link

Ralf Mimoun

Hi all,

it would be nice if you could close/cancel a dialog by pressing the back button on your smartphone. Is there any event, handler etc. to make it happen?

Ralf
Tue, May 15 2018 9:26 AMPermanent Link

Uli Becker

Ralf,

> it would be nice if you could close/cancel a dialog by pressing the back button on your smartphone. Is there any event, handler etc. to make it happen?

Yes that works using TAddress and its anchor property: have a look here to get the basic information:

https://www.elevatesoft.com/forums?action=view&category=ewb&id=ewb_general&page=1&msg=11605#11605

Uli
Tue, May 15 2018 10:42 AMPermanent Link

Ralf Mimoun

Uli,

thanks for the hint. I checked the discussion before asking Smile but I don't see how that can be used in a dialog or form made visible with .ShowModal. Maybe it might work if I handle Application.OnAnchor in every modal form (simply calling Close there), set .Anchor in these form, and set it again after the modal form closed. But I must admit that this is a little bit more work than I an willing to invest Smile


Uli Becker wrote:

Ralf,

> it would be nice if you could close/cancel a dialog by pressing the back button on your smartphone. Is there any event, handler etc. to make it happen?

Yes that works using TAddress and its anchor property: have a look here to get the basic information:

https://www.elevatesoft.com/forums?action=view&category=ewb&id=ewb_general&page=1&msg=11605#11605

Uli
Wed, May 16 2018 7:44 AMPermanent Link

Uli Becker

Ralf,

> But I must admit that this is a little bit more work than I an willing to invest Smile

Up to you - for me it's not a big deal:

I assign the Address.Anchor property in the OnShow event of each form:

   Address.Anchor := Self.Name;

In the OnAnchorChange event handler it looks like this:

....
else if SameText(Address.Anchor,'AdminForm') then
   begin
      if Assigned(NewsEditForm) then
         NewsEditForm.Close;
      AdminForm.Show;
   end else if SameText(Address.Anchor,'NewsEditForm') then
   begin
      if Assigned(HTMLEditForm) then
         HTMLEditForm.Close;
   end else if SameText(Address.Anchor,'') then
....

Uli
Wed, May 16 2018 10:15 AMPermanent Link

Ralf Mimoun

Uli,

I tested it, and it works great. In full screen you don't even see the more or less ugly bookmarks Smile

Ralf


Uli Becker wrote:

Ralf,

> But I must admit that this is a little bit more work than I an willing to invest Smile

Up to you - for me it's not a big deal:

I assign the Address.Anchor property in the OnShow event of each form:

   Address.Anchor := Self.Name;

In the OnAnchorChange event handler it looks like this:

....
else if SameText(Address.Anchor,'AdminForm') then
   begin
      if Assigned(NewsEditForm) then
         NewsEditForm.Close;
      AdminForm.Show;
   end else if SameText(Address.Anchor,'NewsEditForm') then
   begin
      if Assigned(HTMLEditForm) then
         HTMLEditForm.Close;
   end else if SameText(Address.Anchor,'') then
....

Uli
Image