zoukankan      html  css  js  c++  java
  • DPF.Android.Native.Components.v2.8.1 for delphi xe6 使用DPFJAlertDialog遇到的问题

    使用DPFJAlertDialog控件时发现DPFJAlertDialog1Click不能捕获到对话框到底按了那个按键,上网搜索后找到了解决方法:

    打开DPF.Android.JAlertDialog.pas文件,找到procedure TAlertDialogOnClickListener.onClick( P1: JDialogInterface; P2: Integer )

    然后按下面的方法修改就可以。

    procedure TAlertDialogOnClickListener.onClick( P1: JDialogInterface; P2: Integer );
    begin
      FDPFJAlertDialog.FClickedIndex := P2;
      FDPFJAlertDialog.FOnClick(FDPFJAlertDialog, P2, nil);//增加这行
      P1.dismiss;
    end;

    另外,发现.DPFJAlertDialog1Click中的ButtonIndex不是从0开始,在android 4.42运行时发现第一个按键是-1,第二个按键是-2,其它版本android没有测试。

    //**********************************************************

    procedure TFProgressDialog.DPFJAlertDialog1Click(Sender: TObject;
      ButtonIndex: Integer; TextResults: TArrayOfString);
    begin
      DPFJButton1.Text:=ButtonIndex.ToString;
    end;

    procedure TFProgressDialog.DPFJButton1Click( Sender: TObject );
    begin
      Timer1.Enabled := false;
         CallInUIThreadAndWaitFinishing(
         procedure
         begin
           DPFJAlertDialog1.ShowMessageDialog( '', 'Progress Dialog Canceled!', ['Yes','No'] )
         end );
    end;

  • 相关阅读:
    173. Binary Search Tree Iterator
    199. Binary Tree Right Side View
    230. Kth Smallest Element in a BST
    236. Lowest Common Ancestor of a Binary Tree
    337. House Robber III
    449. Serialize and Deserialize BST
    508. Most Frequent Subtree Sum
    513. Find Bottom Left Tree Value
    129. Sum Root to Leaf Numbers
    652. Find Duplicate Subtrees
  • 原文地址:https://www.cnblogs.com/qiufeng2014/p/3833082.html
Copyright © 2011-2022 走看看