Professional UI Solutions
Site Map   /  Register
 
 

Forum

Please Log In to post a new message or reply to an existing one. If you are not registered, please register.

NOTE: Some forums may be read-only if you are not currently subscribed to our technical support services.

Forums » Prof-UIS General Discussion » In CExtResizableDialog override default CExtButton behavoir on VK_SPACE Collapse All
Subject Author Date
Krustys Donuts Jan 20, 2010 - 11:21 AM

Support,


In a CExtResizableDialog I am trying to override the default CExtButton behavoir on VK_SPACE message. Specifically, I don’t want the button with the focus to ’press’ when the user hits the space bar. I have overridden PreTranslateMessage in the dialog class. Although I get the desired result, I still get the default behavior. Any suggestions?


Gil

BOOL CV11ExtResizableDialog::PreTranslateMessage(MSG* pMsg)


{


 


{


 


 


 


 


{


 


if (pMsg->message == WM_KEYDOWN)bool bShift = (GetAsyncKeyState(VK_SHIFT) & 0x8000) != 0;bool bControl = (GetAsyncKeyState(VK_CONTROL) & 0x8000) != 0;bool bAlt = (GetAsyncKeyState(VK_MENU) & 0x8000) != 0;switch(pMsg->wParam)//If the user has pressed CTRL+Shift+ALT+v

 


 


{


CWnd* pWnd = GetParent();


 


pWnd->SendMessage(WM_USER_CTRL_ALT_SHIFT_V_Pressed);


}


 


 


case ’V’:if (bShift && bControl && bAlt)if (pWnd != NULL)break;//If the user has pressed the space bar.

 


case VK_SPACE:

CWnd* pWnd = GetParent();


 


{


 


if (pWnd != NULL)//Let parent determine action.

pWnd->SendMessage(WM_USER_SpaceBarPressed);


 


//Don’t allow space on this control.

 


}


}


 


}


}


 


}


return TRUE;break;return CExtNCW < CExtResizableDialog >::PreTranslateMessage(pMsg);

Technical Support Jan 20, 2010 - 1:32 PM

You should handle the WM_KEYDOWN and WM_KEYUP messages with the WPARAM parameter set to the VK_SPACE value in the overridden PreTranslateMessage() virtual method in your CExtButton-derived class. Your PreTranslateMessage() virtual method should not invoke the parent class method for VK_SPACE key.