掲示板システム
ホーム
アクセス解析
カテゴリ
ログアウト
StringGridにコンボボックスを配置し、上下キーでセル移動するには? (ID:11453)
名前
ホームページ(ブログ、Twitterなど)のURL (省略可)
本文
>https://www.petitmonte.com/bbs/answers?question_id=914 ここの最後尾のサンプルを下のようにチョット書き換え。 { EVENT : ComboBox1 OnKeyDown } procedure TForm1.ComboBox1KeyDown(Sender: TObject; var Key: Word; Shift: TShiftState); begin if Shift <> [] then exit; with StringGrid1 do begin if Key = VK_RETURN then begin ActiveControl := StringGrid1; Col := Col + 1; end else if Key = VK_LEFT then begin ActiveControl := StringGrid1; Col := Col - 1; end else if Key = VK_RIGHT then begin ActiveControl := StringGrid1; Col := Col + 1; end else if (Key = VK_UP)and(Row > 1) then begin ActiveControl := StringGrid1; Row := Row - 1; end else if (Key = VK_DOWN)and(Row < RowCount - 1) then begin ActiveControl := StringGrid1; Row := Row + 1; end; Key := 0; end; end; ※ただし、ComboBox1の Styleが DropDownListの場合は、これだけではマズイと思うけど…
←解決時は質問者本人がここをチェックしてください。
戻る
掲示板システム
Copyright 2021 Takeshi Okamoto All Rights Reserved.