掲示板システム
ホーム
アクセス解析
カテゴリ
ログアウト
コンボボックスの各Itemをクリックした時に、それぞれに対応するエディットを作成するには? (ID:29267)
名前
ホームページ(ブログ、Twitterなど)のURL (省略可)
本文
質問の答えにはなってないけど こんな感じでどうかな? procedure TForm10.FormCreate(Sender: TObject); var I : Integer; begin for I:=0 to 100 do begin ComboBox1.Items.AddObject(IntToStr(I),TObject(-1)); end; ItemIndex := -1; Select := False; end; procedure TForm10.Button1Click(Sender: TObject); var G,I,J : Integer; begin G := 0; for I:=0 to ComboBox1.Items.Count -1 do begin J := Integer(ComboBox1.Items.Objects[I]); if J<>-1 then begin G := G + J; end; end; G := G + StrToIntDef(Edit1.Text,0); Label1.Caption := '合計は '+IntToStr(G); end; procedure TForm10.ComboBox1CloseUp(Sender: TObject); begin if Select = True then begin ComboBox1.Items.Objects[ItemIndex] := TObject(StrToIntDef(Edit1.Text,-1)); end; Edit1.Text := ''; Select := False; end; procedure TForm10.ComboBox1Select(Sender: TObject); begin ItemIndex := ComboBox1.ItemIndex; if Integer(ComboBox1.Items.Objects[ItemIndex]) <> -1 then begin Label1.Caption := '既に入力されています'; end; Select := True; end;
←解決時は質問者本人がここをチェックしてください。
更新する
戻る
掲示板システム
Copyright 2021 Takeshi Okamoto All Rights Reserved.