-
... Looking for an EVENT (MFC) ? ...
Hello everybody,
My problem is :
I'm using a CEdit control and i'd like to do something when the user has
pressed on the keyboard.
But i'm looking for the events 'something ..KEYDOWN' and it doesn't appear
in the 'Event Handler', but i know that the 'CEdit' class is derived from
the 'CWnd' class , right ? and i've seen a fonction that can be implemented
in CWnd class :
afx_msg void OnKeyDown( UINT nChar, UINT nRepCnt, UINT nFlags );
So, my question is :
How to get the Events of the parent Class in the 'Event Handler' (or
somewhere else perhaps ...) ?
.... I have Searched in the MSDN, and i have found nothing, perhaps you know
in wich chapter i have to go ...
Thank's to anyone.
Driss
-
Re: ... Looking for an EVENT (MFC) ? ...
More Exactly, how to ... :
.... get the Events of the parent Class (here CWnd)
-> in the 'Event Handler' of the Inherited class (Here the CEdit control) ?
....
Thank's
Driss.
<ndriss@club-internet.fr> a écrit dans le message news:
3b1765a8@news.devx.com...
> Hello everybody,
>
> My problem is :
>
> I'm using a CEdit control and i'd like to do something when the user has
> pressed on the keyboard.
>
> But i'm looking for the events 'something ..KEYDOWN' and it doesn't
appear
> in the 'Event Handler', but i know that the 'CEdit' class is derived from
> the 'CWnd' class , right ? and i've seen a fonction that can be
implemented
> in CWnd class :
>
> afx_msg void OnKeyDown( UINT nChar, UINT nRepCnt, UINT nFlags );
>
> So, my question is :
>
> How to get the Events of the parent Class in the 'Event Handler' (or
> somewhere else perhaps ...) ?
>
> ... I have Searched in the MSDN, and i have found nothing, perhaps you
know
> in wich chapter i have to go ...
>
> Thank's to anyone.
>
> Driss
>
>
>
-
Re: ... Looking for an EVENT (MFC) ? ...
If I understand you correctly, You are looking to add a message handler to
your Edit class for WM_KEYDOWN.
Just right click on the class in class view and choose "add message handler"
and add WM_KEYDOWN to your class. You also use the class wizard todo the
same thing.
Not sure if that is what you needed but anyway.
Brian
<ndriss@club-internet.fr> wrote:
>Hello everybody,
>
>My problem is :
>
>I'm using a CEdit control and i'd like to do something when the user has
>pressed on the keyboard.
>
>But i'm looking for the events 'something ..KEYDOWN' and it doesn't appear
>in the 'Event Handler', but i know that the 'CEdit' class is derived from
>the 'CWnd' class , right ? and i've seen a fonction that can be implemented
>in CWnd class :
>
>afx_msg void OnKeyDown( UINT nChar, UINT nRepCnt, UINT nFlags );
>
>So, my question is :
>
>How to get the Events of the parent Class in the 'Event Handler' (or
>somewhere else perhaps ...) ?
>
>.... I have Searched in the MSDN, and i have found nothing, perhaps you
know
>in wich chapter i have to go ...
>
>Thank's to anyone.
>
>Driss
>
>
>
-
Re: ... Looking for an EVENT (MFC) ? ...
Hi Brian,
Thank's for your answer. But there something i don't understand. When you add a CEdit control on the dialog box, it comes with the name 'IDC_STATIC'. With this name, the control has a lot events, all of their name starting with 'WM_...' , including 'WM_KEYDOWN'. But as soon as i change the name of the control, i call it for example 'IDC_MYEDIT', i have other events, only 8 events :
EN_CHANGE / EN_ERRSPACE / EN_HSCROLL / EN_MAXTEXT
EN_VSCROLL / EN_KILLFOCUS / EN_SETFOCUS / EN_UPDATE
and no more events like :
WM_...
Why ? Why i can not have the 'WM_KEYDOWN' event when i change the name of the control ???
Thank's for your lights....
Driss
"Brian Preston" <brian81@yahoo.com> a écrit dans le message news: 3b19b986$1@news.devx.com...
>
> If I understand you correctly, You are looking to add a message handler to
> your Edit class for WM_KEYDOWN.
>
> Just right click on the class in class view and choose "add message handler"
> and add WM_KEYDOWN to your class. You also use the class wizard todo the
> same thing.
>
> Not sure if that is what you needed but anyway.
>
> Brian
>
> <ndriss@club-internet.fr> wrote:
> >Hello everybody,
> >
> >My problem is :
> >
> >I'm using a CEdit control and i'd like to do something when the user has
> >pressed on the keyboard.
> >
> >But i'm looking for the events 'something ..KEYDOWN' and it doesn't appear
> >in the 'Event Handler', but i know that the 'CEdit' class is derived from
> >the 'CWnd' class , right ? and i've seen a fonction that can be implemented
> >in CWnd class :
> >
> >afx_msg void OnKeyDown( UINT nChar, UINT nRepCnt, UINT nFlags );
> >
> >So, my question is :
> >
> >How to get the Events of the parent Class in the 'Event Handler' (or
> >somewhere else perhaps ...) ?
> >
> >.... I have Searched in the MSDN, and i have found nothing, perhaps you
> know
> >in wich chapter i have to go ...
> >
> >Thank's to anyone.
> >
> >Driss
> >
> >
> >
>
-
Re: ... Looking for an EVENT (MFC) ? ...
I missread you and assumed you had you own CEdit derived class already made.
Anyway this is what you need todo.
1. Make a new class derived from CEdit. (CMyEdit)
2. add the WM_KEYDOWN handler for that class.
3. add control member to the Dlg class for the Editbox using you new class.
I can send you an exmaple project if you want just send me an email at
brian@bkp-online.com.
<ndriss@club-internet.fr> wrote:
>C'est un message de format MIME en plusieurs parties.
>
>
>Hi Brian,
>
>Thank's for your answer. But there something i don't understand. When =
>you add a CEdit control on the dialog box, it comes with the name =
>'IDC_STATIC'. With this name, the control has a lot events, all of their
=
>name starting with 'WM_...' , including 'WM_KEYDOWN'. But as soon as i =
>change the name of the control, i call it for example 'IDC_MYEDIT', i =
>have other events, only 8 events :
>EN_CHANGE / EN_ERRSPACE / EN_HSCROLL / EN_MAXTEXT=20
>
>EN_VSCROLL / EN_KILLFOCUS / EN_SETFOCUS / EN_UPDATE
>
>and no more events like :
>
>WM_...
>
>Why ? Why i can not have the 'WM_KEYDOWN' event when i change the name =
>of the control ???
>
>Thank's for your lights....
>
>Driss
>
>
>"Brian Preston" <brian81@yahoo.com> a =E9crit dans le message news: =
>3b19b986$1@news.devx.com...
>>=20
>> If I understand you correctly, You are looking to add a message =
>handler to
>> your Edit class for WM_KEYDOWN.
>>=20
>> Just right click on the class in class view and choose "add message =
>handler"
>> and add WM_KEYDOWN to your class. You also use the class wizard todo =
>the
>> same thing.
>>=20
>> Not sure if that is what you needed but anyway.
>>=20
>> Brian
>>=20
>> <ndriss@club-internet.fr> wrote:
>> >Hello everybody,
>> >
>> >My problem is :
>> >
>> >I'm using a CEdit control and i'd like to do something when the user
=
>has
>> >pressed on the keyboard.
>> >
>> >But i'm looking for the events 'something ..KEYDOWN' and it doesn't
=
>appear
>> >in the 'Event Handler', but i know that the 'CEdit' class is derived
=
>from
>> >the 'CWnd' class , right ? and i've seen a fonction that can be =
>implemented
>> >in CWnd class :
>> >
>> >afx_msg void OnKeyDown( UINT nChar, UINT nRepCnt, UINT nFlags );
>> >
>> >So, my question is :
>> >
>> >How to get the Events of the parent Class in the 'Event Handler' (or
>> >somewhere else perhaps ...) ?
>> >
>> >.... I have Searched in the MSDN, and i have found nothing, perhaps =
>you
>> know
>> >in wich chapter i have to go ...
>> >
>> >Thank's to anyone.
>> >
>> >Driss
>> >
>> >
>> >
>>=20
>
>
><!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.0 Transitional//EN">
><HTML><HEAD>
><META content=3D"text/html; charset=3Diso-8859-1" =
>http-equiv=3DContent-Type>
><META content=3D"MSHTML 5.00.3103.1000" name=3DGENERATOR>
><STYLE></STYLE>
></HEAD>
><BODY>
><DIV><FONT face=3DArial size=3D2>Hi Brian,</FONT></DIV>
><DIV> </DIV>
><DIV><FONT face=3DArial size=3D2>Thank's for your answer. But there =
>something i=20
>don't understand. When you add a CEdit control on the dialog box, =
>it comes=20
>with the name 'IDC_STATIC'. With this name, the control has a lot =
>events, all of=20
>their name starting with 'WM_...' , including 'WM_KEYDOWN'. But as =
>soon as=20
>i change the name of the control, i call it for example 'IDC_MYEDIT', i
=
>have=20
>other events, only 8 events :</FONT></DIV>
><DIV>
><P><FONT face=3DArial size=3D2>EN_CHANGE / </FONT><FONT face=3DArial=20
>size=3D2>EN_ERRSPACE / </FONT><FONT face=3DArial size=3D2>EN_HSCROLL / =
></FONT><FONT=20
>face=3DArial size=3D2>EN_MAXTEXT </FONT></P>
><P><FONT face=3DArial size=3D2>EN_VSCROLL / </FONT><FONT face=3DArial=20
>size=3D2>EN_KILLFOCUS / </FONT><FONT face=3DArial size=3D2>EN_SETFOCUS /
=
></FONT><FONT=20
>face=3DArial size=3D2>EN_UPDATE</FONT></P>
><P><FONT face=3DArial size=3D2>and no more events like :</FONT></P>
><P><FONT face=3DArial size=3D2>WM_...</FONT></P>
><P><FONT face=3DArial size=3D2>Why ? Why i can not have the 'WM_KEYDOWN'
=
>event when=20
>i change the name of the control ???</FONT></P>
><P><FONT face=3DArial size=3D2>Thank's for your lights....</FONT></P>
><P><FONT face=3DArial size=3D2>Driss</FONT></P></DIV>
><DIV> </DIV>
><DIV><FONT face=3DArial size=3D2>"Brian Preston" <</FONT><A=20
>href=3D"mailto:brian81@yahoo.com"><FONT face=3DArial=20
>size=3D2>brian81@yahoo.com</FONT></A><FONT face=3DArial size=3D2>> a =
>=E9crit dans le=20
>message news: </FONT><A href=3D"mailto:3b19b986$1@news.devx.com"><FONT =
>face=3DArial=20
>size=3D2>3b19b986$1@news.devx.com</FONT></A><FONT face=3DArial=20
>size=3D2>...</FONT></DIV><FONT face=3DArial size=3D2>> <BR>> If I =
>understand you=20
>correctly, You are looking to add a message handler to<BR>> your Edit =
>class=20
>for WM_KEYDOWN.<BR>> <BR>> Just right click on the class in class =
>view and=20
>choose "add message handler"<BR>> and add WM_KEYDOWN to your class. =
>You also=20
>use the class wizard todo the<BR>> same thing.<BR>> <BR>> Not =
>sure if=20
>that is what you needed but anyway.<BR>> <BR>> Brian<BR>> =
><BR>>=20
><</FONT><A href=3D"mailto:ndriss@club-internet.fr"><FONT face=3DArial =
>
>size=3D2>ndriss@club-internet.fr</FONT></A><FONT face=3DArial =
>size=3D2>>=20
>wrote:<BR>> >Hello everybody,<BR>> ><BR>> >My problem =
>is=20
>:<BR>> ><BR>> >I'm using a CEdit control and i'd like to do=20
>something when the user has<BR>> >pressed on the keyboard.<BR>> =
>
>><BR>> >But i'm looking for the events 'something =
>...KEYDOWN' and=20
>it doesn't appear<BR>> >in the 'Event Handler', but i know that =
>the=20
>'CEdit' class is derived from<BR>> >the 'CWnd' class , right ? and =
>i've=20
>seen a fonction that can be implemented<BR>> >in CWnd class =
>:<BR>>=20
>><BR>> >afx_msg void OnKeyDown( UINT nChar, UINT nRepCnt, UINT =
>nFlags=20
>);<BR>> ><BR>> >So, my question is :<BR>> ><BR>> =
>>How to=20
>get the Events of the parent Class in the 'Event Handler' =
>(or<BR>>=20
>>somewhere else perhaps ...) ?<BR>> ><BR>> >.... I have =
>Searched=20
>in the MSDN, and i have found nothing, perhaps you<BR>> know<BR>> =
>>in=20
>wich chapter i have to go ...<BR>> ><BR>> >Thank's to=20
>anyone.<BR>> ><BR>> >Driss<BR>> ><BR>> ><BR>> =
>
>><BR>> </FONT></BODY></HTML>
>
>
Posting Permissions
- You may not post new threads
- You may not post replies
- You may not post attachments
- You may not edit your posts
-
Forum Rules
|
Development Centers
-- Android Development Center
-- Cloud Development Project Center
-- HTML5 Development Center
-- Windows Mobile Development Center
|