Page 1 of 1

Method not in Baseclass

PostPosted: June 20th, 2006, 10:52 am
by HPW
I am a bit puzzeled. I have a working OnChange-Event.
I want to add the OnCloseUp, but get an error.

Code: Select all
TYPE TMyDateTimePicker = CLASS( TDateTimePicker )
     private
       { Private declarations }
     protected
       { Protected declarations }
       PROCEDURE Change; OVERRIDE;
       PROCEDURE CloseUp; OVERRIDE;
     public
       { Public declarations }
       Mode,
       ChangeActiontext,
       VariableName,
       CreateFlag,
       RectangleName : STRING;
     published
       { Published declarations }
     END;


[Error] MyProject.dpr(126): Method 'CloseUp' not found in baseclass.

When I try it with a simple sample on a form, I have no problem with CloseUp.

:?:

PostPosted: June 21st, 2006, 6:30 pm
by Kambiz
Neither TDateTimePicker nor its ancestors have a CloseUp virtual method.

You can override CNNotify message handler to reach to your goal.

Code: Select all
procedure TMyDateTimePicker.CNNotify(var Message: TWMNotify);
begin
  inherited;
  if Message.NMHdr^.code = DTN_CLOSEUP then
  begin
    // Write CloseUp code here
  end;
end;

PostPosted: June 21st, 2006, 8:52 pm
by HPW
Seems that I still lack the real understanding of delphi! (sometimes)

Thanks very much for your help, I will give it a try.

:roll:

PostPosted: June 21st, 2006, 9:20 pm
by HPW
My delphi 5 gives me (translated):
[Error] MyProject.dpr(252): Undefinined Identifier: 'DTN_CLOSEUP'

PostPosted: June 21st, 2006, 10:49 pm
by Kambiz
Here is the value:

Code: Select all
const
  DTN_FIRST    = 0-760;
  DTN_CLOSEUP  = DTN_FIRST + 7;

PostPosted: June 22nd, 2006, 6:21 pm
by HPW
Thanks again.
Works fine now.

Neither TDateTimePicker nor its ancestors have a CloseUp virtual method.


Where is such info documented in delphi doc's or elsewhere?
(That I can find the info myself the next time)

PostPosted: June 22nd, 2006, 7:58 pm
by Johnny_Bit
sources dude... sourcess. the power is within them.

PostPosted: June 22nd, 2006, 8:20 pm
by Kambiz
Besides the source code, I do suggest to obtain your own copy of MSDN. ;)

PostPosted: June 22nd, 2006, 9:18 pm
by Johnny_Bit
true to that... although I do loathe the microsoft, if you want to develop for their whatever, MSDN is must.