Method not in Baseclass

Please discuss general Delphi programming topics here.

Method not in Baseclass

Postby HPW » June 20th, 2006, 10:52 am

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.

:?:
Hans-Peter
HPW
Moderator
Moderator
 
Posts: 238
Joined: February 25th, 2006, 10:19 am
Location: Germany

Postby Kambiz » June 21st, 2006, 6:30 pm

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;
Kambiz
User avatar
Kambiz
Administrator
Administrator
 
Posts: 2429
Joined: March 7th, 2003, 7:10 pm

Postby HPW » June 21st, 2006, 8:52 pm

Seems that I still lack the real understanding of delphi! (sometimes)

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

:roll:
Hans-Peter
HPW
Moderator
Moderator
 
Posts: 238
Joined: February 25th, 2006, 10:19 am
Location: Germany

Postby HPW » June 21st, 2006, 9:20 pm

My delphi 5 gives me (translated):
[Error] MyProject.dpr(252): Undefinined Identifier: 'DTN_CLOSEUP'
Hans-Peter
HPW
Moderator
Moderator
 
Posts: 238
Joined: February 25th, 2006, 10:19 am
Location: Germany

Postby Kambiz » June 21st, 2006, 10:49 pm

Here is the value:

Code: Select all
const
  DTN_FIRST    = 0-760;
  DTN_CLOSEUP  = DTN_FIRST + 7;
Kambiz
User avatar
Kambiz
Administrator
Administrator
 
Posts: 2429
Joined: March 7th, 2003, 7:10 pm

Postby HPW » June 22nd, 2006, 6:21 pm

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)
Hans-Peter
HPW
Moderator
Moderator
 
Posts: 238
Joined: February 25th, 2006, 10:19 am
Location: Germany

Postby Johnny_Bit » June 22nd, 2006, 7:58 pm

sources dude... sourcess. the power is within them.
Johnny_Bit
VIP Member
VIP Member
 
Posts: 455
Joined: June 15th, 2003, 9:56 am

Postby Kambiz » June 22nd, 2006, 8:20 pm

Besides the source code, I do suggest to obtain your own copy of MSDN. ;)
Kambiz
User avatar
Kambiz
Administrator
Administrator
 
Posts: 2429
Joined: March 7th, 2003, 7:10 pm

Postby Johnny_Bit » June 22nd, 2006, 9:18 pm

true to that... although I do loathe the microsoft, if you want to develop for their whatever, MSDN is must.
Johnny_Bit
VIP Member
VIP Member
 
Posts: 455
Joined: June 15th, 2003, 9:56 am


Return to Delphi Programming

Who is online

Users browsing this forum: No registered users and 3 guests

cron