keyboard key event
-
Ya u r correct. I used breakpoint also. Still i couldnt get the output window. I put breakpoint in OnInitDialog and PreTranslateMessage. once i press debug button, it directly goes to pretanslatemessage function and then goes to the end of the program. since i dun input any char if( WM_KEYDOWN == pMsg->message ) becomes false. so it goes to the end of the pretanslate function. in this case i can see the minimized window in the taskbar. but i couldnt maximize it. eventually i couldnt see the output window. :( Regards, Ram
-
Ram Murali wrote:
Ya i have added that in between BEGIN_MESSAGE_MAP and END_MESSAGE_MAP.
Sorry if my question look childish, Have you added OnKeyDown function plus What is your base class for your window program
"Opinions are neither right nor wrong. I cannot change your opinion. I can, however, change what influences your opinion." - David Crow
cheers, Alok Gupta VC Forum Q&A :- I/ IV Support CRY- Child Relief and You
ThatsAlok wrote:
OnKeyDown
r u saying that u can get the key down event in the combobox just by doing like this. the WM_KEYDOWN message goes to the edit control inside the combobox. It cannot be mapped like this from the dialog class, nor from a class drived from CCcomboBox nave
-
BOOL CTest::PreTranslateMessage(MSG* pMsg) { if( WM_KEYDOWN == pMsg->message ) { if( ::GetParent( pMsg->hwnd ) == m_combo.m_hWnd ) { TCHAR tcChar[2] = {0}; tcChar[0] = pMsg->wParam; AfxMessageBox( tcChar ); } } return CTest::PreTranslateMessage(pMsg); } Regards, Ram
-
BOOL CTest::PreTranslateMessage(MSG* pMsg) { if( WM_KEYDOWN == pMsg->message ) { if( ::GetParent( pMsg->hwnd ) == m_combo.m_hWnd ) { TCHAR tcChar[2] = {0}; tcChar[0] = pMsg->wParam; AfxMessageBox( tcChar ); } } return CTest::PreTranslateMessage(pMsg); } Regards, Ram
-
Ram Murali wrote:
return CTest::PreTranslateMessage(pMsg);
here lies the problem it should be like this CDialog::PreTranslateMessage(pMsg); nave
wow. thats gr8. But now i can able to key-in only one character. cannot key-in more than one char.:( Thanx for spending ur time for me. Thanx a lot. Regards, Ram
-
wow. thats gr8. But now i can able to key-in only one character. cannot key-in more than one char.:( Thanx for spending ur time for me. Thanx a lot. Regards, Ram
-
ThatsAlok wrote:
OnKeyDown
r u saying that u can get the key down event in the combobox just by doing like this. the WM_KEYDOWN message goes to the edit control inside the combobox. It cannot be mapped like this from the dialog class, nor from a class drived from CCcomboBox nave
Naveen R wrote:
u saying that u can get the key down event in the combobox just by doing like this. the WM_KEYDOWN message goes to the edit control inside the combobox.
I believe you havn't read my question carefully!, after reading your discussion with the PP(Problem Poster), i come to know he need to implement that for Combo Box!
Naveen R wrote:
t cannot be mapped like this from the dialog class, nor from a class drived from CCcomboBox
Really do you need my comment on this?
"Opinions are neither right nor wrong. I cannot change your opinion. I can, however, change what influences your opinion." - David Crow
cheers, Alok Gupta VC Forum Q&A :- I/ IV Support CRY- Child Relief and You
-
Let me explain my objective briefly. I need to desing combobox in such a way tat user can only enter the character "D", "I" and "0-9", in the combobox. If a user enters other character than the above specified, it should not be displayed in the Combobox. and the maximum no of character user can enter is only 5. this is my objective. with the current code, i can only enter one character. if i press the other character, the new one replaces the old character in the combobox. lets say i wannu enter "HELLO" if i press "H" message box shows H. then if i enter I, this I replace the H in the combobox. :(:^) again thanx a lot for ur spending ur valuable time for me. Regards, Ram
-
wow. thats gr8. But now i can able to key-in only one character. cannot key-in more than one char.:( Thanx for spending ur time for me. Thanx a lot. Regards, Ram
Ram Murali wrote:
ut now i can able to key-in only one character. cannot key-in more than one char.:(
create a string there only!
"Opinions are neither right nor wrong. I cannot change your opinion. I can, however, change what influences your opinion." - David Crow
cheers, Alok Gupta VC Forum Q&A :- I/ IV Support CRY- Child Relief and You
-
Naveen R wrote:
u saying that u can get the key down event in the combobox just by doing like this. the WM_KEYDOWN message goes to the edit control inside the combobox.
I believe you havn't read my question carefully!, after reading your discussion with the PP(Problem Poster), i come to know he need to implement that for Combo Box!
Naveen R wrote:
t cannot be mapped like this from the dialog class, nor from a class drived from CCcomboBox
Really do you need my comment on this?
"Opinions are neither right nor wrong. I cannot change your opinion. I can, however, change what influences your opinion." - David Crow
cheers, Alok Gupta VC Forum Q&A :- I/ IV Support CRY- Child Relief and You
-
Let me explain my objective briefly. I need to desing combobox in such a way tat user can only enter the character "D", "I" and "0-9", in the combobox. If a user enters other character than the above specified, it should not be displayed in the Combobox. and the maximum no of character user can enter is only 5. this is my objective. with the current code, i can only enter one character. if i press the other character, the new one replaces the old character in the combobox. lets say i wannu enter "HELLO" if i press "H" message box shows H. then if i enter I, this I replace the H in the combobox. :(:^) again thanx a lot for ur spending ur valuable time for me. Regards, Ram
-
Ram Murali wrote:
the new one replaces the old character in the combobox
this is happening only because ur showing a messagebox in that code. Try removing the AfxMessageBox in that code. nave
Ya.its working now. thanx for ur help.:-D Regards, Ram
-
ThatsAlok wrote:
i come to know he need to implement that for Combo Box!
its in the first question it self.:cool: nave
Naveen R wrote:
its in the first question it self.:cool:
then thats my mistake :).... Sorry:)
"Opinions are neither right nor wrong. I cannot change your opinion. I can, however, change what influences your opinion." - David Crow
cheers, Alok Gupta VC Forum Q&A :- I/ IV Support CRY- Child Relief and You
-
Naveen R wrote:
its in the first question it self.:cool:
then thats my mistake :).... Sorry:)
"Opinions are neither right nor wrong. I cannot change your opinion. I can, however, change what influences your opinion." - David Crow
cheers, Alok Gupta VC Forum Q&A :- I/ IV Support CRY- Child Relief and You
-
Naveen R wrote:
I found u too fro India. ur from which part of India?
Haridwar
"Opinions are neither right nor wrong. I cannot change your opinion. I can, however, change what influences your opinion." - David Crow
cheers, Alok Gupta VC Forum Q&A :- I/ IV Support CRY- Child Relief and You