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 Tech Support » Accelerator Problem Collapse All
Subject Author Date
Jon Ort Aug 28, 2007 - 1:50 PM

We have an application using the CExtLabel class of ProfUIS 2.80. We are finding that all shortcut/accelerator keys defined using the CExtLabel class are not working. If we use the stock static control the accelerator functions as expected.

We have constructed a sample application to demonstrate this but it appears that I can not add an attachment.

The dialog does nothing, but has two pairs of static and edit controls. The statics precede the edit controls in the tab order, and the statics have shortcut/hotkey/accelerators defined with &.

The expected behavior is that pressing the shortcut key on the static should move keyboard focus to the next control in the tab order (the associated edit control).

If I explicitly declare the statics as CStatic variables, or disable the auto subclassing of controls, it works as expected. But if the statics are instances of CExtLabel, or are created by auto subclassing, the keyboard focus does not move and the speaker beeps.

Is this a bug, and if so do you have any advice on how to fix it?

Thanks
Jon

Technical Support Aug 29, 2007 - 12:42 PM

Thank you for reporting the problem. We have just fixed it. Please open the CExtLabel::WindowProc method and replace the following code snippet

else if( message == WM_GETTEXT )
{
	TCHAR * lpszText = (TCHAR *)lParam;
	// 2.55
	// __EXT_MFC_STRCPY(
	// 	lpszText, 
	// 	wParam, 
	// 	m_sText
	// 	);
	::memset( lpszText, 0, wParam );
	__EXT_MFC_STRNCPY(
		lpszText,
		wParam,
		m_sText,
		wParam - 1
		);
	lpszText[ wParam - 1 ] = _T(’\0’);
	lResult = TRUE;
}
with this one
else if( message == WM_GETTEXT )
{
	lResult = CStatic::WindowProc( message, wParam, lParam );
	TCHAR * lpszText = (TCHAR *)lParam;
	// 2.55
	// __EXT_MFC_STRCPY(
	// 	lpszText, 
	// 	wParam, 
	// 	m_sText
	// 	);
	::memset( lpszText, 0, wParam );
	__EXT_MFC_STRNCPY(
		lpszText,
		wParam,
		m_sText,
		wParam - 1
		);
	lpszText[ wParam - 1 ] = _T(’\0’);
}
After that, recompile the library.

Jon Ort Sep 4, 2007 - 2:28 PM

Thanks, that took care of it for the items based on that class. We have a possibly similar problem with the CExtCombo. When focus is on any part of the combo box none of the dialog accelerators work. As soon as you move to another control the accelerators work fine. When we drop back to a standard MFC combo box the accelerators work fine at all times.

Jon

Technical Support Sep 18, 2007 - 11:24 AM

We fixed this problem. Please open the CExtComboBoxBase::PreTranslateMessage() method and find the following lines at the bottom :

if( pMsg->message == WM_SYSCHAR )
	return TRUE;
Replace those lines with
if( pMsg->message == WM_SYSCHAR )
	return FALSE;
That should fix the problem.

Technical Support Sep 6, 2007 - 11:33 AM

Yes, we confirm this problem and will try to find a solution. Thank you.