AGB  ·  Datenschutz  ·  Impressum  







Anmelden
Nützliche Links
Registrieren
Thema durchsuchen
Ansicht
Themen-Optionen

Android BackButton..

Ein Thema von erich.wanker · begonnen am 27. Jul 2017 · letzter Beitrag vom 27. Jul 2017
 
Rollo62

Registriert seit: 15. Mär 2007
4.175 Beiträge
 
Delphi 12 Athens
 
#3

AW: Android BackButton..

  Alt 27. Jul 2017, 11:37
Probier mal das ...

Delphi-Quellcode:
// Processes the KeyUp in Forms, to standard behaviour of Android Back key
function Form_KeyUp_Back(const AForm : TCustomForm; var Key: Word; var KeyChar: Char; Shift: TShiftState; bCanTerminate : Boolean) : Boolean;
{$IF DEFINED(ANDROID) or DEFINED(IOS) }
var
  FService : IFMXVirtualKeyboardService;
{$ENDIF DEFINED(ANDROID) or DEFINED(IOS) }
begin

  Result := False;

  //V3
  if Key = vkHardwareBack then
  begin

{$IF DEFINED(ANDROID) or DEFINED(IOS) }
    TPlatformServices.Current.SupportsPlatformService(IFMXVirtualKeyboardService, IInterface(FService));
    if (FService <> nil) and (TVirtualKeyboardState.Visible in FService.VirtualKeyBoardState) then
    begin
      // Back button pressed, keyboard visible, so do nothing...
    end else
    begin
      Key := 0;
      Result := True;

      // Back button pressed, keyboard not visible or not supported on this platform,
      // lets exit the app... if condition is met
      // !! Mobile apps cannot be terminated
      if bCanTerminate then
      begin

      end;

    end;
{$ENDIF DEFINED(ANDROID) or DEFINED(IOS) }

  end;

end;

procedure TMain_Frm.FormKeyUp(Sender: TObject; var Key: Word;
  var KeyChar: Char; Shift: TShiftState);
begin

{$IFDEF ANDROID}
  if Form_KeyUp_Back(Self, Key, KeyChar, Shift, True) then
  begin
    if TabControlHeader.ActiveTab <> TabItemH1ViewEntry then
    begin

      ....

    end else
    begin
      // May Finish the main Form here, w/o closing it

      View_Hide;
    end;

    Exit;
  end;
{$ENDIF ANDROID}

  if Key = vkReturn then
  begin

  end;

end;
Rollo
  Mit Zitat antworten Zitat
 


Forumregeln

Es ist dir nicht erlaubt, neue Themen zu verfassen.
Es ist dir nicht erlaubt, auf Beiträge zu antworten.
Es ist dir nicht erlaubt, Anhänge hochzuladen.
Es ist dir nicht erlaubt, deine Beiträge zu bearbeiten.

BB-Code ist an.
Smileys sind an.
[IMG] Code ist an.
HTML-Code ist aus.
Trackbacks are an
Pingbacks are an
Refbacks are aus

Gehe zu:

Impressum · AGB · Datenschutz · Nach oben
Alle Zeitangaben in WEZ +1. Es ist jetzt 14:44 Uhr.
Powered by vBulletin® Copyright ©2000 - 2025, Jelsoft Enterprises Ltd.
LinkBacks Enabled by vBSEO © 2011, Crawlability, Inc.
Delphi-PRAXiS (c) 2002 - 2023 by Daniel R. Wolf, 2024-2025 by Thomas Breitkreuz