我有一个带有数字框字段的框架,该字段被多次插入 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;
谢谢
过程 TfrmOrcamento.btnSalvarClick(Sender: TObject);
变量
我:整数;
vValor:双倍;
开始
for i := 0 到 Pred(listaOrcamento.Count) 做
开始
vValor:=vValor+
TfrmTipoOrc(listaOrcamento.ListItems[i].Components[0]).edValor.Value;
结尾;
结束;