Getting at the spin control in a date/time picker 
Author Message
 Getting at the spin control in a date/time picker

I am trying to use the date/time picker so the user can pick a time. I'd like to
blank the time because most frequently it is not needed. If the user pushes the
spin buttons then I can take control and show the time.

Blanking the time can be done with a SetFormat(_T("''")) and I can restore the
normal action by SetFormat(DTS_TIMEFORMAT).

My problem comes in trying to know when the user pushes one of the spin buttons.
There is an example available for download from from the Microsoft Download
Center called UpDnDate.exe.

In this there are message maps for OnFormat, OnFormatQuery, OnWmKeyDown and
OnNotifyDeltaPos. It's this last one that is associated with the following:

ON_1000:UDN_DELTAPOS

Question: How can I insert this message handler in my MFC app? In the code in
the example it shows up as follows:

...
BEGIN_MESSAGE_MAP(CUDDateTimeCtrl, CDateTimeCtrl)
        //{{AFX_MSG_MAP(CUDDateTimeCtrl)
        ON_NOTIFY_REFLECT(DTN_FORMAT, OnFormat)
        ON_NOTIFY_REFLECT(DTN_FORMATQUERY, OnFormatQuery)
        ON_NOTIFY_REFLECT(DTN_WMKEYDOWN, OnWmKeyDown)
        ON_NOTIFY(UDN_DELTAPOS, 1000, OnNotifyDeltaPos)
        //}}AFX_MSG_MAP
END_MESSAGE_MAP()
...

Since it is between the //{{AFX_MSG_MAP(CUDDateTimeCtrl) and //}}AFX_MSG_MAP, I
assume that the message is known to Visual Studio but I can't seem to find it in
my own app. Where does the 1000 come from? I search in the MSDN disc fro ON_1000
without success.

Ed Mitchell
--

Pharsight Corporation           | Voice:  (941)415-7039
6707 Daniel Court               | Fax:
Fort Myers, FL 33908            | Web:    www.pharsight.com



Wed, 17 Sep 2003 06:16:57 GMT  
 Getting at the spin control in a date/time picker
Are you familiar with creating classes derived from MFC control classes? If
so, then do you have class derived from CDateTimeCtrl? I am not familar with
the CDateTimeCtrl class but probably you can get the ClassWizard to create a
message map and handler for you for the UDN_DELTAPOS notification message.
You probably want to use the "reflected" message, so it will be prefixed
with an equal sign; that is, the message will be "=UDN_DELTAPOS".

Alternatively, you can have the ClassWizard create a message map and handler
for you in your dialog or view, in which case the message will not be
reflected and will be "UDN_DELTAPOS" as you might expect.

Is this more advanced or less advanced than you need?


Quote:
> I am trying to use the date/time picker so the user can pick a time. I'd
like to
> blank the time because most frequently it is not needed. If the user
pushes the
> spin buttons then I can take control and show the time.

> Blanking the time can be done with a SetFormat(_T("''")) and I can restore
the
> normal action by SetFormat(DTS_TIMEFORMAT).

> My problem comes in trying to know when the user pushes one of the spin
buttons.
> There is an example available for download from from the Microsoft
Download
> Center called UpDnDate.exe.

> In this there are message maps for OnFormat, OnFormatQuery, OnWmKeyDown
and
> OnNotifyDeltaPos. It's this last one that is associated with the
following:

> ON_1000:UDN_DELTAPOS

> Question: How can I insert this message handler in my MFC app? In the code
in
> the example it shows up as follows:

> ...
> BEGIN_MESSAGE_MAP(CUDDateTimeCtrl, CDateTimeCtrl)
> //{{AFX_MSG_MAP(CUDDateTimeCtrl)
> ON_NOTIFY_REFLECT(DTN_FORMAT, OnFormat)
> ON_NOTIFY_REFLECT(DTN_FORMATQUERY, OnFormatQuery)
> ON_NOTIFY_REFLECT(DTN_WMKEYDOWN, OnWmKeyDown)
>         ON_NOTIFY(UDN_DELTAPOS, 1000, OnNotifyDeltaPos)
> //}}AFX_MSG_MAP
> END_MESSAGE_MAP()
> ...

> Since it is between the //{{AFX_MSG_MAP(CUDDateTimeCtrl) and
//}}AFX_MSG_MAP, I
> assume that the message is known to Visual Studio but I can't seem to find
it in
> my own app. Where does the 1000 come from? I search in the MSDN disc fro
ON_1000
> without success.

> Ed Mitchell
> --

> Pharsight Corporation           | Voice:  (941)415-7039
> 6707 Daniel Court               | Fax:
> Fort Myers, FL 33908            | Web:    www.pharsight.com



Wed, 17 Sep 2003 06:44:57 GMT  
 Getting at the spin control in a date/time picker
Thanks for the comments.

I've derived classes before but not from the CDateTimeCtrl. The example
(UpDnDate.exe) was using a class derived from CDateTimeCtrl. My question was
related more to the magic numbers of ON_1000. The class wizard has message maps
for DTN_FORMAT, DTN_FORMATQUERY and DTN_WMKEYDOWN. In addition there is another
one listed as ON_1000:UDN_DELTAPOS. The three former messages are preceded with
the ON_CUDDDateTimeCtrl: where CUDDateTimeCtrl is the derived class name.
Selecting these messages highlights the reflected messages =DTN_FORMAT, etc.
Selecting the OnNotifyDeltaPos for ON_1000:UDN_DELTAPOS highlights nothing.
Where does the magic 1000 come from and how do I select it?

