Print Page | Close Window

CXTPControlEditCtrl::OnKeyDown

Printed From: Codejock Forums
Category: Codejock Products
Forum Name: Controls
Forum Description: Topics Related to Codejock Controls
URL: http://forum.codejock.com/forum_posts.asp?TID=24249
Printed Date: 29 April 2024 at 9:08pm
Software Version: Web Wiz Forums 12.04 - http://www.webwizforums.com


Topic: CXTPControlEditCtrl::OnKeyDown
Posted By: rdhd
Subject: CXTPControlEditCtrl::OnKeyDown
Date Posted: 13 December 2021 at 2:45pm
I want the CXTPControlEditCtrl to execute if the user presses the return key. I found CXTPControlEditCtrl::OnKeyDown does just that. But it isn't even called in my case. I have added a CXTPControlEdit on our ribbon and it implements OnHookKeyDown. In that code it traps VK_RETURN and VK_CHAR and returns FALSE.

What do I do to get the CXTPControlEditCtrl contol to get the OnKeyDown message handler to execute? Key down is in it's message map. So is mouse move and that fires when I move the mouse over the edit control.

I have my own CXTPControlEditCtrl subclass. I added an OnKeyDown handler. It is called but not for VK_RETURN. I think that hooker being used is stopping the control edit ctrl from getting the message it needs and deserves.

Don't know if it is the hooker but I have to be careful where I set breakpoints in OnHookKeyDown - visual studio break point trips and then VS quits responding and I have to kill it via task manager.



Replies:
Posted By: rdhd
Date Posted: 13 December 2021 at 3:47pm
This seems slightly wrong but I finally overrode OnHookKeyDown and called the CXTPControlEdit::OnHookKeyDown. If it returns FALSE (not FALSE_EXIT - A slight "misuse" of BOOL) I see if nChar was VK_RETURN and if so, I called GetEditCtrl and then GetControlEdit and called OnExecute directly.

I still can't quite fathom what this hooker returning FALSE is for or why the code isn't executing without me jumping thru these hoops. Its like the buddy button is a must. Without it and this new code, I wouldn't have been able to get the user to hit return to perform my action.

I added the buddy button first and did not avoid that code when I found return not working. I did search thru the CJ edit code to see if the buddy button had anything to do with return not working but I didn't see anything obvious so I left that code as is. Besides, I want both a buddy click or a return to execute my code.



Print Page | Close Window

Forum Software by Web Wiz Forums® version 12.04 - http://www.webwizforums.com
Copyright ©2001-2021 Web Wiz Ltd. - https://www.webwiz.net