いつもお世話になります。
ToolButtonをアクションで管理し、Downを機能させたいのですが、上手くうごいてくれません。
ちなみにこのToolButtonのEnableをリアルタイムに管理したいためにActionのUpdateを使っています。
どうやったら、ToolButtonを凹ませることができるんでしょうか?
procedure TfrmMain.actDownExecute(Sender: TObject);
begin
if Action.Checked then
begin
Action.Checked := False;
ToolButton.Down := True;
end
else
begin
Action.Checked := True;
ToolButton.Down := False;
end;
end;
//常時監視
procedure TfrmMain.actDownUpdate(Sender: TObject);
begin
if 条件 then
(Sender as TAction).Enabled := True
else
(Sender as TAction).Enabled := False;
end;
Delphi7 + win2000
間違いました。
SpeedButtonです。
TSpeedButton = class(Buttons.TSpeedButton);
とした上で
SpeedButton1.FState := bsDown;
SpeedButton1.Invalidate;
SpeedButton1.FState := bsUp;
SpeedButton1.Invalidate;
SpeedButton1.FState := bsExclusive;
SpeedButton1.Invalidate;
で表示を変化させる事が可能です
SpeedButtonはプロパティの
AllowAllUpをtrue
GroupIndexを1以上
にしておくと、「凹凸操作」できます。
ActionのAutoCheckをtrueにしておけば、
上記のOnExecuteの処理は不要です。
せっかく教えて頂いたんですが、結局できませんでした。
力不足ですいません。
各イベントに監視の一文を加えていくローテクで事を済ましました。
ツイート | ![]() |