|
|
|
|
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.
Subject |
Author |
Date |
|
Maxim Tebenev
|
Aug 3, 2005 - 2:56 AM
|
Greetings! Could you please suggest how to add edit box in place of context (popup) menu item. ProfUIS_Contols sample has in-place menus, but they are in menu control bar. What I’m need is to add edit box to CExtPopupMenuWnd (if there’s no a different way). A also noted that CExtPopupMenuWnd has inner class CInPlaceEditWnd. Will that class help me and if yes, how can I reuse it. Thanks in advance. Best regards, Maxim Tebenev.
|
|
Technical Support
|
Aug 3, 2005 - 1:15 PM
|
The in-place edit and combo-box fields in pop-up menus were designed for customizable menus. They cannot appear in a pop-up menu loaded form a menu resource or in a Prof-UIS menu updated from a HMENU handle. These fields can appear in menus by marking appropriate command tree nodes stored in the customize site as text field or combo-box field items. These fields can also appear in pop-up menus of non-customizable application by accessing the MENUITEMDATA structure that corresponds to a particular menu item and marking it as a text/combo-box field and by setting callback function pointers for controlling in-place edit control and pop-up list box. Here is the most simple way to initialize the in-place editor for a menu item: CExtSafeString strTextBufferForInplaceEdit;
CExtPopupMenuWnd * pPopup = ...
int nItemIndex = ...
CExtPopupMenuWnd::MENUITEMDATA & _mi =
pPopup->ItemGetInfo( nItemIndex );
_mi.SetInplaceEdit(
&strTextBufferForInplaceEdit,
NULL, // pCbVerifyTextInput
NULL, // pCbPutTextInputResult
NULL, // pCbInplaceEditWndProc
NULL, // LPVOID cookie value that is specific for this edit
__EXT_MENU_DEF_INPLACE_EDIT_WIDTH // editor width
); You can define callback functions of an appropriate type and pass them instead of NULL pointers.
|
|
Maxim Tebenev
|
Aug 4, 2005 - 1:32 AM
|
Thanks, it works well. There’s one problem though. When I press Enter key after typing text in edit box, there’s sound appears like after calling MessageBeep(0). Could you please advice how can I change this behavior. One more thing regarding to popup menu: popup menu in Prof-UIS doesn’t have method similar to SetMenuDefaultItem Win32 API function. Are you planning to add that feature or is there simple workaround for that? Thanks in forward! Best regards, Maxim.
|
|
Technical Support
|
Aug 7, 2005 - 9:46 AM
|
We have added support for default menu items and sent you e-mail with instructions. The Popup Menus page in the ProfUIS_Controls sample application now displays a context menu with the default About menu item. This menu item is initialized in the CPagePopupMenus::OnContextMenu() method of this sample: // MAKING "About" menu item default
INT nDefaultItemPos =
pPopup->ItemFindPosForCmdID(ID_APP_ABOUT);
if( nDefaultItemPos >= 0 )
pPopup->ItemDefaultSet(nDefaultItemPos); The DRAWCLI sample application displays a context menu over the shapes drawn in the view window. The Properties... item in this menu is also marked as the default menu item in the CDrawView::OnExtMenuPrepare() method of this sample application.
|
|
Technical Support
|
Aug 4, 2005 - 10:24 AM
|
We have fixed the problem with the beeping sound in the in-place editor for pop-up menu items. Please find the following code in the CExtPopupMenuWnd::CInPlaceEditWnd::WindowProc() method in the ...\Src\ExtPopupMenuWnd.cpp file: else if( message == WM_CHAR )
{
ASSERT( m_pStr != NULL );
CString sTextOld;
GetWindowText( sTextOld ); and replace it with the following code:
else if( message == WM_CHAR )
{
if( wParam == VK_RETURN ) // added
return 0; // added
ASSERT( m_pStr != NULL );
CString sTextOld;
GetWindowText( sTextOld ); We have added the default menu item support to our to-do list. This is not difficult because pop-up menu items are already can be marked bold. We just need to handle the VK_RETURN key when there is no selected item in menu.
|
|
Maxim Tebenev
|
Aug 4, 2005 - 11:39 PM
|
Thanks, it works fine! Looking forward for news regarding to bold items in menus. Best regards, Maxim Tebenev.
|
|