シリアルポートを開くアクションにリンクされている がありTToolButtonます。TJvToolBarアクションのOnExecute()イベントに次のコードがあります。
procedure TfrmMainForm.acInstrumentConnectedExecute(Sender: TObject);
begin
if acInstrumentConnected.Checked then
if MessageDlg('Are you sure you wish to disconnect?', mtWarning, [mbYes, mbNo], 0,
mbNo) <> mrYes then
exit;
acInstrumentConnected.Checked := not acInstrumentConnected.Checked;
// actual code to connect/disconnect follows...
end;
Checkedご覧のとおり、ユーザーがポートから切断したい場合はメッセージ ボックスの後にアクションを変更しますが、Downこのイベントに入る前にツールボタンのプロパティが変更されます。これにより、ユーザーがプロンプトに対して [いいえUp] を選択した場合でも、ボタンが表示されます。ToolButton がこのように動作するのはなぜですか?