There is a funny thing happening when I try and add a member variable. When I've
done this before, in the Add Member Variable dialog box you select the variable,
give it a name and then select the Control under Category. Now under variable
type, there is the CDateTimeCtrl class and one would expect the derived class as
well. For this CDateTimeCtrl, this is the only class that shows up under
Variable Type so I can't associate it with my derived class using the MFC Class
Wizard.

Ed Mitchell

Quote:

> Are you familiar with creating classes derived from MFC control classes? If
> so, then do you have class derived from CDateTimeCtrl? I am not familar with
> the CDateTimeCtrl class but probably you can get the ClassWizard to create a
> message map and handler for you for the UDN_DELTAPOS notification message.
> You probably want to use the "reflected" message, so it will be prefixed
> with an equal sign; that is, the message will be "=UDN_DELTAPOS".

> Alternatively, you can have the ClassWizard create a message map and handler
> for you in your dialog or view, in which case the message will not be
> reflected and will be "UDN_DELTAPOS" as you might expect.

> Is this more advanced or less advanced than you need?



> > I am trying to use the date/time picker so the user can pick a time. I'd
> like to
> > blank the time because most frequently it is not needed. If the user
> pushes the
> > spin buttons then I can take control and show the time.

> > Blanking the time can be done with a SetFormat(_T("''")) and I can restore
> the
> > normal action by SetFormat(DTS_TIMEFORMAT).

> > My problem comes in trying to know when the user pushes one of the spin
> buttons.
> > There is an example available for download from from the Microsoft
> Download
> > Center called UpDnDate.exe.

> > In this there are message maps for OnFormat, OnFormatQuery, OnWmKeyDown
> and
> > OnNotifyDeltaPos. It's this last one that is associated with the
> following:

> > ON_1000:UDN_DELTAPOS

> > Question: How can I insert this message handler in my MFC app? In the code
> in
> > the example it shows up as follows:

> > ...
> > BEGIN_MESSAGE_MAP(CUDDateTimeCtrl, CDateTimeCtrl)
> > //{{AFX_MSG_MAP(CUDDateTimeCtrl)
> > ON_NOTIFY_REFLECT(DTN_FORMAT, OnFormat)
> > ON_NOTIFY_REFLECT(DTN_FORMATQUERY, OnFormatQuery)
> > ON_NOTIFY_REFLECT(DTN_WMKEYDOWN, OnWmKeyDown)
> >         ON_NOTIFY(UDN_DELTAPOS, 1000, OnNotifyDeltaPos)
> > //}}AFX_MSG_MAP
> > END_MESSAGE_MAP()
> > ...

> > Since it is between the //{{AFX_MSG_MAP(CUDDateTimeCtrl) and
> //}}AFX_MSG_MAP, I
> > assume that the message is known to Visual Studio but I can't seem to find
> it in
> > my own app. Where does the 1000 come from? I search in the MSDN disc fro
> ON_1000
> > without success.

> > Ed Mitchell
> > --

> > Pharsight Corporation           | Voice:  (941)415-7039
> > 6707 Daniel Court               | Fax:
> > Fort Myers, FL 33908            | Web:    www.pharsight.com

--

Pharsight Corporation           | Voice:  (941)415-7039
6707 Daniel Court               | Fax:
Fort Myers, FL 33908            | Web:    www.pharsight.com


Fri, 19 Sep 2003 10:59:47 GMT  
 Getting at the spin control in a date/time picker
I am sorry but this is beyond what I can help with. I hope someone can help
you. I do not know what ON_1000 is and it is not found in MSDN anywhere. I
searched the internet and the only reference found was the following, which
obviously has nothing whatsoever to do with MFC:

http://ndad.ulcc.ac.uk/datasets/8/2/3/2/5a.htm

As for adding a control member variable, it is strange it does not work as
we expect it to. It might work to manually change CDateTimeCtrl to
CUDDateTimeCtrl but I sure would prefer to not use solutions like that even
if it works.


Quote:
> Thanks for the comments.

> I've derived classes before but not from the CDateTimeCtrl. The example
> (UpDnDate.exe) was using a class derived from CDateTimeCtrl. My question
was
> related more to the magic numbers of ON_1000. The class wizard has message
maps
> for DTN_FORMAT, DTN_FORMATQUERY and DTN_WMKEYDOWN. In addition there is
another
> one listed as ON_1000:UDN_DELTAPOS. The three former messages are preceded
with
> the ON_CUDDDateTimeCtrl: where CUDDateTimeCtrl is the derived class name.
> Selecting these messages highlights the reflected messages =DTN_FORMAT,
etc.
> Selecting the OnNotifyDeltaPos for ON_1000:UDN_DELTAPOS highlights
nothing.
> Where does the magic 1000 come from and how do I select it?

> There is a funny thing happening when I try and add a member variable.
When I've
> done this before, in the Add Member Variable dialog box you select the
variable,
> give it a name and then select the Control under Category. Now under
variable
> type, there is the CDateTimeCtrl class and one would expect the derived
class as
> well. For this CDateTimeCtrl, this is the only class that shows up under
> Variable Type so I can't associate it with my derived class using the MFC
Class
> Wizard.

> Ed Mitchell


> > Are you familiar with creating classes derived from MFC control classes?
If
> > so, then do you have class derived from CDateTimeCtrl? I am not familar
with
> > the CDateTimeCtrl class but probably you can get the ClassWizard to
create a
> > message map and handler for you for the UDN_DELTAPOS notification
message.
> > You probably want to use the "reflected" message, so it will be prefixed
> > with an equal sign; that is, the message will be "=UDN_DELTAPOS".

