Firemonkey - 有关访问列表框项目中的 Frame 对象的问题

问题描述 投票:0回答:1

我有一个带有数字框字段的框架,该字段被多次插入 Firemonkey 中的列表框内。 循环遍历 ListBox 时如何访问该对象的值?

框架:

type
  TfrmTipoOrc = class(TFrame)
    Rectangle1: TRectangle;
    edValor: TNumberBox;
  private
    { Private declarations }
  public
    { Public declarations }
  end;

在表格中


type
  TfrmOrcamento = class(TForm)
    recTopo: TRectangle;
    lblTopo: TLabel;
    btnFechar: TSpeedButton;
    imgFechar: TImage;
    btnSalvar: TSpeedButton;
    imgSalvar: TImage;
    listaOrcamento: TListBox;
    procedure btnFecharClick(Sender: TObject);
    procedure FormClose(Sender: TObject; var Action: TCloseAction);
    procedure FormCreate(Sender: TObject);
    procedure btnSalvarClick(Sender: TObject);
  private
    { Private declarations }
  public
    { Public declarations }
  end;


procedure TfrmOrcamento.btnSalvarClick(Sender: TObject);
var
    i : integer; 
    vValor : Double;
begin    
    for i := 0 to Pred(listaOrcamento.Count) do
        begin
            //vValor := vValor + edValor.Value;
            //How to access the **edValor** object (in the Frame)
            //?????
        end;
end;

谢谢

delphi firemonkey
1个回答
0
投票

过程 TfrmOrcamento.btnSalvarClick(Sender: TObject); 变量 我:整数; vValor:双倍; 开始
for i := 0 到 Pred(listaOrcamento.Count) 做 开始 vValor:=vValor+ TfrmTipoOrc(listaOrcamento.ListItems[i].Components[0]).edValor.Value; 结尾; 结束;

© www.soinside.com 2019 - 2024. All rights reserved.