如何在继承调用后停止执行?

时间:2016-05-24 01:04:53

标签: delphi delphi-xe7 onmousedown inherited

我使用来自TMS的TAdvGlowButton按钮控件,默认情况下,它会在Down上将MouseDown属性设置为true。我希望能够在需要时阻止将此属性设置为True。 MouseDown上的执行流程在类的MouseDown过程中启动:

procedure TAdvCustomGlowButton.MouseDown(Button: TMouseButton; Shift: TShiftState; X,
  Y: Integer);
...
begin
  inherited; // Calls my local OnMouseDown method
  ...        // <- I would like to skip/cancel/stop execution after inherited call, so it never gets to Down := True line
  Down = True; 
  ...

end;

我的本​​地按钮OnMouseDown:

procedure TForm1.AdvGlowButton1MouseDown(Sender: TObject;
  Button: TMouseButton; Shift: TShiftState; X, Y: Integer);
begin
  ShowMessage('Local Mouse Down');
  if True then
    AdvGlowButton1.OnMouseDown:=nil; //<- I would like to stop execution 
end;

我尝试将OnMouseDown设置为nil,但这并不起作用,执行流程会返回到MouseDown并继续运行。

如果可能的话,我想避免改变原始课程中的任何内容。

有没有办法在原始继承的呼叫后停止/中止/取消进一步执行?

0 个答案:

没有答案
相关问题