Re: Inherited explained
- From: "Rudy Velthuis" <newsgroups@xxxxxxxxxxxx>
- Date: Tue, 21 Oct 2008 23:15:34 +0200
Anonymous wrote:
procedure WMSysCommand(var Msg: TWMSysCommand); message
WM_SYSCOMMAND;
procedure TForm1.WMSysCommand;
begin
if (Msg.CmdType = SC_CLOSE) then begin // X button clicked in
upper right hand corner of program interface
...do what needs to be done
end
else
inherited; //inherited means to do what you would have
otherwise done
end;
"inherited;" on its own means here: call WMSysCommand(Msg) in the
ancestor class, but only if there is such a method in that class.
Otherwise, ignore the call.
Now "inherited WMSysCommand(Msg);" would also have been possible, but
that would cause a compiler error if the ancestor does not have a
WMSysCommand.
--
Rudy Velthuis http://rvelthuis.de
"It is only those who have neither fired a shot nor heard the
shrieks and groans of the wounded who cry aloud for blood...
War is hell." -- General William Tecumseh Sherman
.
- Follow-Ups:
- Re: Inherited explained
- From: Rob Kennedy
- Re: Inherited explained
- References:
- Inherited explained
- From: Anonymous
- Inherited explained
- Prev by Date: Re: Inherited explained
- Next by Date: Re: Delphi language support in CMake build system
- Previous by thread: Revised: Re: Inherited explained
- Next by thread: Re: Inherited explained
- Index(es):