If i'm searching a component like this :
TMemo(FindComponent('mymemoname'));
How do i call the onChange event of this TMemo ? The example below won't work :
TMemo(FindComponent('mymemoname')).change();
Thanks
CodePudding user response:
The Change() method is protected, so to call it directly like you are trying to, you would need to use an accessor class to grant access to the calling scope, eg:
type
TMemoAccess = class(TMemo)
end;
TMemoAccess(TMemo(FindComponent('mymemoname'))).Change();
Otherwise, you can just call the OnChange handler directly instead:
var TheMemo := TMemo(FindComponent('mymemoname'));
TheMemo.OnChange(TheMemo);