> > Alternatively, you can have the ClassWizard create a message map and
handler
> > for you in your dialog or view, in which case the message will not be
> > reflected and will be "UDN_DELTAPOS" as you might expect.

> > Is this more advanced or less advanced than you need?



> > > I am trying to use the date/time picker so the user can pick a time.
I'd
> > like to
> > > blank the time because most frequently it is not needed. If the user
> > pushes the
> > > spin buttons then I can take control and show the time.

> > > Blanking the time can be done with a SetFormat(_T("''")) and I can
restore
> > the
> > > normal action by SetFormat(DTS_TIMEFORMAT).

> > > My problem comes in trying to know when the user pushes one of the
spin
> > buttons.
> > > There is an example available for download from from the Microsoft
> > Download
> > > Center called UpDnDate.exe.

> > > In this there are message maps for OnFormat, OnFormatQuery,
OnWmKeyDown
> > and
> > > OnNotifyDeltaPos. It's this last one that is associated with the
> > following:

> > > ON_1000:UDN_DELTAPOS

> > > Question: How can I insert this message handler in my MFC app? In the
code
> > in
> > > the example it shows up as follows:

> > > ...
> > > BEGIN_MESSAGE_MAP(CUDDateTimeCtrl, CDateTimeCtrl)
> > > //{{AFX_MSG_MAP(CUDDateTimeCtrl)
> > > ON_NOTIFY_REFLECT(DTN_FORMAT, OnFormat)
> > > ON_NOTIFY_REFLECT(DTN_FORMATQUERY, OnFormatQuery)
> > > ON_NOTIFY_REFLECT(DTN_WMKEYDOWN, OnWmKeyDown)
> > >         ON_NOTIFY(UDN_DELTAPOS, 1000, OnNotifyDeltaPos)
> > > //}}AFX_MSG_MAP
> > > END_MESSAGE_MAP()
> > > ...

> > > Since it is between the //{{AFX_MSG_MAP(CUDDateTimeCtrl) and
> > //}}AFX_MSG_MAP, I
> > > assume that the message is known to Visual Studio but I can't seem to
find
> > it in
> > > my own app. Where does the 1000 come from? I search in the MSDN disc
fro
> > ON_1000
> > > without success.

> > > Ed Mitchell
> > > --

> > > Pharsight Corporation           | Voice:  (941)415-7039
> > > 6707 Daniel Court               | Fax:
> > > Fort Myers, FL 33908            | Web:    www.pharsight.com

> --

> Pharsight Corporation           | Voice:  (941)415-7039
> 6707 Daniel Court               | Fax:
> Fort Myers, FL 33908            | Web:    www.pharsight.com



Fri, 19 Sep 2003 11:30:04 GMT  
 Getting at the spin control in a date/time picker
The example (UpDnDate.exe) comes from Microsoft and in some magic way they have
managed to get the Wizard to place the ON_1000 between the
//{{AFX_MSG_MAP(CUDDateTimeCtrl) and the //}}AFX_MSG_MAP. This was not done by
editing the source code to insert the:

 ON_NOTIFY(UDN_DELTAPOS, 1000, OnNotifyDeltaPos)

by hand.

Ed

Quote:

> I am sorry but this is beyond what I can help with. I hope someone can help
> you. I do not know what ON_1000 is and it is not found in MSDN anywhere. I
> searched the internet and the only reference found was the following, which
> obviously has nothing whatsoever to do with MFC:

> http://ndad.ulcc.ac.uk/datasets/8/2/3/2/5a.htm

> As for adding a control member variable, it is strange it does not work as
> we expect it to. It might work to manually change CDateTimeCtrl to
> CUDDateTimeCtrl but I sure would prefer to not use solutions like that even
> if it works.



> > Thanks for the comments.

> > I've derived classes before but not from the CDateTimeCtrl. The example
> > (UpDnDate.exe) was using a class derived from CDateTimeCtrl. My question
> was
> > related more to the magic numbers of ON_1000. The class wizard has message
> maps
> > for DTN_FORMAT, DTN_FORMATQUERY and DTN_WMKEYDOWN. In addition there is
> another
> > one listed as ON_1000:UDN_DELTAPOS. The three former messages are preceded
> with
> > the ON_CUDDDateTimeCtrl: where CUDDateTimeCtrl is the derived class name.
> > Selecting these messages highlights the reflected messages =DTN_FORMAT,
> etc.
> > Selecting the OnNotifyDeltaPos for ON_1000:UDN_DELTAPOS highlights
> nothing.
> > Where does the magic 1000 come from and how do I select it?

> > There is a funny thing happening when I try and add a member variable.
> When I've
> > done this before, in the Add Member Variable dialog box you select the
> variable,
> > give it a name and then select the Control under Category. Now under
> variable
> > type, there is the CDateTimeCtrl class and one would expect the derived
> class as
> > well. For this CDateTimeCtrl, this is the only class that shows up under
> > Variable Type so I can't associate it with my derived class using the MFC
> Class
> > Wizard.

> > Ed Mitchell


> > > Are you familiar with creating classes derived from MFC control classes?
> If
> > > so, then do you have class derived from CDateTimeCtrl? I am not familar
> with
> > > the CDateTimeCtrl class but probably you can get the ClassWizard to
> create a
> > > message map and handler for you for the UDN_DELTAPOS notification
> message.
> > > You probably want to use the "reflected" message, so it will be prefixed
> > > with an equal sign; that is, the message will be "=UDN_DELTAPOS".

> > > Alternatively, you can have the ClassWizard create a message map and
> handler
> > > for you in your dialog or view, in which case the message will not be
> > > reflected and will be "UDN_DELTAPOS" as you might expect.

