Have an amazing solution built in RAD Studio? Let us know. Looking for discounts? Visit our Special Offers page!
News

RAD Studio10.2.2的隱藏功能

10.2.2到現在已經出來一陣子了, 除了英巴各種介紹10.2.2的文件和影片之外, 大中華區也做過10.2.2的網路研討會, 參加的朋友超過130. 前一陣子Delphi的產品經理Marco又發表了一篇blogo10.2.2額外的一些功能:
 
 
其實10.2.2除了上面已經說明的更新之外, 尚有2個重要的更新一個是Android另一個是屬於iOS.
先談談Android, 那就是10.2.2終於大致改正了鍵盤bug, 這個bug主要的原因是FireMonkey在顯示鍵盤之前沒有取得正確的大小區域, 因此也造成後續鍵盤隱藏鍵後的其餘bug.看看下面10.2.2和之前版本的差異, 10.2.2在示鍵盤之前先正確取得顯示的區域大小, 再顯示鍵盤:
 
10.2.2之前
10.2.2
procedure TVKListener.onVirtualKeyboardShown;
begin
 
  TThread.Synchronize(nil, procedure
  begin
    FKeyboardService.SetState(TVirtualKeyboardAndroid.TvkbState.Shown);
    FEvent.SetEvent;
  end);
end;
procedure TVKListener.onVirtualKeyboardShown;
begin
  WaitingForContentChanged(Self);
  TThread.Synchronize(nil, procedure
  begin
    FKeyboardService.SetState(TVirtualKeyboardAndroid.TvkbState.Shown);
    FEvent.SetEvent;
  end);
end;
 
所以這個煩惱了多個版本的bug終於修正了.

 

另外一個更強是屬於iOS平台, 原本FireMonkey就支援手勢功能, iOS平台上的雙擊手勢有時會和LongTap分不太清楚
因此10.2.2 加入了雙擊手勢的Recognizer,

    TInteractiveGesture.DoubleTap:

      begin

        DoubleTapRecognizer := TUITapGestureRecognizer.Alloc;

        DoubleTapRecognizer := TUITapGestureRecognizer.Wrap(DoubleTapRecognizer.initWithTarget(GetObjectID, sel_getUid(‘HandleDoubleTap:’)));

        DoubleTapRecognizer.setNumberOfTapsRequired(2);

        DoubleTapRecognizer.setDelegate(GetObjectID);

        View.addGestureRecognizer(DoubleTapRecognizer);

        DoubleTapRecognizer.release;

      end;

並且加入了新的處理雙擊手勢的處理函式:

procedure TFMXViewBase.HandleDoubleTap(gestureRecognizer: UITapGestureRecognizer);

var

  TouchPoint: NSPoint;

begin

  if gestureRecognizer.state = UIGestureRecognizerStateEnded then

  begin

    TouchPoint := CorrectLocationInView(gestureRecognizer, View, Form);

    DblTap(TouchPoint.Y, TouchPoint.Y);

  end;

end;

 
其效就是在10.2.2版的iOS平台上現在雙擊手勢的處理比以前的版本更精確和速了.
 
 
See What's New in 12.2 Athens See What's New in 12.2 Athens Dev Days of Summer 2-24

Reduce development time and get to market faster with RAD Studio, Delphi, or C++Builder.
Design. Code. Compile. Deploy.
Start Free Trial   Upgrade Today

   Free Delphi Community Edition   Free C++Builder Community Edition

Leave a Reply

This site uses Akismet to reduce spam. Learn how your comment data is processed.

IN THE ARTICLES