CIPAddressCtrl - capturing keyboard input

CIPAddressCtrl - capturing keyboard input

Post by Margie » Thu, 19 Oct 2006 03:00:47


I have created a grid (downloaded code) which contains some cells that
contain a CIPAddressCtrl. My goal is to have the right/left arrow keys
traverse through the cells of a row as each key is pressed, with the
exception of IP address cell. For this cell type, the focus should
traverse through each of the IP fields until focus gets to the last
field of the IP. Focus should then get set to the next cell in the
row.

For regular cells having focus, the grid class is able to capture the
keyboard input via
OnKeyDown(). My problem is that once an IP field gains focus, I am no
longer able to capture keyboard input in the grid class or in the
derived CIPAddressCtrl class (CInPlaceIP). I printed out all messages
from the CInPlaceIP's WindowProc(), but see no keyboard entries. It
seems like each child IP field control does its own internal
OnKeyDown() handling and then sets focus to the next sibling field.
This initially appears fine, but I need to know when the arrow key is
entered so that I can force the focus to the next cell when the last IP
field has been reached. Otherwise, the focus will never leave the IP
control when using the arrow keys.

The CInPlaceIP gets WM_PARENTNOTIFY messages for each of the IP child
fields as they are created, but I haven't found a way to get into
those controls to over-ride their OnKeyDown() handling, or capture the
input before it gets to fields.

I'd appreciate any ideas on capturing keyboard input when any of the
four IP fields has focus.

Thanks,
Margie
 
 
 

CIPAddressCtrl - capturing keyboard input

Post by AliR » Thu, 19 Oct 2006 04:19:26

To catch the WM_KEYDOWN message in the IP control do this
BOOL CInPlaceIP::PreTranslateMessage(MSG* pMsg)
{
if (pMsg->message == WM_KEYDOWN)
{
TRACE("WM_KEYDOWN");
}


return CIPAddressCtrl::PreTranslateMessage(pMsg);
}


AliR.

 
 
 

CIPAddressCtrl - capturing keyboard input

Post by jmar » Thu, 19 Oct 2006 06:25:40

You may still using the tab key
to go between windows items, and
keep arrows keys to move within
an item?

jmarc...
 
 
 

CIPAddressCtrl - capturing keyboard input

Post by Margie » Fri, 20 Oct 2006 03:05:50

Thanks AliR,
Your suggestion did the trick!
Margie