> > > Is this more advanced or less advanced than you need?



> > > > I am trying to use the date/time picker so the user can pick a time.
> I'd
> > > like to
> > > > blank the time because most frequently it is not needed. If the user
> > > pushes the
> > > > spin buttons then I can take control and show the time.

> > > > Blanking the time can be done with a SetFormat(_T("''")) and I can
> restore
> > > the
> > > > normal action by SetFormat(DTS_TIMEFORMAT).

> > > > My problem comes in trying to know when the user pushes one of the
> spin
> > > buttons.
> > > > There is an example available for download from from the Microsoft
> > > Download
> > > > Center called UpDnDate.exe.

> > > > In this there are message maps for OnFormat, OnFormatQuery,
> OnWmKeyDown
> > > and
> > > > OnNotifyDeltaPos. It's this last one that is associated with the
> > > following:

> > > > ON_1000:UDN_DELTAPOS

> > > > Question: How can I insert this message handler in my MFC app? In the
> code
> > > in
> > > > the example it shows up as follows:

> > > > ...
> > > > BEGIN_MESSAGE_MAP(CUDDateTimeCtrl, CDateTimeCtrl)
> > > > //{{AFX_MSG_MAP(CUDDateTimeCtrl)
> > > > ON_NOTIFY_REFLECT(DTN_FORMAT, OnFormat)
> > > > ON_NOTIFY_REFLECT(DTN_FORMATQUERY, OnFormatQuery)
> > > > ON_NOTIFY_REFLECT(DTN_WMKEYDOWN, OnWmKeyDown)
> > > >         ON_NOTIFY(UDN_DELTAPOS, 1000, OnNotifyDeltaPos)
> > > > //}}AFX_MSG_MAP
> > > > END_MESSAGE_MAP()
> > > > ...

> > > > Since it is between the //{{AFX_MSG_MAP(CUDDateTimeCtrl) and
> > > //}}AFX_MSG_MAP, I
> > > > assume that the message is known to Visual Studio but I can't seem to
> find
> > > it in
> > > > my own app. Where does the 1000 come from? I search in the MSDN disc
> fro
> > > ON_1000
> > > > without success.

> > > > Ed Mitchell
> > > > --

> > > > Pharsight Corporation           | Voice:  (941)415-7039
> > > > 6707 Daniel Court               | Fax:
> > > > Fort Myers, FL 33908            | Web:    www.pharsight.com

> > --

> > Pharsight Corporation           | Voice:  (941)415-7039
> > 6707 Daniel Court               | Fax:
> > Fort Myers, FL 33908            | Web:    www.pharsight.com

--

Pharsight Corporation           | Voice:  (941)415-7039
6707 Daniel Court               | Fax:
Fort Myers, FL 33908            | Web:    www.pharsight.com


Fri, 19 Sep 2003 21:41:37 GMT  
 Getting at the spin control in a date/time picker
I have downloaded UpDnDate.exe and ON_1000 does not exist in the source
code.


Quote:
> The example (UpDnDate.exe) comes from Microsoft and in some magic way they
have
> managed to get the Wizard to place the ON_1000 between the
> //{{AFX_MSG_MAP(CUDDateTimeCtrl) and the //}}AFX_MSG_MAP. This was not
done by
> editing the source code to insert the:

>  ON_NOTIFY(UDN_DELTAPOS, 1000, OnNotifyDeltaPos)

> by hand.

> Ed


> > I am sorry but this is beyond what I can help with. I hope someone can
help
> > you. I do not know what ON_1000 is and it is not found in MSDN anywhere.
I
> > searched the internet and the only reference found was the following,
which
> > obviously has nothing whatsoever to do with MFC:

> > http://ndad.ulcc.ac.uk/datasets/8/2/3/2/5a.htm

> > As for adding a control member variable, it is strange it does not work
as
> > we expect it to. It might work to manually change CDateTimeCtrl to
> > CUDDateTimeCtrl but I sure would prefer to not use solutions like that
even
> > if it works.



> > > Thanks for the comments.

> > > I've derived classes before but not from the CDateTimeCtrl. The
example
> > > (UpDnDate.exe) was using a class derived from CDateTimeCtrl. My
question
> > was
> > > related more to the magic numbers of ON_1000. The class wizard has
message
> > maps
> > > for DTN_FORMAT, DTN_FORMATQUERY and DTN_WMKEYDOWN. In addition there
is
> > another
> > > one listed as ON_1000:UDN_DELTAPOS. The three former messages are
preceded
> > with
> > > the ON_CUDDDateTimeCtrl: where CUDDateTimeCtrl is the derived class
name.
> > > Selecting these messages highlights the reflected messages
=DTN_FORMAT,
> > etc.
> > > Selecting the OnNotifyDeltaPos for ON_1000:UDN_DELTAPOS highlights
> > nothing.
> > > Where does the magic 1000 come from and how do I select it?

> > > There is a funny thing happening when I try and add a member variable.
> > When I've
> > > done this before, in the Add Member Variable dialog box you select the
> > variable,
> > > give it a name and then select the Control under Category. Now under
> > variable
> > > type, there is the CDateTimeCtrl class and one would expect the
derived
> > class as
> > > well. For this CDateTimeCtrl, this is the only class that shows up
under
> > > Variable Type so I can't associate it with my derived class using the
MFC
> > Class
> > > Wizard.

> > > Ed Mitchell


