CPB Mailing List
[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
Re: Capture arrowkeys
Hi Jakob!
I am using the following technique to do what you want.
In your Form .h file, add the following line to your Private section:
void __fastcall CMDialogKey(TWMKey &message);
Next, in your header file, at the following as a Message Map Handler to
your Form class:
BEGIN_MESSAGE_MAP
MESSAGE_HANDLER(CM_DIALOGKEY, TWMKey, CMDialogKey)
END_MESSAGE_MAP(TForm)
Then, in your Form .cpp file, add a function to handle CMDialogKey:
void __fastcall TYourForm::CMDialogKey(TWMKey &message)
{
int myKey = message.CharCode;
if(myKey == VK_RIGHT)
SendMessage(hWnd, WM_HSCROLL, SB_PAGEDOWN, NULL);
if(myKey == VK_LEFT)
SendMessage(hWnd, WM_HSCROLL, SB_PAGEUP, NULL);
}
where hWnd is the window handle of a control I am scrolling left and right
in this case.
Hope this helps you,
Jim Stover
Jakob Braad wrote:
> How can i capture keypresses on the arrowkeys, while I have buttons on
> the form.
W Komornicki's Home Page |
Main Index |
Thread Index