AGB  ·  Datenschutz  ·  Impressum  







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

TEdit verursacht crash

Ein Thema von Borni · begonnen am 5. Aug 2024 · letzter Beitrag vom 6. Sep 2024
Antwort Antwort
Borni

Registriert seit: 16. Aug 2004
Ort: Algermissen
89 Beiträge
 
Delphi 12 Athens
 
#1

AW: TEdit verursacht crash

  Alt 6. Sep 2024, 13:28
Wir umgehen das ganze jetzt und überschreiben die original Routine, damit läuft es jetzt einwandfrei
Code:
{$IF DEFINED(iOS) or DEFINED(ANDROID)}
  var
    KeyboardDist : Single;
    FKBBounds: TRectF;
    Control: TControl;
{$ENDIF}

procedure Tmainform.FormVirtualKeyboardHidden(Sender: TObject; KeyboardVisible: Boolean; const Bounds: TRect);
begin
  {$IF DEFINED(iOS) or DEFINED(ANDROID)}
    if FocusedControl <> nil then
      if ((FocusedControl as TControl).Name = 'OriginText') or ((FocusedControl as TControl).Name = 'DestinationText') then
        begin
          Control := FindControlByName(SnapInLayout, 'RouteAddresses');
          if Assigned(Control) and (Control is TRectangle) then
            TRectangle(Control).Height := KeyboardDist;
        end;
    FKBBounds.Create(0, 0, 0, 0);
  {$ENDIF}
end;

procedure Tmainform.FormVirtualKeyboardShown(Sender: TObject; KeyboardVisible: Boolean; const Bounds: TRect);
{$IF DEFINED(iOS) or DEFINED(ANDROID)}
var
  Factor : Integer;
{$ENDIF}

begin
  {$IF DEFINED(iOS) or DEFINED(ANDROID)}
    try
      if (Screen.FocusControl <> nil) and (Screen.FocusControl is TMemo) then
        FocusedControl := TControl(Screen.FocusControl);
    except
      on E: Exception do
        Showmessage(E.Message);
    end;
    if FocusedControl <> nil then
      if (FocusedControl.Name = 'OriginText') or (FocusedControl.Name = 'DestinationText') then
        begin
          FKBBounds := TRectF.Create(Bounds);
          FKBBounds.TopLeft := ScreenToClient(FKBBounds.TopLeft);
          FKBBounds.BottomRight := ScreenToClient(FKBBounds.BottomRight);
          Control := FindControlByName(SnapInLayout, 'RouteAddresses');
          if FocusedControl.Name = 'OriginText' then
            Factor := 2
          else
            Factor := 1;
          if Assigned(Control) and (Control is TRectangle) then
            if Height - (FocusedControl.LocalToAbsolute(PointF(0, 0)).Y + FocusedControl.Height * Factor + 5)
               < FKBBounds.Height then
              begin
                KeyboardDist := TRectangle(Control).Height;
                TRectangle(Control).Height := TRectangle(Control).Height + (FKBBounds.Height -
                (Height - (FocusedControl.LocalToAbsolute(PointF(0, 0)).Y +
                     FocusedControl.Height * Factor + 5)));
              end;
      end;
  {$ENDIF}
end;
  Mit Zitat antworten Zitat
Antwort Antwort

 

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 17:17 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 by Thomas Breitkreuz