> > > > Are you familiar with creating classes derived from MFC control
classes?
> > If
> > > > so, then do you have class derived from CDateTimeCtrl? I am not
familar
> > with
> > > > the CDateTimeCtrl class but probably you can get the ClassWizard to
> > create a
> > > > message map and handler for you for the UDN_DELTAPOS notification
> > message.
> > > > You probably want to use the "reflected" message, so it will be
prefixed
> > > > with an equal sign; that is, the message will be "=UDN_DELTAPOS".

> > > > Alternatively, you can have the ClassWizard create a message map and
> > handler
> > > > for you in your dialog or view, in which case the message will not
be
> > > > reflected and will be "UDN_DELTAPOS" as you might expect.

> > > > Is this more advanced or less advanced than you need?



> > > > > I am trying to use the date/time picker so the user can pick a
time.
> > I'd
> > > > like to
> > > > > blank the time because most frequently it is not needed. If the
user
> > > > pushes the
> > > > > spin buttons then I can take control and show the time.

> > > > > Blanking the time can be done with a SetFormat(_T("''")) and I can
> > restore
> > > > the
> > > > > normal action by SetFormat(DTS_TIMEFORMAT).

> > > > > My problem comes in trying to know when the user pushes one of the
> > spin
> > > > buttons.
> > > > > There is an example available for download from from the Microsoft
> > > > Download
> > > > > Center called UpDnDate.exe.

> > > > > In this there are message maps for OnFormat, OnFormatQuery,
> > OnWmKeyDown
> > > > and
> > > > > OnNotifyDeltaPos. It's this last one that is associated with the
> > > > following:

> > > > > ON_1000:UDN_DELTAPOS

> > > > > Question: How can I insert this message handler in my MFC app? In
the
> > code
> > > > in
> > > > > the example it shows up as follows:

> > > > > ...
> > > > > BEGIN_MESSAGE_MAP(CUDDateTimeCtrl, CDateTimeCtrl)
> > > > > //{{AFX_MSG_MAP(CUDDateTimeCtrl)
> > > > > ON_NOTIFY_REFLECT(DTN_FORMAT, OnFormat)
> > > > > ON_NOTIFY_REFLECT(DTN_FORMATQUERY, OnFormatQuery)
> > > > > ON_NOTIFY_REFLECT(DTN_WMKEYDOWN, OnWmKeyDown)
> > > > >         ON_NOTIFY(UDN_DELTAPOS, 1000, OnNotifyDeltaPos)
> > > > > //}}AFX_MSG_MAP
> > > > > END_MESSAGE_MAP()
> > > > > ...

> > > > > Since it is between the //{{AFX_MSG_MAP(CUDDateTimeCtrl) and
> > > > //}}AFX_MSG_MAP, I
> > > > > assume that the message is known to Visual Studio but I can't seem
to
> > find
> > > > it in
> > > > > my own app. Where does the 1000 come from? I search in the MSDN
disc
> > fro
> > > > ON_1000
> > > > > without success.

> > > > > Ed Mitchell
> > > > > --

> > > > > Pharsight Corporation           | Voice:  (941)415-7039
> > > > > 6707 Daniel Court               | Fax:
> > > > > Fort Myers, FL 33908            | Web:    www.pharsight.com

> > > --

> > > Pharsight Corporation           | Voice:  (941)415-7039
> > > 6707 Daniel Court               | Fax:
> > > Fort Myers, FL 33908            | Web:    www.pharsight.com

> --

> Pharsight Corporation           | Voice:  (941)415-7039
> 6707 Daniel Court               | Fax:
> Fort Myers, FL 33908            | Web:    www.pharsight.com



Sat, 20 Sep 2003 05:41:31 GMT  
 Getting at the spin control in a date/time picker
You're right. It actually appears in the message map that the Class Wizard
displays for the code in CUDDateTimeCtrl for the function:

void CUDDateTimeCtrl::OnNotifyDeltaPos(NMHDR *pNMHDR, LRESULT *pResult)
{
    ...

Quote:
}

If you open the View/Class Wizard with the CUDDateTimeCtrl selected, there is a
line:

[W] OnNotifyDeltaPos    ON_1000:UDN_DELTAPOS

All the other message map functions are of the form:

[W] OnFormat            ON_CUDDDateTimeCtrl:DTN_FORMAT
etc.

In the message map in the same function is the following:

    ON_NOTIFY(UDN_DELTAPOS, 1000, OnNotifyDeltaPos)

which shows some roots in the ON_1000!

Ed

Quote:

> I have downloaded UpDnDate.exe and ON_1000 does not exist in the source
> code.



> > The example (UpDnDate.exe) comes from Microsoft and in some magic way they
> have
> > managed to get the Wizard to place the ON_1000 between the
> > //{{AFX_MSG_MAP(CUDDateTimeCtrl) and the //}}AFX_MSG_MAP. This was not
> done by
> > editing the source code to insert the:

> >  ON_NOTIFY(UDN_DELTAPOS, 1000, OnNotifyDeltaPos)

> > by hand.

> > Ed


> > > I am sorry but this is beyond what I can help with. I hope someone can
> help
> > > you. I do not know what ON_1000 is and it is not found in MSDN anywhere.
> I
> > > searched the internet and the only reference found was the following,
> which
> > > obviously has nothing whatsoever to do with MFC:

> > > http://ndad.ulcc.ac.uk/datasets/8/2/3/2/5a.htm

> > > As for adding a control member variable, it is strange it does not work
> as
> > > we expect it to. It might work to manually change CDateTimeCtrl to
> > > CUDDateTimeCtrl but I sure would prefer to not use solutions like that
> even
> > > if it works.



> > > > Thanks for the comments.

