/, Uncategorized/Coping with the Virtual Keyboard Done bar and clicking controls on the iOS7 simulator

Coping with the Virtual Keyboard Done bar and clicking controls on the iOS7 simulator

If you’ve installed update 1 for XE5, you’ll soon find that there’s a couple of issues that have moved from the device to the simulator; namely the placement of the Virtual Keyboard “Done” bar, and clicking of controls is vertically askew.

These two posts relate to the issues:

http://delphi.radsoft.com.au/2013/10/coping-with-done-bar-on-ios7-devices/

http://delphi.radsoft.com.au/2013/10/coping-with-clicking-controls-on-ios7-devices/

First the patch for clicking of controls. Make a copy of FMX.Platform.iOS and put it somewhere in the compiler search path. Then make the following changes:

function CorrectLocationInView(const P: CGPoint; const Form: TCommonCustomForm): CGPoint; overload;
begin
  Result := P;
  {$IFDEF CPUARM} // <-- ADD THIS LINE
  if TOSVersion.Check(7, 0) and Assigned(Form) and (Form.BorderStyle <> TFmxFormBorderStyle.bsNone) then
    Result.y := Result.y - 20; // iOS 7 offset
  {$ENDIF} // <-- ADD THIS LINE
end;

Next, a patch for the placement of the “Done” bar. Make a copy of  FMX.VirtualKeyboard.iOS and put it somewhere in the compiler search path. Then make the following changes to the last part of TCocoaVirtualKeyboardService.GetToolbarFrame:

function TCocoaVirtualKeyboardService.GetToolbarFrame: NSRect;
const
  StatusBarHeight = 20;
var
  ScreenRect: NSRect;
begin
  // ...
  // SOME CODE OMITTED. THE IMPORTANT PARTS FOLLOW
  // ..
  {$IFDEF CPUARM} // ADD THIS LINE
  if TOSVersion.Check(7, 0) then
    Result.origin.y := Result.origin.y + StatusBarHeight;
  {$ENDIF} // ADD THIS LINE
end;

This should have your code working properly in the iOS7 simulator

 

By |2014-10-14T19:14:58+00:00October 29, 2013 3:23 pm|Patches, Uncategorized|0 Comments

About the Author:

Leave a Reply

Show Buttons
Hide Buttons