Registriert seit: 9. Feb 2006
Ort: Stolberg (Rhld)
4.144 Beiträge
Delphi 10.3 Rio
|
AW: Best Practices für IOS +Android APP
7. Mai 2015, 17:41
Also
Mein letzter Stand für die Keyboard Geschichte ist:
Delphi-Quellcode:
Procedure TMainForm.CalcContentBoundsProc(Sender: TObject;var ContentBounds: TRectF);
begin
if KeyBoardVerdecktFeld and (KeyBoardPositionY > 0) then
ContentBounds.Bottom := Max(ContentBounds.Bottom,2 * ClientHeight - KeyBoardPositionY);
end;
...
MainVertScrollBox.OnCalcContentBounds := CalcContentBoundsProc;
...
procedure TMainForm.FormVirtualKeyboardHidden(Sender: TObject; KeyboardVisible: Boolean; const Bounds: TRect);
begin
KeyBoardPositionY:=0;
KeyBoardVerdecktFeld := False;
KeyBoardRestorePosition;
end;
procedure TMainForm.FormVirtualKeyboardShown(Sender: TObject; KeyboardVisible: Boolean; const Bounds: TRect);
var
LFocused : TControl;
LFocusRect: TRectF;
begin
KeyBoardOnScreen := true;
KeyBoardPositionY := Self.ClientHeight - Bounds.Height;
KeyBoardVerdecktFeld := False;
if Assigned(Focused) then
begin
LFocused := TControl(Focused.GetObject);
LFocusRect := LFocused.AbsoluteRect;
LFocusRect.Offset(MainVertScrollBox.ViewportPosition);
if (KeyBoardPositionY<>0) and (LFocusRect.Bottom>KeyBoardPositionY) then begin;
KeyBoardVerdecktFeld := True;
MainVertScrollBox.RealignContent;
Application.ProcessMessages;
MainVertScrollBox.ViewportPosition :=
PointF(MainVertScrollBox.ViewportPosition.X,
LFocusRect.Bottom - KeyBoardPositionY);
end;
end;
if not KeyBoardVerdecktFeld then
KeyBoardRestorePosition;
end;
Meine Version der FMX.Platform.Win (bin mir nicht sicher, ob das schon alles funktioniert)
Delphi-Quellcode:
constructor TVirtualKeyboardWin.Create;
var
L: integer;
S: string;
HID: HKey;
DVersion: DWORD;
Major, Minor: byte;
begin
S := ' ';
inherited Create;
SetLength(S, MAX_PATH);
L := GetSystemDirectory(PChar(S), MAX_PATH);
SetLength(S, L);
FPath := S;
FExeName := ' osk.exe';
FWndClassName := ' OSKMainClass';
FKBPresent := True;
DVersion := Winapi.Windows.GetVersion;
Major := Lo(LoWord(DVersion));
Minor := Hi(LoWord(DVersion));
FVersion := Major;
FVersion := FVersion * 100 + Minor * 10;
if DVersion < 620 then
begin
if Winapi.Windows.RegOpenKeyEx(HKEY_LOCAL_MACHINE, ' SYSTEM\CurrentControlSet\Enum', 0, KEY_READ,
HID) = ERROR_SUCCESS then
try
S := FindKeyValue(HID, ' ClassGUID', ' {4D36E96B-E325-11CE-BFC1-08002BE10318}', ' Control',
' ActiveService');
FKBPresent := S <> ' ';
finally
RegCloseKey(HID);
end;
end
else
begin
if Winapi.Windows.RegOpenKeyEx(HKEY_LOCAL_MACHINE, ' SOFTWARE\Classes\', 0, KEY_READ,HID) = ERROR_SUCCESS then
try
S := FindKeyValue(HID, ' CLSID', ' {054AAE20-4BEA-4347-8A35-64A533254A9D}', ' LocalServer32',' ');
FPath := S;
FExeName := ' TipTap.exe'; // Das ist die "Richtige"
FWndClassName := ' IPTip_Main_Window';
FKBPresent := S <> ' ';
finally
RegCloseKey(HID);
end;
//Windows.Devices.Input.KeyboardCapabilities.KeyboardPresent
end;
FNewvkbState := vkbState;
StartTimerLang;
end;
Mavarik
|
|
Zitat
|