I am new to Delphi and I'm building a custom control derived from TStringGrid. I need access to the OnResize event handler. How do I get access to it? TStringGrid's parent has a OnResize event
Publish the OnResize
event, which is protected by default in TControl
.
In an own descendant, you should not use the event itself, but rather the method that triggers the event. Doing it that way will give the users of your component the opportunity to implement an own event handler.
Override the Resize method:
type
TMyGrid = class(TStringGrid)
protected
procedure Resize; override;
published
property OnResize;
end;
{ TMyGrid }
procedure TMyGrid.Resize;
begin
// Here your code that has to be run before the OnResize event is to be fired
inherited Resize; // < This fires the OnResize event
// Here your code that has to be run after the OnResize event has fired
end;
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With