gpt4 book ai didi

delphi - 具有Onclick的自定义按钮,隐藏Onclick事件

转载 作者:行者123 更新时间:2023-12-03 19:24:09 25 4
gpt4 key购买 nike

我创建了一个自定义按钮。我用网格将其连接起来。而且我为On-click事件制作了自定义代码。

Code波纹管经过简化,以便于理解。

一切正常,如果我单击按钮,则显示消息。但是由于我在这里运行更多代码。我想尽可能隐藏此按钮的所有事件。即使我实际上将TcxButton用作父类,这也是可能的吗?

unit cxGridButton;

interface

uses
System.SysUtils, System.Classes, Vcl.Controls, Vcl.StdCtrls, cxButtons,
cxGridDBTableView, Dialogs;

type
TcxGridButton = class(TcxButton)
private
FGridView : TcxGridDBTableView;

protected
{ Protected declarations }
public
{ Public declarations }
procedure Click; override;
published
property DBGridView : TcxGridDBTableView read FGridView write FGridView;
end;

procedure Register;

implementation

procedure TcxGridButton.Click;
begin
inherited; // call the inherited Click method.

ShowMessage('AHA');
end;

procedure Register;
begin
RegisterComponents('James', [TcxGridButton]);
end;

end.

最佳答案

在设计时,可以在注册组件时通过调用published从对象检查器中隐藏UnlistPublishedProperty()属性。

在运行时,您不能阻止代码访问public / published属性。

关于delphi - 具有Onclick的自定义按钮,隐藏Onclick事件,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/56877548/

25 4 0
Copyright 2021 - 2024 cfsdn All Rights Reserved 蜀ICP备2022000587号
广告合作:1813099741@qq.com 6ren.com