-1

約 50 個の TListboxItems 別名アイテムを含む TListBox があります。各項目には、ラベルとして使用される 3 つの TText、「ステータス」を示す 48x48 の解像度の 1 つの TImage、および項目を選択するためのチェック ボックスが含まれます。デバイス上では、スクロール時に大きなラグ タイムが発生します。多くの場合、不安定で、散発的で、一貫性がありません。

アイテムが多すぎるからですか?それとも、TTexts、Timageなどが含まれているためですか? または、TListbox のスクロール プロセスをスムーズにするためにできることはありますか。

Delphi xe5 を使用して iOS アプリケーションを開発しています。TListbox の 'sorted' プロパティが := False; であることを確認しました。

更新 (ジェリー ドッジへの応答):

while XMLNode <> nil do begin
            Main_Form.LBoxEntries.Items.Add('');
            Item1:=Main_Form.LBoxEntries.ListItems[Main_Form.LBoxEntries.Items.Count-1];
            Item1.Height              := 80;
            Item1.Width               := ClientWidth;

          if XMLNode.ChildNodes['SCANSTATUS'].Text = '0' then begin
            Item1.ItemData.Bitmap := Main_Form.Red.Bitmap;
            Item1.Tag             := 0;
          end;
          if XMLNode.ChildNodes['SCANSTATUS'].Text = '1' then begin
            Item1.ItemData.Bitmap := Main_Form.Orange.Bitmap;
            Item1.Tag             := 1;
          end;
          if XMLNode.ChildNodes['SCANSTATUS'].Text = '2' then begin
            Item1.ItemData.Bitmap := Main_Form.Green.Bitmap;
            Item1.Tag             := 2;
          end;

          Customer := TText.Create(nil);
            Customer.Parent         := Item1;
            Customer.Position.X     := 95;
            Customer.Position.Y     := 8;
            Customer.Text           := XMLNode.childNodes['CUSTOMERNAME'].text;
            Customer.Width          := Item1.Width - 105;
            Customer.WordWrap       := False;
            Customer.Color          := TAlphaColors.Blue;
            Customer.Trimming       := TTextTrimming(1);
            Customer.Height         := 20;
            Customer.Font.Size      := 18;
            Customer.HorzTextAlign  := TTextAlign(1);
            Customer.Anchors := [TanchorKind.akLeft,TanchorKind.akRight];
            Customer.WordWrap       := False;

          Product := TText.Create(nil);
            Product.Parent        := Item1;
            Product.Position.X    := 105;
            Product.Position.Y    := 30;
            Product.Text          := 'Product: ' +XMLNode.childNodes['PRODUCT'].text;
            Product.Width         := Item1.Width - 115;
            Product.Trimming      := TTextTrimming(1);
            Product.Height        := 20;
            Product.Font.Size     := 15;
            Product.HorzTextAlign := TTextAlign(1);
            Product.Anchors := [TanchorKind.akLeft,TanchorKind.akRight];
            Product.WordWrap      := False;

          QTY := TText.Create(nil);
            QTY.Parent        := Item1;
            QTY.Position.X    := 105;
            QTY.Position.Y    := 50;
            QTY.Text          := 'QTY: ('+XMLNode.childNodes['QTY'].text+')';
            QTY.Width         := Item1.Width - 115;
            QTY.Trimming      := TTextTrimming(1);
            QTY.Height        := 20;
            QTY.Font.Size     := 15;
            QTY.HorzTextAlign := TTextAlign(1);
            QTY.Anchors := [TanchorKind.akLeft,TanchorKind.akRight];
            QTY.WordWrap      := False;

          Item1.ItemData.Detail :=  ' |' + XMLNode.childNodes['SID'].Text+'|'+
                                    ' |' + XMLNode.childNodes['CUSTOMERNAME'].Text+'|'+
                                    ' |' + XMLNode.childNodes['PRODUCT'].text+'|'+
                                    ' |' + XMLNode.childNodes['QTY'].Text+'| ';


          XMLNode := XMLNode.NextSibling;
        end;
        Main_Form.LBoxEntries.EndUpdate;

投稿アクション/イベントはアイテムに関連付けられていません。

4

2 に答える 2

2

私が使用していたすべての TLayouts を削除しました。その中にリストボックスが配置されていましたが、まだ遅れています。

次に、フォーム コントロール (サイド メニューを開くときのスライド効果用) として機能する親 TPanel を削除すると、ラグがなくなりました。さらにテストを行って、TPanel を TLayout に交換できるかどうか、またはそれに応じてプログラムとサイド メニューを調整できるかどうかを確認します。

更新: TPanel がスクロール時のラグの原因です。コンポーネントを TLayout に交換したところ、これまでどおりスムーズに動作します。

于 2013-10-21T17:48:34.727 に答える
1

スクロールする必要がある場合は、TListboxではなくTListViewを使用するのが標準的なアドバイスだと思います。TListView に 100 以上のアイテムを含む XE5 を使用して、iOS および Android でシンプルなアプリを作成しましたが、スクロールは非常にスムーズでした。

于 2013-10-18T21:05:11.107 に答える