ActionでToolButtonのDownを機能させたい

解決


印刷屋  2008-03-05 10:56:01  No: 30056

いつもお世話になります。

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


印刷屋  2008-03-05 10:56:58  No: 30057

間違いました。
SpeedButtonです。


KHE00221  2008-03-06 01:57:50  No: 30058

TSpeedButton = class(Buttons.TSpeedButton);

とした上で

SpeedButton1.FState := bsDown;
SpeedButton1.Invalidate;
 
SpeedButton1.FState := bsUp;
SpeedButton1.Invalidate;    

SpeedButton1.FState := bsExclusive;
SpeedButton1.Invalidate;

で表示を変化させる事が可能です


凹凸  2008-03-25 02:51:23  No: 30059

SpeedButtonはプロパティの
AllowAllUpをtrue
GroupIndexを1以上
にしておくと、「凹凸操作」できます。

ActionのAutoCheckをtrueにしておけば、
上記のOnExecuteの処理は不要です。


印刷屋  2008-04-03 08:06:56  No: 30060

せっかく教えて頂いたんですが、結局できませんでした。
力不足ですいません。
各イベントに監視の一文を加えていくローテクで事を済ましました。


※返信する前に利用規約をご確認ください。

※Google reCAPTCHA認証からCloudflare Turnstile認証へ変更しました。






  このエントリーをはてなブックマークに追加