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 » Problem using keyboard shortcuts on Menu Collapse All
Subject Author Date
Fabio Ermotti Mar 23, 2007 - 5:04 AM

Hi,
i think that there are problems using only keybord on Prof-UIS Menu.
I’ve implemented it in my application but I able to regenerate the problems even in sample applications.

In Drawcli application I would like to use "Alt+Key" to navigate the menu; "Alt+V" opens "View" menu but if I press "T" for "Toolbar" the menu closes.

Other similar problem:
I tried to use "Alt+Keys" on the child view "es. Drawcl1" but the "Alt" has effect directy on main menu.
For example: I want to minimize "Drawcl1" window by pressing "Alt+n" but it doesn’t work.
It seems that the "Alt" key is captured first from main menu.


I have the same problem on my application with Prof-UIS menu.

Question: is it possible to send "Alt" key first to my focused child window ?

Thanks

Regards

Technical Support Mar 23, 2007 - 2:16 PM

We fixed this bug. Please contact us via email for the update.



Fabio Ermotti Mar 28, 2007 - 2:43 AM

Thanks for the bug correction,
it solved the first problem but not the second one.

We have the FDI Child with his own menu bar, different from the MainFrame’s menu bar.
After the integration of your menu in the MainFrame, we cannot use "Alt" key in the Child view, because it is captured first from the MainFrame menu.
Before, the "Alt" key was captured first from the Child view (when it was focused).

Could you help me about this problem ?

Thanks

Technical Support Mar 29, 2007 - 11:17 AM

The ALT key (VK_MENU) is processed in CExtMenuControlBar, the MFC’s message pre-translation so CExtMenuControlBar::TranslateMainFrameMessage() is typically called from the CMainFrame::PreTranslateMessage() virtual method. If you do not call CExtMenuControlBar::TranslateMainFrameMessage(), it won’t be activated when ALT is pressed. So you should pretranslate ALT in your code first and, if it is not needed in your active FDI view, invoke the CExtMenuControlBar::TranslateMainFrameMessage() method. The menu bar itself cannot know when this key may be needed in your FDI/MDI/SDI view window and simply starts tracking the menu in any case when the ALT key is pressed.

Suhai Gyorgy Mar 28, 2007 - 3:45 AM

If I understand right, you have an SDI application, so I guess you have a CView-derived object as a member variable of the MainFrame class and you call Create on this view object in CMainFrame::OnCreate. If so, all you need to do is to add some code in your CMainFrame::PreTranslateMessage override:

BOOL CMainFrame::PreTranslateMessage(MSG* pMsg) 
{
	if( pMsg->message == WM_SYSKEYDOWN )
	{
		if( m_wndView.PreTranslateMessage( pMsg ) )
			return TRUE;
	}
	if( m_wndMenuBar.TranslateMainFrameMessage(pMsg) )
		return TRUE;
	return CFrameWnd::PreTranslateMessage( pMsg );
}
Make sure to change CFrameWnd to the baseclass of your CMainFrame, should it be different from CFrameWnd.

But this code might not be perfect, it might miss some additional conditions in if.