> > > > I've derived classes before but not from the CDateTimeCtrl. The
> example
> > > > (UpDnDate.exe) was using a class derived from CDateTimeCtrl. My
> question
> > > was
> > > > related more to the magic numbers of ON_1000. The class wizard has
> message
> > > maps
> > > > for DTN_FORMAT, DTN_FORMATQUERY and DTN_WMKEYDOWN. In addition there
> is
> > > another
> > > > one listed as ON_1000:UDN_DELTAPOS. The three former messages are
> preceded
> > > with
> > > > the ON_CUDDDateTimeCtrl: where CUDDateTimeCtrl is the derived class
> name.
> > > > Selecting these messages highlights the reflected messages
> =DTN_FORMAT,
> > > etc.
> > > > Selecting the OnNotifyDeltaPos for ON_1000:UDN_DELTAPOS highlights
> > > nothing.
> > > > Where does the magic 1000 come from and how do I select it?

> > > > There is a funny thing happening when I try and add a member variable.
> > > When I've
> > > > done this before, in the Add Member Variable dialog box you select the
> > > variable,
> > > > give it a name and then select the Control under Category. Now under
> > > variable
> > > > type, there is the CDateTimeCtrl class and one would expect the
> derived
> > > class as
> > > > well. For this CDateTimeCtrl, this is the only class that shows up
> under
> > > > Variable Type so I can't associate it with my derived class using the
> MFC
> > > Class
> > > > Wizard.

> > > > Ed Mitchell


> > > > > Are you familiar with creating classes derived from MFC control
> classes?
> > > If
> > > > > so, then do you have class derived from CDateTimeCtrl? I am not
> familar
> > > with
> > > > > the CDateTimeCtrl class but probably you can get the ClassWizard to
> > > create a
> > > > > message map and handler for you for the UDN_DELTAPOS notification
> > > message.
> > > > > You probably want to use the "reflected" message, so it will be
> prefixed
> > > > > with an equal sign; that is, the message will be "=UDN_DELTAPOS".

> > > > > Alternatively, you can have the ClassWizard create a message map and
> > > handler
> > > > > for you in your dialog or view, in which case the message will not
> be
> > > > > reflected and will be "UDN_DELTAPOS" as you might expect.

> > > > > Is this more advanced or less advanced than you need?



> > > > > > I am trying to use the date/time picker so the user can pick a
> time.
> > > I'd
> > > > > like to
> > > > > > blank the time because most frequently it is not needed. If the
> user
> > > > > pushes the
> > > > > > spin buttons then I can take control and show the time.

> > > > > > Blanking the time can be done with a SetFormat(_T("''")) and I can
> > > restore
> > > > > the
> > > > > > normal action by SetFormat(DTS_TIMEFORMAT).

> > > > > > My problem comes in trying to know when the user pushes one of the
> > > spin
> > > > > buttons.
> > > > > > There is an example available for download from from the Microsoft
> > > > > Download
> > > > > > Center called UpDnDate.exe.

> > > > > > In this there are message maps for OnFormat, OnFormatQuery,
> > > OnWmKeyDown
> > > > > and
> > > > > > OnNotifyDeltaPos. It's this last one that is associated with the
> > > > > following:

> > > > > > ON_1000:UDN_DELTAPOS

> > > > > > Question: How can I insert this message handler in my MFC app? In
> the
> > > code
> > > > > in
> > > > > > the example it shows up as follows:

> > > > > > ...
> > > > > > BEGIN_MESSAGE_MAP(CUDDateTimeCtrl, CDateTimeCtrl)
> > > > > > //{{AFX_MSG_MAP(CUDDateTimeCtrl)
> > > > > > ON_NOTIFY_REFLECT(DTN_FORMAT, OnFormat)
> > > > > > ON_NOTIFY_REFLECT(DTN_FORMATQUERY, OnFormatQuery)
> > > > > > ON_NOTIFY_REFLECT(DTN_WMKEYDOWN, OnWmKeyDown)
> > > > > >         ON_NOTIFY(UDN_DELTAPOS, 1000, OnNotifyDeltaPos)
> > > > > > //}}AFX_MSG_MAP
> > > > > > END_MESSAGE_MAP()
> > > > > > ...

> > > > > > Since it is between the //{{AFX_MSG_MAP(CUDDateTimeCtrl) and
> > > > > //}}AFX_MSG_MAP, I
> > > > > > assume that the message is known to Visual Studio but I can't seem
> to
> > > find
> > > > > it in
> > > > > > my own app. Where does the 1000 come from? I search in the MSDN
> disc
> > > fro
> > > > > ON_1000
> > > > > > without success.

> > > > > > Ed Mitchell
> > > > > > --

> > > > > > Pharsight Corporation           | Voice:  (941)415-7039
> > > > > > 6707 Daniel Court               | Fax:
> > > > > > Fort Myers, FL 33908            | Web:    www.pharsight.com

> > > > --

> > > > Pharsight Corporation           | Voice:  (941)415-7039
> > > > 6707 Daniel Court               | Fax:
> > > > Fort Myers, FL 33908            | Web:    www.pharsight.com

> > --

> > Pharsight Corporation           | Voice:  (941)415-7039
> > 6707 Daniel Court               | Fax:
> > Fort Myers, FL 33908            | Web:    www.pharsight.com

--

Pharsight Corporation           | Voice:  (941)415-7039
6707 Daniel Court               | Fax:
Fort Myers, FL 33908            | Web:    www.pharsight.com


Sun, 21 Sep 2003 22:20:04 GMT  
 Getting at the spin control in a date/time picker
Okay, that makes a difference. Yes, when in ClassWizard I select the line
containing:

