我有一个带有
TFrame
字段的 TNumberBox
,该字段在 Firemonkey 中的 TListBox
内多次插入。循环遍历 TListBox.ListItems
时如何访问该对象的值?
框架:
type
TfrmTipoOrc = class(TFrame)
Rectangle1: TRectangle;
edValor: TNumberBox;
end;
形式:
type
TfrmOrcamento = class(TForm)
btnSalvar: TSpeedButton;
listaOrcamento: TListBox;
procedure btnSalvarClick(Sender: TObject);
end;
implementation
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;
procedure TfrmOrcamento.btnSalvarClick(Sender: TObject);
var
i : integer;
vValor : Double;
begin
for i := 0 to Pred(listaOrcamento.Count) do
begin
vValor:=vValor+
TfrmTipoOrc(listaOrcamento.ListItems[i].Components[0]).edValor.Value;
end;
end;