OnNotifyDeltaPos ON_1000:UDN_DELTAPOS

then click on "Edit Code" ClassWizard takes me to the
CUDDateTimeCtrl::OnNotifyDeltaPos function. So the question becomes why
ClassWizard is showing a constant (1000) instead of a symbol. I will study
it a bit more sometime but you probably know more than I about the
situation. Perhaps someone else will have an answer.


Quote:
> You're right. It actually appears in the message map that the Class Wizard
> displays for the code in CUDDateTimeCtrl for the function:

> void CUDDateTimeCtrl::OnNotifyDeltaPos(NMHDR *pNMHDR, LRESULT *pResult)
> {
>     ...
> }
> If you open the View/Class Wizard with the CUDDateTimeCtrl selected, there
is a
> line:

> [W] OnNotifyDeltaPos ON_1000:UDN_DELTAPOS

> All the other message map functions are of the form:

> [W] OnFormat ON_CUDDDateTimeCtrl:DTN_FORMAT
> etc.

> In the message map in the same function is the following:

>     ON_NOTIFY(UDN_DELTAPOS, 1000, OnNotifyDeltaPos)

> which shows some roots in the ON_1000!

> Ed


> > I have downloaded UpDnDate.exe and ON_1000 does not exist in the source
> > code.



> > > The example (UpDnDate.exe) comes from Microsoft and in some magic way
they
> > have
> > > managed to get the Wizard to place the ON_1000 between the
> > > //{{AFX_MSG_MAP(CUDDateTimeCtrl) and the //}}AFX_MSG_MAP. This was not
> > done by
> > > editing the source code to insert the:

> > >  ON_NOTIFY(UDN_DELTAPOS, 1000, OnNotifyDeltaPos)

> > > by hand.

> > > Ed


> > > > I am sorry but this is beyond what I can help with. I hope someone
can
> > help
> > > > you. I do not know what ON_1000 is and it is not found in MSDN
anywhere.
> > I
> > > > searched the internet and the only reference found was the
following,
> > which
> > > > obviously has nothing whatsoever to do with MFC:

> > > > http://ndad.ulcc.ac.uk/datasets/8/2/3/2/5a.htm

> > > > As for adding a control member variable, it is strange it does not
work
> > as
> > > > we expect it to. It might work to manually change CDateTimeCtrl to
> > > > CUDDateTimeCtrl but I sure would prefer to not use solutions like
that
> > even
> > > > if it works.



> > > > > Thanks for the comments.

> > > > > I've derived classes before but not from the CDateTimeCtrl. The
> > example
> > > > > (UpDnDate.exe) was using a class derived from CDateTimeCtrl. My
> > question
> > > > was
> > > > > related more to the magic numbers of ON_1000. The class wizard has
> > message
> > > > maps
> > > > > for DTN_FORMAT, DTN_FORMATQUERY and DTN_WMKEYDOWN. In addition
there
> > is
> > > > another
> > > > > one listed as ON_1000:UDN_DELTAPOS. The three former messages are
> > preceded
> > > > with
> > > > > the ON_CUDDDateTimeCtrl: where CUDDateTimeCtrl is the derived
class
> > name.
> > > > > Selecting these messages highlights the reflected messages
> > =DTN_FORMAT,
> > > > etc.
> > > > > Selecting the OnNotifyDeltaPos for ON_1000:UDN_DELTAPOS highlights
> > > > nothing.
> > > > > Where does the magic 1000 come from and how do I select it?

> > > > > There is a funny thing happening when I try and add a member
variable.
> > > > When I've
> > > > > done this before, in the Add Member Variable dialog box you select
the
> > > > variable,
> > > > > give it a name and then select the Control under Category. Now
under
> > > > variable
> > > > > type, there is the CDateTimeCtrl class and one would expect the
> > derived
> > > > class as
> > > > > well. For this CDateTimeCtrl, this is the only class that shows up
> > under
> > > > > Variable Type so I can't associate it with my derived class using
the
> > MFC
> > > > Class
> > > > > Wizard.

> > > > > Ed Mitchell


> > > > > > Are you familiar with creating classes derived from MFC control
> > classes?
> > > > If
> > > > > > so, then do you have class derived from CDateTimeCtrl? I am not
> > familar
> > > > with
> > > > > > the CDateTimeCtrl class but probably you can get the ClassWizard
to
> > > > create a
> > > > > > message map and handler for you for the UDN_DELTAPOS
notification
> > > > message.
> > > > > > You probably want to use the "reflected" message, so it will be
> > prefixed
> > > > > > with an equal sign; that is, the message will be
"=UDN_DELTAPOS".

> > > > > > Alternatively, you can have the ClassWizard create a message map
and
> > > > handler
> > > > > > for you in your dialog or view, in which case the message will
not
> > be
> > > > > > reflected and will be "UDN_DELTAPOS" as you might expect.

> > > > > > Is this more advanced or less advanced than you need?



> > > > > > > I am trying to use the date/time picker so the user can pick a
> > time.
> > > > I'd
> > > > > > like to
> > > > > > > blank the time because most frequently it is not needed. If
the
> > user
> > > > > > pushes the
> > > > > > > spin buttons then I can take control and show the time.

> > > > > > > Blanking the time can be done with a SetFormat(_T("''")) and I
can
> > > > restore
> > > > > > the
> > > > > > > normal action by SetFormat(DTS_TIMEFORMAT).

> > > > > > > My problem comes in trying to know when the user pushes one of
the
> > > > spin
> > > > > > buttons.
> > > > > > > There is an example available for download from from the
Microsoft
> > > > > > Download
> > > > > > > Center called UpDnDate.exe.

> > > > > > > In this there are message maps for OnFormat, OnFormatQuery,
> > > > OnWmKeyDown
> > > > > > and
> > > > > > > OnNotifyDeltaPos. It's this last one that is associated with
the
> > > > > > following:

> > > > > > > ON_1000:UDN_DELTAPOS

> > > > > > > Question: How can I insert this message handler in my MFC app?
In
> > the
> > > > code
> > > > > > in
> > > > > > > the example it shows up as follows:

> > > > > > > ...
> > > > > > > BEGIN_MESSAGE_MAP(CUDDateTimeCtrl, CDateTimeCtrl)
> > > > > > > //{{AFX_MSG_MAP(CUDDateTimeCtrl)
> > > > > > > ON_NOTIFY_REFLECT(DTN_FORMAT, OnFormat)
> > > > > > > ON_NOTIFY_REFLECT(DTN_FORMATQUERY, OnFormatQuery)
> > > > > > > ON_NOTIFY_REFLECT(DTN_WMKEYDOWN, OnWmKeyDown)
> > > > > > >         ON_NOTIFY(UDN_DELTAPOS, 1000, OnNotifyDeltaPos)
> > > > > > > //}}AFX_MSG_MAP
> > > > > > > END_MESSAGE_MAP()
> > > > > > > ...

> > > > > > > Since it is between the //{{AFX_MSG_MAP(CUDDateTimeCtrl) and
> > > > > > //}}AFX_MSG_MAP, I
> > > > > > > assume that the message is known to Visual Studio but I can't
seem
> > to
> > > > find
> > > > > > it in
> > > > > > > my own app. Where does the 1000 come from? I search in the
MSDN
> > disc
> > > > fro
> > > > > > ON_1000
> > > > > > > without success.

> > > > > > > Ed Mitchell
> > > > > > > --

> > > > > > > Pharsight Corporation           | Voice:  (941)415-7039
> > > > > > > 6707 Daniel Court               | Fax:
> > > > > > > Fort Myers, FL 33908            | Web:    www.pharsight.com

> > > > > --

> > > > > Pharsight Corporation           | Voice:  (941)415-7039
> > > > > 6707 Daniel Court               | Fax:
> > > > > Fort Myers, FL 33908            | Web:    www.pharsight.com

> > > --

> > > Pharsight Corporation           | Voice:  (941)415-7039
> > > 6707 Daniel Court               | Fax:
> > > Fort Myers, FL 33908            | Web:    www.pharsight.com

> --

> Pharsight Corporation           | Voice:  (941)415-7039
> 6707 Daniel Court               | Fax:
> Fort Myers, FL 33908            | Web:    www.pharsight.com



Mon, 22 Sep 2003 01:38:31 GMT  
 Getting at the spin control in a date/time picker
If controls are "packaged" in dll's or whatever, could it be possible
that the symbols of the components of a combination do not travel with
it but just the compiler numerics assigned? 1000 is often a starting
point for resource assignments.
Quote:

> Okay, that makes a difference. Yes, when in ClassWizard I select the line
> containing:

> OnNotifyDeltaPos ON_1000:UDN_DELTAPOS

> then click on "Edit Code" ClassWizard takes me to the
> CUDDateTimeCtrl::OnNotifyDeltaPos function. So the question becomes why
> ClassWizard is showing a constant (1000) instead of a symbol. I will study
> it a bit more sometime but you probably know more than I about the
> situation. Perhaps someone else will have an answer.



Mon, 22 Sep 2003 12:48:47 GMT  
 Getting at the spin control in a date/time picker
Sounds like it. But remember that this is one of Microsoft's sample programs
(UpDnDate.exe) so all the source code is visible. It's really not obvious how
they got the UDN_DELTAPOS message handler associated with the ON_1000. It
doesn't show up in any of the Wizard actions that I can see yet the message
appears between the //{{AFX_MSG_MAP(CUDDateTimeCtrl) and the //}}AFX_MSG_MAP
wizard brackets.

Ed

Quote:

> If controls are "packaged" in dll's or whatever, could it be possible
> that the symbols of the components of a combination do not travel with
> it but just the compiler numerics assigned? 1000 is often a starting
> point for resource assignments.


> > Okay, that makes a difference. Yes, when in ClassWizard I select the line
> > containing:

> > OnNotifyDeltaPos ON_1000:UDN_DELTAPOS

> > then click on "Edit Code" ClassWizard takes me to the
> > CUDDateTimeCtrl::OnNotifyDeltaPos function. So the question becomes why
> > ClassWizard is showing a constant (1000) instead of a symbol. I will study
> > it a bit more sometime but you probably know more than I about the
> > situation. Perhaps someone else will have an answer.

--

Pharsight Corporation           | Voice:  (941)415-7039
6707 Daniel Court               | Fax:
Fort Myers, FL 33908            | Web:    www.pharsight.com


Thu, 25 Sep 2003 03:27:19 GMT  
 
 [ 10 post ] 

 Relevant Pages 

1. Date Time Picker - Date AND Time

2. Date/Time Edit control with spin control

3. Question about use Date Time Picker Control??thank you

4. Date and Time Picker Control - changing display window

5. Date Time Picker control crashes if edit year!

6. Question about use Date Time Picker Control??thank you

7. Date and Time Picker Control

8. DDX function for Date Time Picker Control

9. Using the Microsoft Date and Time Picker Control in MFC

10. Date/time control picker

11. Date and time picker control Alignment

12. How 2 uncheck a date time picker control?

 

 
Powered by phpBB® Forum Software