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 |
|
|
L Freddi
|
Dec 2, 2009 - 4:45 AM
|
Hi, I want to add icon on CExtbutton. As your sample, I use AssignFromHICON() but i couldn’t see icon. below see my code, please help me. ====================================================== CExtButton m_ctrlBtnExample; m_ctrlBtnExample.SetWindowPos(NULL, dwX, dwY, 120, 70, NULL);
m_ctrlBtnExample.m_icon.AssignFromHICON(
(HICON) ::LoadImage(
::AfxGetInstanceHandle(),
MAKEINTRESOURCE(IDI_ICON1),
IMAGE_ICON,
32,
32,
0
),
false
); =======================================================
|
|
|
Technical Support
|
Dec 2, 2009 - 7:32 AM
|
Your code is absolutely correct. You can find the same code in the CPageButtons::OnInitDialog() method in the ProfUIS_Controls sample application and that’s why the CExtButton windows on the Buttons dialog page display icons. Please check whether the LoadImage() API returns a non-NULL icon handle.
|
|
|
Rahul B S
|
Dec 1, 2009 - 11:57 PM
|
I have derived a class from ’CExtPageContainerWnd’.
how can I map the navigation page selection change event (i.e., selection changing event and selection changed event)
in my derived class?
Also I need to get the index of the selected navigation page on that event.
Thanks
|
|
|
Rahul B S
|
Dec 2, 2009 - 11:25 PM
|
ok working fine. Thank u very much
|
|
|
Technical Support
|
Dec 2, 2009 - 7:32 AM
|
The CExtPageContainerWnd control implements a container for several page windows of any kind. These pages can be expanded or contracted. You can override the CExtPageContainerWnd::OnPageContainerItemExpanding() and CExtPageContainerWnd::OnPageContainerItemExpanded() virtual methods to catch the expanding event. The page container can be configured for keeping only one page window expanded. I.e. if the user expands some page, then the page container can automatically contract all the other pages. The page container control can automatically stretch the single exploded window to maximum available size. In any case, the page container control does not support selection. I.e. there is no selection in the page container control.
|
|
|
Nam Huy
|
Dec 1, 2009 - 2:51 PM
|
Hi,
I noticed that in 2.87, if the header cells are not visible ( using OuterRowCountTopset( 0L, true) ), the width for the column does not correspond with the one I set with ExtentSet (called from a header cell). However, that code was working in 2.85.
In other word, I was able to create and display a one-row-only grid with no headers with configurable column widths in 2.85 but not in 2.87.
Are there any changes that could reflect this new behavior?
Thank you!
|
|
|
Technical Support
|
Dec 2, 2009 - 7:31 AM
|
Grid controls work equally in 2.87 and 2.85. We didn’t change any sample projects dedicated to the grid controls in 2.87. The OuterRowCountTopset( 0L, true) code removes the header cell area at the top. I.e. it sets the count of header rows at the top to zero and you cannot specify column widths in the header cells. Please check this.
|
|
|
Borremans Pierre
|
Dec 1, 2009 - 7:17 AM
|
When I reduce the size of my application, each toolbar must be placed below the other. Is it possible ?
|
|
|
Technical Support
|
Dec 9, 2009 - 1:30 PM
|
You can create a test project with your improved toolbar behavior implementation and send it to us. We will check it.
|
|
|
Borremans Pierre
|
Dec 1, 2009 - 8:44 AM
|
and each toolbar must keep is maximum size (no hidden icon) how to do ?
|
|
|
Technical Support
|
Dec 2, 2009 - 3:31 AM
|
By default, the toolbar’s minimum size is determined by the size of toolbar when it has at least one visible button. If several toolbars are docked into one row and you decrease the width of the main frame window, the toolbars decrease their size too. If the minimum size of each toolbar is reached, they automatically wrap. It’s possible to implement the same behavior but with toolbars keeping a large width/height. You can override the CExtToolControlBar::_SizeToolBar() virtual method, determine whether the bar is docked and simply return without invoking the parent class method invocation. You can determine whether a toolbar is docked using the dialog control identifier of toolbar’s parent window. It’s one of the AFX_IDW_DOCKBAR_*** values.
|
|
|
Borremans Pierre
|
Dec 8, 2009 - 9:11 AM
|
I override the method _sizeToolbar() and only do a return; but when I resize my application my toolbar is reduce. Do you have a sample source ?
|
|
|
Bill Olson
|
Nov 25, 2009 - 4:28 AM
|
I thought I had this working when I applied the instructions for CextNCSB to a CExtListCtrl in the same way you instructed for a CRichEditCtrl, but there were some problems I just discovered. I have a CListCtrl derived class that is used in a few places in my application. I don’t recall exactly how I initially did it after I got the CRichEditCtrl scroll bars skinned, but it was looking correct. I have been experimenting around with it and currently the control and this is the current behavior: -Upon initial draw, the scroll bar is not skinned -When I scroll with the mouse wheel, the up and down arrows skin, but the slide bar does not. -Changing focus away from the control causes the slide bar to skin. -Moving the mouse over the slide bar also causes it to skin -The way it was working before the latest changes, the list would scroll with the mouse wheel, but not with the up and down arrows on the slide bar or grabbing and dragging the slide bar. This is how I currently have the control defined: The class definition class CTTListCtrl : public CExtNCSB <CExtListCtrl> The constructor CTTListCtrl::CTTListCtrl() : CExtNCSB < CExtListCtrl > (true,true) { } Declaration of the list control CTTListCtrl m_HistoryList; I tried deriving the CTTListCtrl class from CListCtrl as described in another forum post I saw here, but that only skins the scroll bar. I must be missing something simple. Bill
|
|
|
Bill Olson
|
Nov 30, 2009 - 11:47 PM
|
I e-mailed tech support with a sample project over the weekend. Bill
|
|
|
Technical Support
|
Dec 2, 2009 - 3:43 AM
|
We received your e-mail and replied it with a fixed version of your project in attachment.
|
|
|
Technical Support
|
Nov 26, 2009 - 2:06 AM
|
You correctly invoked the parent class constructor:
CTTListCtrl::CTTListCtrl() : CExtNCSB < CExtListCtrl > (true,true)
Please also check your code correctly invoked the parent class virtual methods. Prof-UIS uses themed list view control with themed scroll bars in the CExtShellDialogFile class. The file dialog is the very often used component and we have no similar reports about its list view control. In any case, you can create a simplest possible test project reproducing the problem and send it to us
|
|
|
Sergii Kh
|
Nov 23, 2009 - 2:08 PM
|
How can make one line label and edittextbox in ribbon interface. ProfUIS 2.85 for example: Name: ______
I try this code but, label is look like button
CExtRibbonNodeGroup * pRibbonGroupName = new CExtRibbonNodeToolGroup( ID_GROUP_NAME ); pRibbonGroup->InsertNode(0, pRibbonGroupName);
CExtCustomizeCmdTreeNode * pNodeName = new CExtRibbonNodeLabel(ID_LNAME, 0, 0, _T("Name:")); pRibbonGroupName->InsertNode(0, pNodeName);
CExtCustomizeCmdTreeNode *pNodeNameEditBox = new CExtRibbonNode( ID_NAME_ENTER ); pNodeNameEditBox->ModifyFlags( __ECTN_TBB_TEXT_FIELD ); pNodeNameEditBox->TextFieldWidthSet( 40 ); pRibbonGroupName->InsertNode(0, pNodeNameEditBox);
|
|
|
Sergii Kh
|
Nov 26, 2009 - 1:28 PM
|
Thank you. It works. Could you say how can I reduce distance between label and editbox?
|
|
|
Technical Support
|
Nov 27, 2009 - 1:23 PM
|
There are two solutions:
1) Create and use your own CExtRibbonNodeButton-derived class which instantiates your CExtRibbonButtonGroup button class. Your button class should implement the CExtRibbonButtonGroup::OnRibbonGetOuterGroupDistance() virtual method which returns required distances before/after group of buttons.
2) Override the CExtRibbonPage::_OnRibbonContentPaddingGetOuterGroupDistance() internal virtual method in your ribbon bar class. Return required distances for required group buttons.
In both cases you can even return negative distances.
|
|
|
Technical Support
|
Nov 26, 2009 - 2:08 AM
|
We inserted 3 groups with labels into the Clipboard group of buttons on the Home ribbon tab page in the RibbonBar sample application:
CExtRibbonNode * CMainFrame::_InitRibbonNode_Home_Clipboard()
{
CExtRibbonNodeGroup * pRibbonGroup =
new CExtRibbonNodeGroup( ID_RIBBON_PAGE_CLIPBOARD );
pRibbonGroup->CmdKeyTipSet( new CExtCustomizeCmdKeyTip( __EXT_MFC_SAFE_LPCTSTR( _T("ZC") ) ), false );
VERIFY( pRibbonGroup->m_iconBig.m_bmpNormal.LoadBMP_Resource( MAKEINTRESOURCE(ID_EDIT_PASTE_BIG) ) );
pRibbonGroup->m_iconBig.m_bmpNormal.Make32();
pRibbonGroup->m_iconBig.m_bmpNormal.AlphaColor( RGB(255,0,255), RGB(0,0,0), 0 );
CExtCustomizeCmdScreenTip * pCmdScreenTip = new CExtCustomizeCmdScreenTip;
pCmdScreenTip->TextMainSet( _T("Clipboard") );
pRibbonGroup->CmdScreenTipAttach( pCmdScreenTip );
pRibbonGroup->SetTextInToolbar( _T("Clipboard") );
CExtRibbonNodeDialogLauncher * pRibbonDLB =
new CExtRibbonNodeDialogLauncher( ID_RIBBON_PAGE_CLIPBOARD );
pCmdScreenTip = new CExtCustomizeCmdScreenTip;
pCmdScreenTip->CaptionMainSet( _T("Clipboard") );
pCmdScreenTip->TextMainSet( _T("Show the Clipboard\nTask Pane.") );
pCmdScreenTip->BmpMainGet().LoadBMP_Resource( MAKEINTRESOURCE(ID_CLIPBOARD_DLB_TIP_IMAGE) );
pCmdScreenTip->BmpMainGet().Make32();
pCmdScreenTip->BmpMainGet().AlphaColor( RGB(255,0,255), RGB(0,0,0), 0 );
pRibbonDLB->CmdScreenTipAttach( pCmdScreenTip );
pRibbonDLB->CmdKeyTipSet( new CExtCustomizeCmdKeyTip( __EXT_MFC_SAFE_LPCTSTR( _T("FO") ) ), false );
pRibbonGroup->InsertNode( NULL, pRibbonDLB );
///////////////////////////////////////////////////////////////////////
// BENGIN: NEW TEST CODE
for( int nTest = 0; nTest < 3; nTest ++ )
{
CExtRibbonNodeGroup * pTestGroup = new CExtRibbonNodeToolGroup( 123 );
pRibbonGroup->InsertNode( NULL, pTestGroup );
CExtRibbonNodeGroup * pTestGroupInner = new CExtRibbonNodeGroup( 123 );
pTestGroup->InsertNode( NULL, pTestGroupInner );
static LPCTSTR g_arrLabelTexts[3] = { _T("TestLabel1"), _T("TestLabel2"), _T("TestLabel3") };
CExtRibbonNodeLabel * pNodeIndentLabel = new CExtRibbonNodeLabel( 123, NULL, 0, g_arrLabelTexts[nTest] );
pTestGroupInner->InsertNode( NULL, pNodeIndentLabel );
CExtCustomizeCmdTreeNode * pTestTextField = new CExtRibbonNode( 123 );
pTestTextField->ModifyFlags( __ECTN_TBB_TEXT_FIELD /*|__ECTN_TBB_COMBO*/ );
INT nFontNameFieldWidth = g_PaintManager.GetPM()->UiScalingDo( 143, CExtPaintManager::__EUIST_X );
pTestTextField->TextFieldWidthSet( nFontNameFieldWidth );
pTestGroup->InsertNode( NULL, pTestTextField );
}
// END: NEW TEST CODE
///////////////////////////////////////////////////////////////////////
// pRibbonGroup->InsertNode( NULL, new CExtRibbonNodeDialogLauncher( ID_RIBBON_PAGE_CLIPBOARD ) );
// pRibbonGroup->InsertNode( NULL, new CExtRibbonNodeDialogLauncher( ID_RIBBON_PAGE_CLIPBOARD ) );
// pRibbonGroup->InsertNode( NULL, new CExtRibbonNodeDialogLauncher( ID_RIBBON_PAGE_CLIPBOARD ) );
// CExtSpinRibbonNode * pNodeSpin = new CExtSpinRibbonNode( 1234 );
// pRibbonGroup->InsertNode(
// NULL,
// pNodeSpin
// );
CExtRibbonNode * pNodePaste =
new CExtRibbonNode( ID_EDIT_PASTE, 0, NULL, 0, _T("Paste") );
pNodePaste->CmdKeyTipSet( new CExtCustomizeCmdKeyTip( __EXT_MFC_SAFE_TCHAR( _T(’V’) ) ), false );
pNodePaste->RibbonILE_RuleArrayGet().RemoveAll();
VERIFY( pNodePaste->m_iconBig.m_bmpNormal.LoadBMP_Resource( MAKEINTRESOURCE(ID_EDIT_PASTE_BIG) ) );
pNodePaste->m_iconBig.m_bmpNormal.Make32();
pNodePaste->m_iconBig.m_bmpNormal.AlphaColor( RGB(255,0,255), RGB(0,0,0), 0 );
pCmdScreenTip = new CExtCustomizeCmdScreenTip;
pCmdScreenTip->CaptionMainSet( _T("Paste") );
pCmdScreenTip->TextMainSet( _T("Paste the contents\nof the Clipboard.") );
pCmdScreenTip->BmpMainGet().LoadBMP_Resource( MAKEINTRESOURCE(ID_EDIT_PASTE_BIG) );
pCmdScreenTip->BmpMainGet().Make32();
pCmdScreenTip->BmpMainGet().AlphaColor( RGB(255,0,255), RGB(0,0,0), 0 );
pCmdScreenTip->CaptionSecondarySet( _T("Press F1 for more help.") );
pCmdScreenTip->BmpSecondaryGet().LoadBMP_Resource( MAKEINTRESOURCE(ID_APP_ABOUT_16x16) );
pCmdScreenTip->BmpSecondaryGet().PreMultiplyRGBChannels( false );
pNodePaste->CmdScreenTipAttach( pCmdScreenTip, true );
pCmdScreenTip = new CExtCustomizeCmdScreenTip;
pCmdScreenTip->CaptionMainSet( _T("Paste") );
pCmdScreenTip->TextMainSet( _T("Click here for more options such as\npasting only the values or\nformatting.") );
pCmdScreenTip->BmpMainGet().LoadBMP_Resource( MAKEINTRESOURCE(ID_EDIT_PASTE_BIG) );
pCmdScreenTip->BmpMainGet().Make32();
pCmdScreenTip->BmpMainGet().AlphaColor( RGB(255,0,255), RGB(0,0,0), 0 );
pCmdScreenTip->CaptionSecondarySet( _T("Press F1 for more help.") );
pCmdScreenTip->BmpSecondaryGet().LoadBMP_Resource( MAKEINTRESOURCE(ID_APP_ABOUT_16x16) );
pCmdScreenTip->BmpSecondaryGet().PreMultiplyRGBChannels( false );
pNodePaste->CmdScreenTipAttach( pCmdScreenTip, false );
pRibbonGroup->InsertNode(
NULL,
pNodePaste
);
// g_CmdManager->CmdAllocPtr(
// g_CmdManager->ProfileNameFromWnd( m_hWnd ),
// ID_EDIT_PASTE )->m_sMenuText = "12";
pNodePaste->ModifyFlags( __ECTN_TBB_SEPARATED_DROPDOWN );
CExtCustomizeCmdTreeNode * pNodePaste_Paste =
new CExtCustomizeCmdTreeNode( ID_EDIT_PASTE, ID_EDIT_PASTE, NULL, 0, _T("Paste"), _T("&Paste") );
pNodePaste_Paste->CmdKeyTipSet( new CExtCustomizeCmdKeyTip( __EXT_MFC_SAFE_TCHAR( _T(’P’) ) ), false );
pNodePaste->InsertNode(
NULL,
pNodePaste_Paste
);
CExtCustomizeCmdTreeNode * pNodePaste_Special =
new CExtCustomizeCmdTreeNode( ID_EDIT_PASTE_SPECIAL, ID_EDIT_PASTE_SPECIAL, NULL, 0, _T("Paste &Special...") );
pNodePaste_Special->CmdKeyTipSet( new CExtCustomizeCmdKeyTip( __EXT_MFC_SAFE_TCHAR( _T(’S’) ) ), false );
pNodePaste->InsertNode(
NULL,
pNodePaste_Special
);
CExtCustomizeCmdTreeNode * pNodePaste_Hyperlink =
new CExtCustomizeCmdTreeNode( ID_EDIT_PASTE_AS_HYPERLINK, ID_EDIT_PASTE_AS_HYPERLINK, NULL, 0, _T("Paste as &Hyperlink") );
pNodePaste_Hyperlink->CmdKeyTipSet( new CExtCustomizeCmdKeyTip( __EXT_MFC_SAFE_TCHAR( _T(’H’) ) ), false );
pNodePaste->InsertNode(
NULL,
pNodePaste_Hyperlink
);
// pRibbonGroup->InsertNode(
// NULL,
// new CExtRibbonNode // separator
// );
CExtRibbonNode * pNodeCopy =
new CExtRibbonNode( ID_EDIT_COPY, 0, NULL, 0, _T("Copy") );
pNodeCopy->CmdKeyTipSet( new CExtCustomizeCmdKeyTip( __EXT_MFC_SAFE_TCHAR( _T(’C’) ) ), false );
//pNodeCopy->ModifyFlags( __ECTN_TBB_UNDO_REDO|__ECTN_TBB_SEPARATED_DROPDOWN );
pNodeCopy->RibbonILE_RuleRemoveLargeILV();
VERIFY( pNodeCopy->m_iconSmall.m_bmpNormal.LoadBMP_Resource( MAKEINTRESOURCE(ID_EDIT_COPY_SMALL) ) );
pNodeCopy->m_iconSmall.m_bmpNormal.Make32();
pNodeCopy->m_iconSmall.m_bmpNormal.AlphaColor( RGB(255,0,255), RGB(0,0,0), 0 );
pCmdScreenTip = new CExtCustomizeCmdScreenTip;
pCmdScreenTip->CaptionMainSet( _T("Copy") );
pCmdScreenTip->TextMainSet( _T("Copy the selection and\nput it on the Clipboard.") );
pNodeCopy->CmdScreenTipAttach( pCmdScreenTip );
pRibbonGroup->InsertNode(
NULL,
pNodeCopy
);
CExtRibbonNode * pNodeCut =
new CExtRibbonNode( ID_EDIT_CUT, 0, NULL, 0, _T("Cut") );
pNodeCut->CmdKeyTipSet( new CExtCustomizeCmdKeyTip( __EXT_MFC_SAFE_TCHAR( _T(’X’) ) ), false );
pNodeCut->RibbonILE_RuleRemoveLargeILV();
VERIFY( pNodeCut->m_iconSmall.m_bmpNormal.LoadBMP_Resource( MAKEINTRESOURCE(ID_EDIT_CUT_SMALL) ) );
pNodeCut->m_iconSmall.m_bmpNormal.Make32();
pNodeCut->m_iconSmall.m_bmpNormal.AlphaColor( RGB(255,0,255), RGB(0,0,0), 0 );
pCmdScreenTip = new CExtCustomizeCmdScreenTip;
pCmdScreenTip->CaptionMainSet( _T("Cut") );
pCmdScreenTip->TextMainSet( _T("Cut the selection from the document\nand put it on the Clipboard.") );
pNodeCut->CmdScreenTipAttach( pCmdScreenTip );
pRibbonGroup->InsertNode(
NULL,
pNodeCut
);
CExtRibbonNode * pNodeClearFormatting =
new CExtRibbonNode( ID_EDIT_CLEAR, 0, NULL, 0, _T("Clear Formatting") );
pNodeClearFormatting->CmdKeyTipSet( new CExtCustomizeCmdKeyTip( __EXT_MFC_SAFE_LPCTSTR( _T("FP") ) ), false );
pNodeClearFormatting->RibbonILE_RuleRemoveLargeILV();
VERIFY( pNodeClearFormatting->m_iconSmall.m_bmpNormal.LoadBMP_Resource( MAKEINTRESOURCE(ID_EDIT_CLEAR_SMALL) ) );
pNodeClearFormatting->m_iconSmall.m_bmpNormal.Make32();
pNodeClearFormatting->m_iconSmall.m_bmpNormal.AlphaColor( RGB(255,0,255), RGB(0,0,0), 0 );
pCmdScreenTip = new CExtCustomizeCmdScreenTip;
pCmdScreenTip->CaptionMainSet( _T("Clear Formatting") );
pCmdScreenTip->TextMainSet( _T("Copy the formatting from one place\nand apply it to an other.\n\nUse this button to apply\nthe same formatting to multiple\nplaces in the document.") );
pCmdScreenTip->CaptionSecondarySet( _T("Press F1 for more help.") );
pCmdScreenTip->BmpSecondaryGet().LoadBMP_Resource( MAKEINTRESOURCE(ID_APP_ABOUT_16x16) );
pCmdScreenTip->BmpSecondaryGet().PreMultiplyRGBChannels( false );
pNodeClearFormatting->CmdScreenTipAttach( pCmdScreenTip );
pRibbonGroup->InsertNode(
NULL,
pNodeClearFormatting
);
return pRibbonGroup;
}
|
|
|
Sergii Kh
|
Nov 24, 2009 - 11:10 PM
|
I try use CExtRibbonNodeGroup but I will getting result in different lines. Name: __________ How change to get result in same line?
|
|
|
Technical Support
|
Nov 24, 2009 - 2:16 PM
|
You should create label and text field nodes inside a CExtRibbonNodeGroup group node instead of the CExtRibbonNodeToolGroup toolbar group node.
|
|
|
Borremans Pierre
|
Nov 23, 2009 - 6:37 AM
|
Is it possible to hide a pane in my statusbar ?
|
|
|
Technical Support
|
Nov 23, 2009 - 9:37 AM
|
The CExtStatusControlBar control implements a themed version of the CStatusBar control with handy improvements like attaching a control to a status pane. But both controls, unfortunately, does not support hidden status panes. You should remove status pane (CExtStatusControlBar::RemovePane()) instead of hiding them and insert status panes (CExtStatusControlBar::AddPane()) when they should become visible.
|
|
|
Dirk Lindner
|
Nov 19, 2009 - 5:56 AM
|
Hello, i have written a styled cextscrollbar rightclickmenu. But i have problems with large ClistView controls (120.000) items. The listview dont scroll to ottom or a large position within the listview. It also crashes from time to time at the following postion:
Run-Time Check Failure #2 - Stack around the variable ’pt’ was corrupted.
ProfUIS287md.dll!CExtPopupMenuWnd::_EndSequenceEx(CExtPopupMenuWnd::MENUITEMDATA & mi={...}) Zeile 14399 + 0x1c C++
Any idea ?
Thanks
extscrollwnd.h
#define ID_PROFUIS_SCROLL_BAR 30 #define ID_PROFUIS_SCROLL_HERE 31 #define ID_PROFUIS_SCROLL_TOP 32 #define ID_PROFUIS_SCROLL_BOTTOM 33 #define ID_PROFUIS_SCROLL_UP 34 #define ID_PROFUIS_SCROLL_DOWN 35 #define ID_PROFUIS_SCROLL_UP2 36 #define ID_PROFUIS_SCROLL_DOWN2 37 #define ID_PROFUIS_SCROLL_LEFT 38 #define ID_PROFUIS_SCROLL_RIGHT 39 #define ID_PROFUIS_SCROLL_SITE_LEFT 40 #define ID_PROFUIS_SCROLL_SITE_RIGHT 41 #define ID_PROFUIS_SCROLL_LEFT2 42 #define ID_PROFUIS_SCROLL_RIGHT2 43
//Scroll afx_msg void OnScrollHere(); afx_msg void OnScrollBottom(); afx_msg void OnScrollTop(); afx_msg void OnScrollUp(); afx_msg void OnScrollDown(); afx_msg void OnScrollSiteUp(); afx_msg void OnScrollSiteDown(); CPoint m_point;
extscrollwnd.cpp
void CExtScrollBar::OnContextMenu(CWnd* pWnd, CPoint point) { ASSERT_VALID( this );
CFrameWnd* pFrame = GetParentFrame(); if(!pFrame) return; HWND hwnd = m_hWnd; if( !IsWindow(hwnd ) || hwnd == NULL ) return; __EXT_MFC_SAFE_LPCTSTR sProfileName = g_CmdManager->ProfileNameFromWnd( hwnd );
//Popup Menu erzeugen CExtPopupMenuWnd* pPopup = new CExtPopupMenuWnd; pPopup->CreatePopupMenu(hwnd);
CString str;
//ID_PROFUIS_SCROLL_HERE LRESULT lresult = pFrame->SendMessage(ID_PROFUIS_SCROLL_BAR, ID_PROFUIS_SCROLL_HERE , ((LPARAM) &str)); if(!(bool)lresult) return; CExtCmdItem _cmd; _cmd.m_sMenuText = str; _cmd.m_nCmdID = ID_PROFUIS_SCROLL_HERE; g_CmdManager->CmdSetup(sProfileName,_cmd); pPopup->ItemInsert( ID_PROFUIS_SCROLL_HERE,-1,str,NULL,hwnd ); pPopup->ItemInsert();//seperator einfuegen
eScrollerOrientation_t ot = GetScrollerOrientation();
if(ot == __ESO_LEFT || ot == __ESO_RIGHT ){//Vertikaler Bildlauf //ID_PROFUIS_SCROLL_TOP LRESULT lresult = pFrame->SendMessage(ID_PROFUIS_SCROLL_BAR, ID_PROFUIS_SCROLL_TOP ,((LPARAM) &str)); if(!(bool)lresult) return; CExtCmdItem _cmd; _cmd.m_sMenuText = str; _cmd.m_nCmdID = ID_PROFUIS_SCROLL_TOP; g_CmdManager->CmdSetup(sProfileName,_cmd); pPopup->ItemInsert(ID_PROFUIS_SCROLL_TOP,-1, str,NULL, hwnd ); //ID_PROFUIS_SCROLL_BOTTOM lresult = pFrame->SendMessage(ID_PROFUIS_SCROLL_BAR, ID_PROFUIS_SCROLL_BOTTOM , ((LPARAM) &str)); if(!(bool)lresult) return; _cmd.m_sMenuText = str; _cmd.m_nCmdID = ID_PROFUIS_SCROLL_BOTTOM; g_CmdManager->CmdSetup(sProfileName,_cmd); pPopup->ItemInsert( ID_PROFUIS_SCROLL_BOTTOM,-1, str,NULL,hwnd );
pPopup->ItemInsert();//seperator einfügen
//ID_PROFUIS_SCROLL_UP lresult = pFrame->SendMessage(ID_PROFUIS_SCROLL_BAR, ID_PROFUIS_SCROLL_UP , ((LPARAM) &str)); if(!(bool)lresult) return; _cmd.m_sMenuText = str; _cmd.m_nCmdID = ID_PROFUIS_SCROLL_UP; g_CmdManager->CmdSetup(sProfileName,_cmd); pPopup->ItemInsert( ID_PROFUIS_SCROLL_UP,-1,str,NULL,hwnd); //ID_PROFUIS_SCROLL_DOWN lresult = pFrame->SendMessage(ID_PROFUIS_SCROLL_BAR, ID_PROFUIS_SCROLL_DOWN , ((LPARAM) &str)); if(!(bool)lresult) return; _cmd.m_sMenuText = str; _cmd.m_nCmdID = ID_PROFUIS_SCROLL_DOWN; g_CmdManager->CmdSetup(sProfileName,_cmd); pPopup->ItemInsert( ID_PROFUIS_SCROLL_DOWN,-1,str,NULL,hwnd );
pPopup->ItemInsert();//seperator einfügen
//ID_PROFUIS_SCROLL_UP2 lresult = pFrame->SendMessage(ID_PROFUIS_SCROLL_BAR, ID_PROFUIS_SCROLL_UP2 , ((LPARAM) &str)); if(!(bool)lresult) return; _cmd.m_sMenuText = str; _cmd.m_nCmdID = ID_PROFUIS_SCROLL_UP2; g_CmdManager->CmdSetup(sProfileName,_cmd); pPopup->ItemInsert(ID_PROFUIS_SCROLL_UP2,-1,str,NULL,hwnd );
//ID_PROFUIS_SCROLL_DOWN2 lresult = pFrame->SendMessage(ID_PROFUIS_SCROLL_BAR, ID_PROFUIS_SCROLL_DOWN2 , ((LPARAM) &str)); if(!(bool)lresult) return; _cmd.m_sMenuText = str; _cmd.m_nCmdID = ID_PROFUIS_SCROLL_DOWN2; g_CmdManager->CmdSetup(sProfileName,_cmd); pPopup->ItemInsert( ID_PROFUIS_SCROLL_DOWN2,-1, str,NULL,hwnd ); }else if(ot == __ESO_TOP || ot == __ESO_BOTTOM ){//Horizentaler Bildlauf
//ID_PROFUIS_SCROLL_LEFT LRESULT lresult = pFrame->SendMessage(ID_PROFUIS_SCROLL_BAR, ID_PROFUIS_SCROLL_LEFT ,((LPARAM) &str)); if(!(bool)lresult) return; CExtCmdItem _cmd; _cmd.m_sMenuText = str; _cmd.m_nCmdID = ID_PROFUIS_SCROLL_LEFT; g_CmdManager->CmdSetup(sProfileName,_cmd); pPopup->ItemInsert( ID_PROFUIS_SCROLL_LEFT, -1, str,NULL, hwnd );
//ID_PROFUIS_SCROLL_RIGHT lresult = pFrame->SendMessage(ID_PROFUIS_SCROLL_BAR, ID_PROFUIS_SCROLL_RIGHT , ((LPARAM) &str)); if(!(bool)lresult) return; _cmd.m_sMenuText = str; _cmd.m_nCmdID = ID_PROFUIS_SCROLL_RIGHT; g_CmdManager->CmdSetup(sProfileName,_cmd); pPopup->ItemInsert( ID_PROFUIS_SCROLL_RIGHT,-1, str,NULL, hwnd );
pPopup->ItemInsert();//seperator einfügen
//ID_PROFUIS_SCROLL_SITE_LEFT lresult = pFrame->SendMessage(ID_PROFUIS_SCROLL_BAR, ID_PROFUIS_SCROLL_SITE_LEFT , ((LPARAM) &str)); if(!(bool)lresult) return; _cmd.m_sMenuText = str; _cmd.m_nCmdID = ID_PROFUIS_SCROLL_SITE_LEFT; g_CmdManager->CmdSetup(sProfileName,_cmd); pPopup->ItemInsert( ID_PROFUIS_SCROLL_SITE_LEFT, -1, str, NULL, hwnd );
//ID_PROFUIS_SCROLL_SITE_RIGHT lresult = pFrame->SendMessage(ID_PROFUIS_SCROLL_BAR, ID_PROFUIS_SCROLL_SITE_RIGHT , ((LPARAM) &str)); if(!(bool)lresult) return; _cmd.m_sMenuText = str; _cmd.m_nCmdID = ID_PROFUIS_SCROLL_SITE_RIGHT; g_CmdManager->CmdSetup(sProfileName,_cmd); pPopup->ItemInsert( ID_PROFUIS_SCROLL_SITE_RIGHT, -1, str, NULL, hwnd );
pPopup->ItemInsert();//seperator einfügen
//ID_PROFUIS_SCROLL_RIGHT2 lresult = pFrame->SendMessage(ID_PROFUIS_SCROLL_BAR, ID_PROFUIS_SCROLL_LEFT2 , ((LPARAM) &str)); if(!(bool)lresult) return; _cmd.m_sMenuText = str; _cmd.m_nCmdID = ID_PROFUIS_SCROLL_LEFT2; g_CmdManager->CmdSetup(sProfileName,_cmd); pPopup->ItemInsert( ID_PROFUIS_SCROLL_LEFT2,-1, str, NULL, hwnd );
//ID_PROFUIS_SCROLL_RIGHT2 lresult = pFrame->SendMessage(ID_PROFUIS_SCROLL_BAR, ID_PROFUIS_SCROLL_RIGHT2 , ((LPARAM) &str)); if(!(bool)lresult) return; _cmd.m_sMenuText = str; _cmd.m_nCmdID = ID_PROFUIS_SCROLL_RIGHT2; g_CmdManager->CmdSetup(sProfileName,_cmd); pPopup->ItemInsert( ID_PROFUIS_SCROLL_RIGHT2,-1, str, NULL,hwnd ); }
UINT nCmd; POINT pt; ::GetCursorPos( &pt ); pPopup->TrackPopupMenu( TPMX_SELECT_ANY,pt.x,pt.y,NULL,NULL,NULL,&nCmd); }
void CExtScrollBar::OnScrollHere() { int nStart,nRange; GetScrollRange(&nStart,&nRange); long nWidth; CRect rect; GetClientRect(&rect); CPoint tmp; eScrollerOrientation_t ot = GetScrollerOrientation(); if(ot == __ESO_LEFT || ot == __ESO_RIGHT ){//Vertikaler Bildlauf nWidth = rect.Height()-(m_nHorzBarHeight*2); long pos = (nRange *(m_point.y - m_nHorzBarHeight ))/(nWidth); tmp = m_point; _SetScrollPos(pos); }else{ nWidth = rect.Width()-(m_nHorzBarHeight*2); long pos = (nRange *(m_point.x - m_nHorzBarHeight ))/(nWidth); _SetScrollPos(pos); } }
void CExtScrollBar::OnScrollBottom() { int nStart,nRange; GetScrollRange(&nStart,&nRange); _SetScrollPos(nRange-nStart); }
void CExtScrollBar::OnScrollTop() { _SetScrollPos(0); }
void CExtScrollBar::OnScrollUp() { int nPos = GetScrollPos(); _SetScrollPos(nPos-m_nStepSize); }
void CExtScrollBar::OnScrollSiteUp() { SCROLLINFO scrollInfo; GetScrollInfo(&scrollInfo); int nPos = GetScrollPos(); _SetScrollPos(nPos-scrollInfo.nPage);
} void CExtScrollBar::OnScrollDown() { int nPos = GetScrollPos(); CString str; _SetScrollPos(nPos+m_nStepSize); }
void CExtScrollBar::OnScrollSiteDown() { int nPos = GetScrollPos(); SCROLLINFO scrollInfo; GetScrollInfo(&scrollInfo); _SetScrollPos(nPos+scrollInfo.nPage); }
void CExtScrollBar::OnRButtonDown(UINT nFlags, CPoint point) { ASSERT_VALID( this ); if( ! m_bCompleteRepaint ){//tod notwendig ? CScrollBar::OnRButtonDown( nFlags, point ); return; } CExtPopupMenuTipWnd * pATTW = OnAdvancedPopupMenuTipWndGet(); if( pATTW != NULL ) pATTW->Hide(); m_point = point; OnContextMenu(this,point); }
bool CExtScrollBar::ScrollBar_OnMouseClickMsg( MSG * pMSG ){
if(GetParent()) GetParent()->SetFocus(); ASSERT_VALID( this ); ASSERT( pMSG != NULL ); bool bRetVal = true; bool bRightClickMsg = false;
switch( pMSG->message ){ case WM_LBUTTONDOWN: ScrollBar_TrackMouseLButtonDown( pMSG ); break; case WM_RBUTTONDOWN: bRightClickMsg = true; case WM_RBUTTONUP: case WM_RBUTTONDBLCLK: //bRetVal = false; case WM_LBUTTONUP: case WM_LBUTTONDBLCLK: case WM_MBUTTONDOWN: case WM_MBUTTONUP: case WM_MBUTTONDBLCLK: { CExtPopupMenuTipWnd * pATTW = OnAdvancedPopupMenuTipWndGet(); if( pATTW != NULL ) pATTW->Hide(); if( bRightClickMsg ){ POINT pt; ::GetCursorPos( &pt ); SendMessage( WM_CONTEXTMENU, WPARAM(m_hWnd), MAKELPARAM(pt.x,pt.y) ); }
} break; default: bRetVal = false; break; } // switch( pMSG->message ) return bRetVal; } //sroll>>
|
|
|
Dirk Lindner
|
Nov 22, 2009 - 8:30 AM
|
here is an exmple app and the extscrollwnd files example.rar
|
|
|
Technical Support
|
Nov 25, 2009 - 3:44 AM
|
Thank you for sharing ideas with us. Here is the updated scroll bar code:
http://www.prof-uis.com/download/forums/tmp/ScrollBar288.zip
The 120 thousand problem is not solved yet. The list view common control’s window procedure returns the 100 thousand scrolling range when it handles the SBM_GETSCROLLINFO message - it never returns a greater range nevertheless the native non-client area scroll bars support this. It looks like we will need to re-code list view control from scratch.
|
|
|
Dirk Lindner
|
Nov 20, 2009 - 3:18 AM
|
First there comes a asser > mfc71d.dll!AfxAssertValidObject(const CObject * pOb=0xfeeefeee, const char * lpszFileName=0x01400174, int nLine=3749) Zeile 86 C++ ProfUIS287md.dll!CExtPopupMenuWnd::MENUITEMDATA::GetCmdNode() Zeile 3752 C++ ProfUIS287md.dll!CExtPopupMenuWnd::_EndSequenceEx(CExtPopupMenuWnd::MENUITEMDATA & mi={...}) Zeile 14325 + 0x8 C++ ProfUIS287md.dll!CExtPopupMenuWnd::_OnMouseClick(unsigned int nFlags=514, CPoint point={...}, bool & bNoEat=false) Zeile 14304 + 0x17 C++ ProfUIS287md.dll!CExtPopupMenuSite::_HookMouseProc(int nCode=0, unsigned int wParam=514, long lParam=1244740) Zeile 1271 + 0x29 C++ user32.dll!7e381923() ntdll.dll!7c925d47() user32.dll!7e378ea0() user32.dll!7e37b317() ntdll.dll!7c925d47() user32.dll!7e3816c8() ntdll.dll!7c91e473() user32.dll!7e3818d1() user32.dll!7e3691be() user32.dll!7e37776b() ntdll.dll!7c925d47() mfc71d.dll!AfxInternalPumpMessage() Zeile 158 + 0x13 C++ mfc71d.dll!CWinThread::PumpMessage() Zeile 916 C++ mfc71d.dll!CWinThread::Run() Zeile 637 + 0xb C++ mfc71d.dll!CWinApp::Run() Zeile 701 C++ mfc71d.dll!AfxWinMain(HINSTANCE__ * hInstance=0x00400000, HINSTANCE__ * hPrevInstance=0x00000000, char * lpCmdLine=0x00141f1f, int nCmdShow=1) Zeile 49 + 0xb C++ LucGismo_Debug.exe!WinMainCRTStartup() Zeile 390 + 0x39 C kernel32.dll!7c817077() ntdll.dll!7c925d47()
then Run-Time Check Failure #2 - Stack around the variable ’pt’ was corrupted. the message apears not always
> ProfUIS287md.dll!CExtPopupMenuWnd::_EndSequenceEx(CExtPopupMenuWnd::MENUITEMDATA & mi={...}) Zeile 14397 + 0x1c C++ ProfUIS287md.dll!CExtPopupMenuWnd::_OnMouseClick(unsigned int nFlags=514, CPoint point={...}, bool & bNoEat=false) Zeile 14304 + 0x17 C++ ProfUIS287md.dll!CExtPopupMenuSite::_HookMouseProc(int nCode=0, unsigned int wParam=514, long lParam=1244740) Zeile 1271 + 0x29 C++ user32.dll!7e381923() ntdll.dll!7c925d47() user32.dll!7e378ea0() user32.dll!7e37b317() ntdll.dll!7c925d47() user32.dll!7e3816c8() ntdll.dll!7c91e473() user32.dll!7e3818d1() user32.dll!7e3691be() user32.dll!7e37776b() ntdll.dll!7c925d47() mfc71d.dll!AfxInternalPumpMessage() Zeile 158 + 0x13 C++ mfc71d.dll!CWinThread::PumpMessage() Zeile 916 C++ mfc71d.dll!CWinThread::Run() Zeile 637 + 0xb C++ mfc71d.dll!CWinApp::Run() Zeile 701 C++ mfc71d.dll!AfxWinMain(HINSTANCE__ * hInstance=0x00400000, HINSTANCE__ * hPrevInstance=0x00000000, char * lpCmdLine=0x00141f1f, int nCmdShow=1) Zeile 49 + 0xb C++ LucGismo_Debug.exe!WinMainCRTStartup() Zeile 390 + 0x39 C kernel32.dll!7c817077() ntdll.dll!7c925d47()
|
|
|
Technical Support
|
Nov 20, 2009 - 2:37 PM
|
First of all, your menu construction code contains lines like these:
LRESULT lresult = pFrame->SendMessage(ID_PROFUIS_SCROLL_BAR, ID_PROFUIS_SCROLL_HERE , ((LPARAM) &str));
The ID_PROFUIS_SCROLL_BAR constant is used as a message number and it’s defined as: #define ID_PROFUIS_SCROLL_BAR 30
Please note, 30 equals to 0x1E and Win32 SDK contains the following definition: #define WM_TIMECHANGE 0x001E
Please switch using some WM_USER-based message number. Second, the CExtPopupMenuWnd::MENUITEMDATA::GetCmdNode() method is invoked at very beginning of the CExtPopupMenuWnd::_EndSequenceEx() method where the reference to the CExtPopupMenuWnd::MENUITEMDATA object cannot be invalid: void CExtPopupMenuWnd::_EndSequenceEx(
CExtPopupMenuWnd::MENUITEMDATA & mi
)
{
#if (!defined __EXT_MFC_NO_CUSTOMIZE)
_KeyTipsShow( false );
#endif // (!defined __EXT_MFC_NO_CUSTOMIZE)
if( (! _IsFadeOutAnimation() )
&& m_ctrlShadow.GetSafeHwnd() != NULL
)
m_ctrlShadow.DestroyWindow();
#if (!defined __EXT_MFC_NO_CUSTOMIZE)
CExtCustomizeCmdTreeNode * pNode = mi.GetCmdNode();
. . .
This means, unfortunately, the call stack listing didn’t help us in this case. Is it possible to insert your source code in any of Prof-UIS sample apps or in some test project, make it reproducing this crash and send it to us?
|
|
|
Technical Support
|
Nov 19, 2009 - 1:52 PM
|
You should send the SB_BOTTOM notification through the WM_VSCROLL message to your list view control if you want to scroll it to the bottom vertically. Do not compute any exact scrolling position in this case. The list view control use very specific scrolling parameters which can be either pixel-by-pixel based or item-by-item based.
The menu crash is very interesting. Please show us the entire call stack listing.
|
|
|
Borremans Pierre
|
Nov 19, 2009 - 3:19 AM
|
I want to change the font of the button in my page navigator. I use SendMessage with the parameters : (WM_SETFONT, (WPARAM) hFontBold, 1), but nothing change.
could my problem come from the overdrive of the function OnQueryItemHeight ?
|
|
|
Borremans Pierre
|
Nov 24, 2009 - 6:50 AM
|
and how to change the background color for the selected page ?
|
|
|
Technical Support
|
Nov 24, 2009 - 2:17 PM
|
The pages are windows inserted into the page navigator control. You should repaint the background of your page windows. For example, the TabbedBars sample application demonstrates the inherited background painting feature. You can check the check boxes on the third page in the one note tab page container and see the custom painted hurricane like background distributed between tab page dialogs, their child control and even entire main frame window.
|
|
|
Borremans Pierre
|
Nov 25, 2009 - 4:11 AM
|
thanks and how to change the background color of the selected button ?
|
|
|
Technical Support
|
Nov 25, 2009 - 12:49 PM
|
There is no background color. These buttons are painted by the currently installed paint manager. Some paint managers paint a gradient square. Other paint manager paint a bitmap based button skin. You can override the CExtPageNavigatorWnd::OnPageNavigatorDrawCollapsedItemsArea and CExtPageNavigatorWnd::OnPageNavigatorDrawExpandedItemsArea() virtual methods to redraw collapsed and expanded items.
|
|
|
Technical Support
|
Nov 19, 2009 - 1:51 PM
|
The font of item captions is computed dynamically in the CExtPaintManager::PaintPageNavigatorCaptionText() virtual method:
void CExtPaintManager::PaintPageNavigatorCaptionText(
CDC & dc,
const CRect & rcItem,
__EXT_MFC_SAFE_LPCTSTR strCaption,
bool bPushed,
bool bHover,
bool bAllowInvertTextColor // = true
)
{
ASSERT_VALID( this );
ASSERT( dc.GetSafeHdc() != NULL );
if( ! dc.RectVisible(&rcItem) )
return;
LOGFONT lf = { sizeof(LOGFONT) };
VERIFY( ::SystemParametersInfo( SPI_GETICONTITLELOGFONT, sizeof(LOGFONT), &lf, 0 ) );
__EXT_MFC_STRCPY( lf.lfFaceName, LF_FACESIZE, _T("Arial") );
lf.lfWeight = FW_BOLD;
CFont font;
font.CreateFontIndirect(&lf);
CFont * pOldFont = dc.SelectObject( &font );
COLORREF clrOldText =
dc.SetTextColor(
bPushed && bHover && bAllowInvertTextColor
? GetColor( COLOR_WINDOW, this )
: GetColor( COLOR_BTNTEXT, this )
);
PaintPageNavigatorCaptionTextImpl( dc, rcItem, strCaption );
dc.SetTextColor( clrOldText );
dc.SelectObject( pOldFont );
}
void CExtPaintManagerOffice2007_Impl::PaintPageNavigatorCaptionText(
CDC & dc,
const CRect & rcItem,
__EXT_MFC_SAFE_LPCTSTR strCaption,
bool bPushed,
bool bHover,
bool bAllowInvertTextColor // = true
)
{
ASSERT_VALID( this );
ASSERT( dc.GetSafeHdc() != NULL );
if( ! dc.RectVisible(&rcItem) )
return;
if( IsHighContrast() )
{
CExtPaintManagerXP::PaintPageNavigatorCaptionText( dc, rcItem, strCaption, bPushed, bHover, bAllowInvertTextColor );
return;
}
LOGFONT lf = { sizeof(LOGFONT) };
VERIFY( ::SystemParametersInfo( SPI_GETICONTITLELOGFONT, sizeof(LOGFONT), &lf, 0 ) );
__EXT_MFC_STRCPY( lf.lfFaceName, LF_FACESIZE, _T("Arial") );
lf.lfWeight = FW_BOLD;
CFont font;
font.CreateFontIndirect(&lf);
CFont * pOldFont = dc.SelectObject( &font );
COLORREF clrOldText = dc.SetTextColor( bPushed ? m_arrClrPnItemText[0] : m_arrClrPnItemText[1] );
PaintPageNavigatorCaptionTextImpl( dc, rcItem, strCaption );
dc.SetTextColor( clrOldText );
dc.SelectObject( pOldFont );
}
You should override this method in your paint manager class.
|
|
|
Borremans Pierre
|
Nov 23, 2009 - 1:11 AM
|
|
|
|
|
Noah Fehrenbacher
|
Nov 18, 2009 - 6:22 PM
|
Is there a way to add the description field to a button? For example in Office Word 2007 if you select the top right circular button with the options "New", "Open", "Save", .. etc. select the "Save As" button, the buttons in the drop down have the button.text value as well as a field that gives a short description of the button. Is there a way to do this with your tool?
|
|
|
Technical Support
|
Nov 19, 2009 - 1:46 PM
|
You can see such menu items in the RibbonBar sample application. The main text is called menu text. The description text is called extended menu text. Here is how to initialize the ribbon command node:
CExtRibbonNode * pNodeFileSaveAsFormat1 =
new CExtRibbonNode(
ID_FB_SAVE_AS_FROMAT_ICON,
ID_FB_SAVE_AS_FROMAT_ICON,
NULL,
__ECTN_BIG_ACCENT_IN_MENU|__ECTN_BOLD_IN_MENU,
NULL,
_T("Save Document As Format 1")
);
pNodeFileSaveAsFormat1->CmdKeyTipSet( new CExtCustomizeCmdKeyTip( __EXT_MFC_SAFE_TCHAR( _T(’1’) ) ), false );
pNodeFileSaveAsFormat1->SetTextMenuExtended(
_T("Save a copy of that will be fully compatible\nwith Format 1")
);
We took the code snippet above from the CMainFrame::_InitRibbon_FileMenu() method of the RibbonBar sample application.
|
|
|
Chris Mason
|
Nov 17, 2009 - 5:46 AM
|
Hi, We are currently experiencing a problem with our menus that until now has gone unnoticed. When using the keyboard to select a menu (for example ALT + F) the first item is not being selected. Or more specifically it is being selected initially when OnTrackPopup is called but within a fraction of a second the item is no longer selected. However, CExtPopupWndMenu::_ItemFocusCancel is not being called. Is the menu being redrawn somewhere else that we are not noticing? I appreciate that this is quite an ambiguous question but any help would be greatly appreciated.
|
|
|
Chris Mason
|
Nov 20, 2009 - 1:51 AM
|
Hmmm. Have just done that and it appears that both functions are only called once when tracking the menu. Strange, guess it’s just something we’ll have to live with. Cheers.
|
|
|
Chris Mason
|
Nov 19, 2009 - 2:28 AM
|
Sorry, I should have mentioned that we are running an older version of Prof-uis, 2.60 I think. I appreciate that this is probably not a bug as it is something that you would have picked up on long ago, you notice quite quickly that the menus don’t work as you’re used to. We are wondering whether it has something to do with the way we create our menus? The code for this is from an older version of our product which we have ported directly into our latest version. The major difference is that we are using prof-uis. Essentially what we do is build the menus from a text file, like xml but in a more archaic fashion. For example our file menu looks like this:
Se&lect Project... #Ctrl+L \ @DfwFileProjectLogin
&Project Information... \ @DfwFileProjectInfo
\
&New \ >
&Worksheet #Ctrl+N \ @DfwFileNewWorksheet
&Script \ @DfwFileNewScript
&Macro \ @DfwFileNewMacro
&Project \ @DfwFileNewProject
\ <
&Open... #Ctrl+O \ @DfwFileOpen
&Run \ >
&Script... #Ctrl+R \ @DfwFileRunScript
&Macro... #Ctrl+M \ @DfwFileRunMacro
\ <
\
&Save Worksheet #Ctrl+S \ @DfwFileSaveWorksheet
Save Worksheet &As... \ @DfwFileSaveWorksheetAs
\
&Acquire Data \ >acquire.opt
&Generate Data \ >generate.opt
&Import Data \ >import.opt
Import Script \ @DfwFileImportScriptAsModule
\
Print &Worksheet... #Ctrl+W \ @DfwFilePrintWorksheet
P&rint Setup... \ @DfwFilePrintSetup
\
Recent Files \ >
Recent Files \ @DfwFileList
\ <
Recent Worksheets \ >
Recent worksheets \ @DfwWorksheetList
\ <
\
E&xit DATS For Windows \ @DfwFileExit From this file we build our menus using the following code:
BOOL CUtilMenu::AddMenu(CMenu &cMenu, CAcceleratorTable
&cAcceleratorTable, CMenuCallbacks *p_cMenuCallbacks, LPCTSTR
lpszFileName, FILE *fp /*=NULL*/)
{
CStringEx cPathName(CRegistry::GetDatsDirectory() + "lib\\menus\\");
CStringEx cMenuText("");
ACCEL Accelerator;
CStringEx cFunctionName("");
int iID;
TRACE("Loading <%s>\n", lpszFileName );
// Delete the existing menu (including all sub-menus) first
DeleteChildMenus(&cMenu, p_cMenuCallbacks);
// Open the file (may already be open)
if( !StartOptions(lpszFileName, &fp) )
{
AfxMessageBox("Failed to load menu file " + CString(lpszFileName));
return FALSE;
}
while( GetNextOption(cMenuText, &Accelerator, cFunctionName, fp) )
{
// Check for a Menu separator
if(cMenuText == "" && cFunctionName == "")
{
cMenu.AppendMenu(MF_SEPARATOR, 0, "");
continue;
}
// Check the 1st character :
switch(cFunctionName[0])
{
// New submenu?
case ’>’:
{
// Create a new popup menu
CMenu cNewMenu;
cNewMenu.CreatePopupMenu();
CStringEx cFileName = cFunctionName.Right(cFunctionName.GetLength() - 1);
// Is the new menu in another file ? if( !cFileName.IsBlankLine() )
{
if( !CDatsUtil::FileExists(cPathName + cFileName))
{
TRACE("Warning <%s> could not be found\n",cFileName);
continue;
}
CUtilMenu::AddMenu(cNewMenu, cAcceleratorTable, p_cMenuCallbacks, cFileName);
}
// Otherwise continue reading the menu from the same file
else
{
CUtilMenu::AddMenu(cNewMenu, cAcceleratorTable, p_cMenuCallbacks, cFileName, fp);
}
cMenu.AppendMenu(MF_POPUP, (unsigned int)cNewMenu.m_hMenu, cMenuText.GetBuffer(0));
HMENU hMenu = cNewMenu.Detach();
break;
}
// End of a submenu?
case ’<’:
{
return TRUE;
}
#ifdef _DATSMINI
// Internal Script callback?
case ’@’:
{
cFunctionName = cFunctionName.Right(cFunctionName.GetLength()-1);
iID = AfxGetCallbackMap()->GetFunctionID(cFunctionName);
cMenu.AppendMenu(MF_STRING, iID, cMenuText);
// Add an accelerator to the table if required and if one doesn’t already exist
if( Accelerator.key != 0 )
{
Accelerator.cmd = iID;
cAcceleratorTable.Add(Accelerator);
}
break;
}
#else
// A script?
case ’!’:
{
iID = p_cMenuCallbacks->Add(cFunctionName, true);
cMenu.AppendMenu(MF_STRING, iID, cMenuText.GetBuffer(0));
// Add an accelerator to the table if required and if one doesn’t already exist
if( Accelerator.key != 0 )
{
Accelerator.cmd = iID;
cAcceleratorTable.Add(Accelerator);
}
break;
}
// Internal Script callback?
case ’@’:
{
cFunctionName = cFunctionName.Right(cFunctionName.GetLength()-1);
iID = AfxGetCallbackMap()->GetFunctionID(cFunctionName);
cMenu.AppendMenu(MF_STRING, iID, cMenuText);
// Add an accelerator to the table if required and if one doesn’t already exist
if( Accelerator.key != 0 )
{
Accelerator.cmd = iID;
cAcceleratorTable.Add(Accelerator);
}
break;
}
// Must be an analysis
default:
{
BOOL bValid = AfxGetModuleDatabase()->IsFunctionValid(cFunctionName);
iID = p_cMenuCallbacks->Add(cFunctionName, bValid);
cMenu.AppendMenu(MF_STRING, iID, cMenuText.GetBuffer(0));
// Add an accelerator to the table if required and if one doesn’t already exist
if( Accelerator.key != 0 )
{
Accelerator.cmd = iID;
cAcceleratorTable.Add(Accelerator);
}
break;
}#endif
}
}
return TRUE;
} Okay I don’t seem to have the handle of this editor, but all the above boxes are one function. The GetNextOption() function simply returns 3 ExStrings (our own class) which we build the menus from.
We replace the menus in the main frame as follows:
bool CMainFrame::ReplaceMenus(CMenus* pMenus /*=NULL*/)
{
// Use the internal set of menus if none specified
if( pMenus == NULL )
{
pMenus = &m_cMenus;
}
// Replace the mainframe menu and add new commands to command manager
CMenu *pNewMenu = pMenus->GetAt(0);
CMenu *pFrameMenu = GetMenu();
SetMenu(pNewMenu);
if(pFrameMenu)
{
pFrameMenu->DestroyMenu();
pFrameMenu = NULL;
}
g_CmdManager->UpdateFromMenu(AfxGetApp()->m_pszProfileName, pNewMenu->m_hMenu, true, true, true);
// Replace document specific menus with new ones
CDocManager* pDocManager = AfxGetApp ()->m_pDocManager;
if (pDocManager != NULL)
{
// Walk all templates in the application:
int iMenuIndex = 0;
for (POSITION pos = pDocManager->GetFirstDocTemplatePosition (); pos != NULL;)
{
CMultiDocTemplate* pTemplate =
(CMultiDocTemplate*) pDocManager->GetNextDocTemplate (pos);
ASSERT_VALID (pTemplate);
ASSERT_KINDOF (CDocTemplate, pTemplate);
// We are interested in CMultiDocTemplate objects with
// the shared menu only....
if( pTemplate->IsKindOf (RUNTIME_CLASS (CMultiDocTemplate)) )
{
// Load menubar from supplied menus list and associate it with the
// template shared menu:
if( pTemplate->m_hMenuShared != NULL )
{
// Replace menu and add new commands to command manager
CMenu *pNewMenu = pMenus->GetAt(iMenuIndex+1);
pTemplate->m_hMenuShared = pNewMenu->m_hMenu;
pNewMenu->Detach();
g_CmdManager->UpdateFromMenu(AfxGetApp()->m_pszProfileName, pTemplate->m_hMenuShared, true, true, true);
}
iMenuIndex++;
// Load an additional menubar from supplied menus list and associate
// it with the template in-place server menu if it has one:
if( pTemplate->m_hMenuInPlaceServer != NULL )
{
// Replace menu and add new commands to command manager
CMenu *pNewMenu = pMenus->GetAt(iMenuIndex+1);
pTemplate->m_hMenuInPlaceServer = pNewMenu->m_hMenu;
pNewMenu->Detach();
g_CmdManager->UpdateFromMenu(AfxGetApp()->m_pszProfileName, pTemplate->m_hMenuInPlaceServer, true, true, true);
}
// Load an additional menubar from supplied menus list and associate
// it with the template embedded server menu if it has one:
iMenuIndex++;
if( pTemplate->m_hMenuEmbedding != NULL )
{
// Replace menu and add new commands to command manager
CMenu *pNewMenu = pMenus->GetAt(iMenuIndex+1);
pTemplate->m_hMenuEmbedding = pNewMenu->m_hMenu;
pNewMenu->Detach();
g_CmdManager->UpdateFromMenu(AfxGetApp()->m_pszProfileName, pTemplate->m_hMenuEmbedding, true, true, true);
}
iMenuIndex++;
}
}
}
// Cleanup
for( int i=0; i<pMenus->GetSize(); i++)
{
CMenu *pMenu = pMenus->GetAt(i);
if( pMenu != NULL )
{
// Detach from the before deletion (HMENU is now owned by the mainframe or template)
pMenu->Detach();
delete pMenu;
}
}
pMenus->RemoveAll();
return true;
}Finally we do a OnExtMenuPrepare where we update the MRU etc.
LRESULT CMainFrame::OnExtMenuPrepare(WPARAM wParam, LPARAM lParam)
{
CExtPopupMenuWnd::MsgPrepareMenuData_t *pData = reinterpret_cast< CExtPopupMenuWnd::MsgPrepareMenuData_t * >(wParam);
ASSERT( pData != NULL );
CExtPopupMenuWnd * pPopup = pData->m_pPopup;
ASSERT( pPopup != NULL );
CExtPopupMenuWnd *pTheMenu = NULL;
int iReplacePos = -1;
#ifndef _DATSMINI
// Build the Favorites menu
// ------------------------------------------
if( FindMenuItemFromCmdID(pPopup, ID_FAVORITES_LIST, pTheMenu, iReplacePos) )
{
// Remove placeholder so that user doesn’t see it
pTheMenu->ItemRemove(iReplacePos);
// Insert the current contents of the Favorites.xml file
BuildFavorites(pTheMenu, iReplacePos);
pData->m_bMenuChanged = true;
return 1L;
}
// Append worksheet MRU list to the File menu
// ------------------------------------------
// Look for a worksheet MRU placeholder command in the menu or one of its sub-menus
if( FindMenuItemFromCmdID(pPopup, ID_FILE_WORKSHEET_MRU_FILE1, pTheMenu, iReplacePos) )
{
// Remove placeholder so that user doesn’t see it
pTheMenu->ItemRemove(iReplacePos);
// Insert the current contents of the worksheet MRU list
CRecentFileList *pRecentFileList = AfxGetApp()->GetRecentWorksheetList();
if( pRecentFileList != NULL )
{
TCHAR sCurrDir[_MAX_PATH+1];
::memset(sCurrDir,0,sizeof(sCurrDir));
::GetCurrentDirectory(_MAX_PATH,sCurrDir);
int nLenCurDir = (int)_tcslen(sCurrDir);
for( int nItemIndex=0; nItemIndex<pRecentFileList->GetSize(); nItemIndex++ )
{
// Fetch next name from the MRU list
CString cDisplayName( _T("") );
if( !pRecentFileList->GetDisplayName( cDisplayName, nItemIndex, sCurrDir, nLenCurDir, TRUE) )
continue;
ASSERT( !cDisplayName.IsEmpty() );
// Add an entry to the command manager if not already present
UINT nCmdID = ID_FILE_WORKSHEET_MRU_FILE1 + nItemIndex;
ASSERT( nCmdID <= ID_FILE_WORKSHEET_MRU_FILE16 );
CExtCmdItem *pCmdItem =g_CmdManager->CmdGetPtr(g_CmdManager->ProfileNameFromWnd( GetSafeHwnd() ), nCmdID);
if( pCmdItem == NULL )
pCmdItem = g_CmdManager->CmdAllocPtr( g_CmdManager->ProfileNameFromWnd( GetSafeHwnd() ), nCmdID );
ASSERT( pCmdItem != NULL );
if( pCmdItem == NULL )
return 0L;
// Format menu text
int nDisplayIndex = nItemIndex+1;
if( nDisplayIndex < 10 )
pCmdItem->m_sMenuText.Format(_T("&%d %s"), nDisplayIndex, cDisplayName);
else
pCmdItem->m_sMenuText.Format(_T("%d&%d %s"), nDisplayIndex/10, nDisplayIndex%10, cDisplayName);
CString cRecentFileFmt1( _T("Recent worksheet %d") );
CString cRecentFileFmt2( _T("Recent worksheet %d (\"%s\")") );
pCmdItem->m_sToolbarText.Format(cRecentFileFmt1, nItemIndex + 1);
pCmdItem->m_sTipTool.Format(cRecentFileFmt2, nItemIndex + 1, cDisplayName);
pCmdItem->m_sTipStatus = pCmdItem->m_sTipTool;
if( !pTheMenu->ItemInsert(nCmdID, iReplacePos + nItemIndex) )
{
ASSERT( FALSE );
return 0L;
}
}
}
pData->m_bMenuChanged = true;
}
// Add "Windows..." command
// -------------------------
int iNewPos = -1;
int iItemPos = pPopup->ItemFindPosForCmdID( __ID_MDIWND_DLGWINDOWS );
if( iItemPos > 0 )
{
// "More Windows..." command found
pPopup->ItemRemove( iItemPos );
iNewPos = iItemPos;
pData->m_bMenuChanged = true;
}
else
{
int nMaxCmdID = 0;
for( int nCmdID = __ID_MDIWNDLIST_FIRST; nCmdID <= __ID_MDIWNDLIST_LAST; nCmdID++ ){
iItemPos = pPopup->ItemFindPosForCmdID( nCmdID );
if( iItemPos > 0 )
{
if( nCmdID > nMaxCmdID )
{
nMaxCmdID = nCmdID;
iNewPos = iItemPos;
}
}
pData->m_bMenuChanged = true;
}
if( iNewPos > 0 )
{
pPopup->ItemInsert(
(UINT)CExtPopupMenuWnd::TYPE_SEPARATOR,
++iNewPos
);
iNewPos++;
pData->m_bMenuChanged = true;
}
}
if( iNewPos > 0 )
{
UINT nCmdID = ID_WINDOWS_LIST;
CExtCmdItem * pCmdItem =
g_CmdManager->CmdGetPtr(
g_CmdManager->ProfileNameFromWnd( this->GetSafeHwnd() ),
nCmdID
);
if( pCmdItem == NULL ){
pCmdItem =
g_CmdManager->CmdAllocPtr(
g_CmdManager->ProfileNameFromWnd( this->GetSafeHwnd() ),
nCmdID
);
}
ASSERT( pCmdItem != NULL );
if( pCmdItem != NULL )
{
CExtSafeString sMoreWindows(_T("Windows..."));
CExtSafeString sManageWindows(_T("Manages the currently open windows"));
pCmdItem->m_sMenuText = sMoreWindows;
pCmdItem->m_sToolbarText = pCmdItem->m_sMenuText;
pCmdItem->m_sTipTool = sManageWindows;
pCmdItem->m_sTipStatus = pCmdItem->m_sTipTool;
pCmdItem->StateSetBasic( true );
pPopup->ItemInsert(
nCmdID,
iNewPos,
sMoreWindows,
NULL,
m_hWnd
);
}
pData->m_bMenuChanged = true;
}
#endif
return 1L;;
}These are the main places where the menus are created and updates. Hopefully you can spot some problem that we haven’t seen. If you need more info feel please free to ask. Thanks
|
|
|
Technical Support
|
Nov 20, 2009 - 2:38 PM
|
No, you can switch to the latest Prof-UIS and re-check this issue. It should not appear.
|
|
|
Technical Support
|
Nov 19, 2009 - 1:47 PM
|
This problem is absent in 2.60 too. It does not depend on the dynamic menu initialization. The only case when the first menu item can be non-selected is when your code removes all the menu items. Please try to set breakpoints into the beginning of the CExtPopupMenuWnd::_ItemFocusSet() and CExtPopupMenuWnd::_ItemFocusCancel() methods and you will see whether popup menu tries to set focus to the first displayed menu item or whether it cancels it and why.
|
|
|
Technical Support
|
Nov 18, 2009 - 6:51 AM
|
We used Prof-UIS 2.87 for testing this issue. We run the MDIDOCVIEW sample application. We did the following two tests:
1) We pressed Alt, then pressed F without releasing Alt, then released both keys.
2) We pressed Alt, then released Alt, the pressed F, then released F.
Result was the same in both tests. The file menu appeared. The first menu item is selected in it.
|
|
|
Bart Kampers
|
Nov 16, 2009 - 3:31 AM
|
Hello, I created my own row header cell having a button to popup a menu. The code below works fine. But when I change the button type to __EGCS_BUTTON_DROPDOWN the menu is not shown anymore. Instead I see a small rectangle. How should I implement my header cell if I want to use the __EGCS_BUTTON_DROPDOWN type? Thanks in advance, Bart.
CClassRowHeader::CClassRowHeader(CExtGridDataProvider* pDataProvider)
: CExtGridCellHeader(pDataProvider)
{
ModifyStyle(__EGCS_TA_HORZ_RIGHT | __EGCS_BUTTON_ELLIPSIS);
}
void CClassRowHeader::OnButtonPressed(
CExtGridWnd & wndGrid,
INT nButtonType,
const RECT & rcCellExtra,
const RECT & rcCell,
LONG nVisibleColNo,
LONG nVisibleRowNo,
LONG nColNo,
LONG nRowNo,
INT nColType,
INT nRowType)
{
CExtPopupMenuWnd* menu = new CExtPopupMenuWnd;
menu->CreatePopupMenu(wndGrid.GetSafeHwnd());
menu->ItemInsertCommand(WM_GRADING_TABLE_INSERT_ROW_BEFORE, -1, LANGUAGE_GET_CAT("InsertRowBefore"));
menu->ItemInsertCommand(WM_GRADING_TABLE_INSERT_ROW_AFTER, -1, LANGUAGE_GET_CAT("InsertRowAfter"));
menu->ItemInsertCommand(WM_GRADING_TABLE_DELETE_ROW, -1, LANGUAGE_GET_CAT("DeleteRow"));
menu->ItemInsertCommand(WM_GRADING_TABLE_CLEAR_ROW, -1, LANGUAGE_GET_CAT("ClearRow"));
CRect cellRect(rcCell);
wndGrid.ClientToScreen(cellRect);
CRect rcExclude(cellRect.left, cellRect.bottom, cellRect.left + 3, cellRect.bottom + 3);
if (! menu->TrackPopupMenu(TPMX_LEFTALIGN, cellRect.left, cellRect.bottom, &rcExclude))
{
menu->DestroyWindow();
delete menu;
menu = NULL;
}
__super::OnButtonPressed(wndGrid, nButtonType, rcCellExtra, rcCell, nVisibleColNo, nVisibleRowNo, nColNo, nRowNo, nColType, nRowType);
}
|
|
|
Bart Kampers
|
Nov 18, 2009 - 1:39 AM
|
- Your changes draw the menu on some other place when I use the __EGCS_BUTTON_ELLIPSIS style - When I use the __EGCS_BUTTON_DROPDOWN style I still see a small rectangle in stead of the menu - I do not analyze which button is pressed since I know that there is only one button in the cell.
|
|
|
Technical Support
|
Nov 16, 2009 - 1:45 PM
|
First of all, the menu->DestroyWindow(); line of code should be removed. Second, the exclude area rectangle should use the screen coordinate system. The rcCell and rcCellExtra rectangles are using grid window client coordinate system. You should invoke the wndGrid.ClientToScreen( &rcExclude ); line of code. Third, the point coordinates are also should be in screen coordinate system and it should be inside exclude rectangle. This means the following part of your code snippet:
CRect rcExclude( cellRect.left, cellRect.bottom, cellRect.left + 3, cellRect.bottom + 3 ) ;
if( ! menu->TrackPopupMenu( TPMX_LEFTALIGN, cellRect.left, cellRect.bottom, &rcExclude ) )
{
delete menu;
menu = NULL;
}
Should be replaced with the following: CRect rcExclude = rcCell;
m_wndGrid.ClientToScreen( &rcExclude );
CPoint pt = rcExclude.CenterPoint();
if( ! menu->TrackPopupMenu( TPMX_LEFTALIGN, pt.x, pt.y, &rcExclude ) )
{
delete menu;
menu = NULL;
}
Fourth, if you are handling the button pressing event, then you should not invoke the parent class method. Fifth, your code does not analyze which button is clicked. It will work correctly only if your header cell uses only one button.
|
|
|
Bart Kampers
|
Nov 18, 2009 - 3:16 AM
|
I removed the parent’s call for OnButtonPressed. Not it works OK.
|
|
|
Bill Olson
|
Nov 14, 2009 - 7:07 PM
|
I’ve been trying to get Prof UIS working with a CRichEditCtrl and I’m getting asserts. This is a control created at run time rather than created in the resource editor. I have done: In class declaration: CExtNCSB <CRichEditCtrl> m_RichEdit; In OnInitDialog: m_RichEdit.Create( WS_CHILD|WS_VISIBLE|ES_LEFT|ES_MULTILINE|ES_READONLY|WS_HSCROLL|WS_VSCROLL|WS_TABSTOP,
rcDummy,this,IDC_HELPTEXT); When I started, the last argument was IDC_STATIC. I changed this to IDC_HELPTEXT but it still asserts on the .Create call. I read on the forum that CExtNCSB works with CRichEditCtrl with versions 2.83 and later. I’m using 2.85. Bill
|
|
|
Bill Olson
|
Nov 19, 2009 - 4:22 AM
|
I finally figured out what was going on. I tried commenting out manipulations of the control after creation and found that this line: m_RichEdit.SetOptions(ECOOP_SET,ECO_READONLY | ECO_SAVESEL | ECO_AUTOWORDSELECTION); was what was preventing the control from skinning. For some odd reason after commenting this out, my resizing code started behaving oddly, though it skinned the scroll bar from initialization. After some tweaking of the resize code it looks like everything works OK without SetOptions, so I will just leave it out. I’m not sure why it caused a problem, but it did. Thanks for the help, Bill
|
|
|
Technical Support
|
Nov 19, 2009 - 1:52 PM
|
The behavior of the rich edit control depends on its ECO_*** options and sometimes it may eat or not send the scrolling messages which the CExtNCSB template class expects to intercept for synchronizing and updating the state of the CExtScrollBar windows.
|
|
|
Technical Support
|
Nov 18, 2009 - 6:50 AM
|
We have the rich editor based log view in the date browser dialog page in the ProfUIS_Controls sample application and it works OK. We suspect the problem with scroll bars in your app may be related to the rich edit control initialization or set of its styles you are using. Please provide us with the source code which creates and initializes the rich edit control in your project. Please also note, the scroll bars are skinned only if the currently installed paint manager supports skinned scroll bars (Office 2007/2010 and ProfSkin).
|
|
|
Bill Olson
|
Nov 17, 2009 - 2:54 AM
|
OK, I derived a class with the above code. The scroll bar skins OK when I click on something in the dialog or move the mouse over the scroll bar, but it doesn’t skin when it is initially drawn. Bill
|
|
|
Technical Support
|
Nov 16, 2009 - 1:24 PM
|
You should use the delayed initialization of themed scroll bars provided by the CExtNCSB template class:
class CMyRichEditCtrl : public CExtNCSB < CRichEditCtrl >
{
public:
CMyRichEditCtrl() : CExtNCSB < CRichEditCtrl > ( true ) { }
};
|
|
|
Christian Herger
|
Nov 13, 2009 - 8:08 AM
|
How can I retrieve the height and width of a cell / outer cell? GetExtend() is somewhat weird to me for it always returns the width. Thanks
|
|
|
Technical Support
|
Nov 13, 2009 - 1:59 PM
|
About grid cells in data area (not header area): The CExtScrollItemWnd::OnSiwQueryItemExtentH() method returns column width. Each column can have additional extra space reserved at left (before) and right(after). The CExtScrollItemWnd::OnSiwQueryItemExtentV() method returns row height. Each row can have additional extra space reserved at top (before) and bottom(after). So entire column width/row height consist of 3 parts: width/height, space before and space after. The extra spaces are typically equal to zero. But, the report grid uses extra space at the bottom of each row for implementing in-row previews.
About header cell areas: The CExtGridBaseWnd::OuterColumnWidthGet() returns the outer header column widths at left/right. The CExtGridBaseWnd::OuterRowHeightGet() returns the outer header column widths at top/bottom.
About any grid cells in any grid areas: The CExtGridWnd::GridCellRectsGet() returns rectangle of any displayed grid cell and rectangles of built-in cell parts. It returns false flag if cell is outside the displayed cell range. The set of overloaded CExtGridCell::MeasureCell() methods allow you to measure grid cell and get its minimal size when all the parts of grid cell are fully visible.
|
|
|
Borremans Pierre
|
Nov 13, 2009 - 3:54 AM
|
|
|
|
|
Technical Support
|
Nov 13, 2009 - 2:00 PM
|
We just put the source code of the CMyBar class into the SDI sample application and it works OK. This class does what you need. What’s wrong with it?
|
|
|
Borremans Pierre
|
Nov 17, 2009 - 8:04 AM
|
here my code : class CUI_ToolBar :
public CExtToolControlBar
{
public:
class CMyContentExpandButton : public CExtBarContentExpandButton
{
public:
CMyContentExpandButton( CExtToolControlBar * pBar = NULL )
: CExtBarContentExpandButton( pBar )
{
}
virtual bool IsVisible() const
{
bool bVisible = ( GetButtons().GetSize() > 0 ) ? true : false;
return bVisible;
}
};
CUI_ToolBar(void);
virtual CExtBarContentExpandButton * OnCreateBarRightBtn() { return new CMyContentExpandButton( this ); }
virtual ~CUI_ToolBar(void);
virtual void _RecalcPositionsImpl() {
CExtToolControlBar::_RecalcPositionsImpl();
if( m_pDockBar != NULL )
{
return;
}
CExtBarContentExpandButton * pRightTBB = GetRightButton();
if( pRightTBB == NULL )
{
return;
}
if( ! pRightTBB->IsVisible() )
{
return;
}
bool bHorz = ((GetBarStyle()&(CBRS_ALIGN_TOP|CBRS_ALIGN_BOTTOM))!=0) ? true : false;
CRect rcRightTBB = *pRightTBB, rcClient;
GetClientRect( &rcClient );
rcRightTBB.OffsetRect(
bHorz ? ( rcClient.right - rcRightTBB.right ) : 0,
bHorz ? 0 : ( rcClient.bottom - rcRightTBB.bottom )
);
pRightTBB->SetRect( rcRightTBB );
INT nIndex, nCount = GetButtonsCount();
for( nIndex = 0; nIndex < nCount; nIndex ++ )
{
CExtBarButton * pTBB = GetButton( nIndex );
if( ! pTBB->IsVisible() )
{
continue;
}
if( pTBB == pRightTBB )
{
continue;
}
CRect rcTBB = *pTBB;
if( bHorz )
{
if( rcTBB.right < rcRightTBB.left )
{
continue;
}
}
else
{
if( rcTBB.bottom < rcRightTBB.top )
{
continue;
}
}
pTBB->Show( false );
pRightTBB->GetButtons().InsertAt( 0, pTBB );
}
}
//virtual CExtBarButton * OnCreateBarCommandBtn(UINT nCmdID, UINT nStyle = 0);
}; in the mainframe : int CUI_MainFrame::OnCreate(LPCREATESTRUCT lpCreateStruct)
{ ... if( !this->m_ToolBar_File.Create(
NULL,
this,
AFX_IDW_TOOLBAR
)
||
!this->m_ToolBar_File.LoadToolBar( IDR_TOOLBAR_FILE)
)
{
TRACE0("Failed to create toolbar file\n");
return -1; // fail to create
} ... m_ToolBar_File.EnableDocking( CBRS_ALIGN_ANY ); DockControlBar( &m_ToolBar_File); .. }
When I debug this code, it stop and exist on the line : if( m_pDockBar != NULL )
{
return;
} If I comment the lines, and replace the for( nIndex = 0; nIndex < nCount; nIndex ++ ) with for( nIndex = 0; nIndex < nCount; nIndex ++ )
{
CExtBarButton * pTBB = GetButton( nIndex );
pRightTBB->GetButtons().InsertAt( 0, pTBB ); }
When I click on the chevron no menu will be visible. Have you got an idea ?
|
|
|
Technical Support
|
Nov 18, 2009 - 6:54 AM
|
Here is the updated version of your class:
class CUI_ToolBar : public CExtToolControlBar
{
public:
class CMyContentExpandButton : public CExtBarContentExpandButton
{
protected:
mutable bool m_bComputingExtendedLayout:1;
public:
CMyContentExpandButton( CExtToolControlBar * pBar = NULL )
: CExtBarContentExpandButton( pBar )
, m_bComputingExtendedLayout( false )
{
}
virtual bool IsVisible() const
{
if( m_bComputingExtendedLayout )
return CExtBarContentExpandButton::IsVisible();
bool bVisible = ( GetButtons().GetSize() > 0 ) ? true : false;
return bVisible;
}
virtual CSize CalculateLayout(
CDC & dc,
CSize sizePreCalc,
BOOL bHorz
)
{
if( m_bComputingExtendedLayout )
return CExtBarContentExpandButton::CalculateLayout( dc, sizePreCalc, bHorz );
if( IsVisible() )
{
SetStyle( GetStyle() & (~(TBBS_HIDDEN)) );
return CExtBarContentExpandButton::CalculateLayout( dc, sizePreCalc, bHorz );
}
m_ActiveSize.cx = m_ActiveSize.cy = 0;
SetStyle( GetStyle() | TBBS_HIDDEN );
return m_ActiveSize;
}
friend class CUI_ToolBar;
};
virtual CExtBarContentExpandButton * OnCreateBarRightBtn()
{
return new CMyContentExpandButton( this );
}
virtual void _RecalcPositionsImpl()
{
CMyContentExpandButton * pRightTBB = (CMyContentExpandButton*)GetRightButton();
if( pRightTBB == NULL )
{
CExtToolControlBar::_RecalcPositionsImpl();
return;
}
ASSERT_VALID( pRightTBB );
bool bVisibleOld = pRightTBB->IsVisible();
pRightTBB->SetStyle( pRightTBB->GetStyle() & (~(TBBS_HIDDEN)) );
pRightTBB->Show( true );
pRightTBB->m_bComputingExtendedLayout = true;
CExtToolControlBar::_RecalcPositionsImpl();
pRightTBB->m_bComputingExtendedLayout = false;
bool bVisibleNew = pRightTBB->IsVisible();
if( bVisibleOld != bVisibleNew )
CExtToolControlBar::_RecalcPositionsImpl();
}
};
|
|
|
Borremans Pierre
|
Nov 13, 2009 - 12:34 AM
|
In our application we want to have menu icon items in 16*16 and toolbar icon in 32*32 withou using different identifiers for menu items and toolbar buttons. Is it possible ?
|
|
|
Technical Support
|
Nov 18, 2009 - 6:50 AM
|
You don’t need two different handler methods. You need two message map entries based on different command identifiers and pointing to one handler method.
|
|
|
Borremans Pierre
|
Nov 18, 2009 - 4:14 AM
|
Thanks for your help, I found a solution. I overdrive the CalculateLayout and PaintCompound from the CExtBarButton class and It works.
|
|
|
Borremans Pierre
|
Nov 17, 2009 - 3:26 AM
|
To simplify our working because for each command we have 2 functions and we have a lot of command identifiers. It’s easier to use the same identifier for other programmer. Is it possible ?
|
|
|
Technical Support
|
Nov 13, 2009 - 1:58 PM
|
It’s much easier to do this if you use different command identifiers. Why cannot you use different command identifiers?
|
|
|
Takis Takoglou
|
Nov 11, 2009 - 5:01 AM
|
Good day, I have a CExtControlBar which is a "container" for a CExtWRB< BarDialog > TabBar.
I have made all th adjustments for the CExtControlBar to be dockable:
CExtControlBar::FrameEnableDocking(this);
this->m_wndResizableBarDlg.EnableDocking(CBRS_ALIGN_ANY);
this->m_wndResizableBarDlg.DockControlBar( AFX_IDW_DOCKBAR_LEFT, 1, this, false ); My program starts and the it is correctly docked in the left.
When i try to move the controlbar the program crashes.
The line which causes this is in file: ExtControlBar.cpp in function CControlBar * CExtControlBar::_GetNextControlBarInRow( )
the ASSERT( nPos >= 0 ); fails becuse its value is -1.
Thanx in advance for any suggestions on the matter.
|
|
|
Technical Support
|
Nov 11, 2009 - 11:47 AM
|
The control bar layout related algorithms are compound and mutually depend on each other: in-frame space allocation, row/column layout, etc. We need a test project reproducing this assertion to debug the problem.
|
|
|
Anil Siddhpura
|
Nov 11, 2009 - 12:32 AM
|
Hi, I have created one SDI Application. And i am using splash wnd before the frame is created. I have used the same splash wnd class given in one of your sample application. It is working fine. But the problem is, my screen resolution is too high. And the bitmap image i used in splash wnd is small compare to that screen resolution. Because of that my whole screen does not cover by that bitmap image. Is there any way to stratch the bitmap image in splash wnd? So that i can cover whole screen with that bitmap before that frame created.
|
|
|
Technical Support
|
Nov 14, 2009 - 2:15 PM
|
Here is how you can get the size of the desktop:
CPoint pt( 0, 0 );
CExtPaintManager::monitor_parms_t _mp;
CExtPaintManager::stat_GetMonitorParms( _mp, pt );
The _mp.m_rcMonitor property specifies the entire monitor coordinates including all the shell bar windows docked to the monitor sides (i.e. windows like standard Windows Task Bar). The _mp.m_rcWorkArea property specifies the work area coordinates on the monitor which does not include shell bars (i.e. coordinates of the maximized window). The last rectangle is what you need. It gives you size of bitmap you should use in your splash window.
|
|
|
Technical Support
|
Nov 12, 2009 - 2:30 PM
|
You can query the size of desktop area and resize your splash bitmap to make it equal to desktop area size. Then you can assign such big bitmap to your splash window.
|
|
|
Anil Siddhpura
|
Nov 13, 2009 - 11:43 PM
|
Hi,
Yes i have already tried that. I am quering my screen size and then set the bitmap size. But the problem is my Bitmap is not that much large. Is there any way to stratch bitmap as per screen size in splashwnd.
|
|
|
Anil Siddhpura
|
Nov 11, 2009 - 10:17 PM
|
Hi, No, it’s showing the bitmap correctely, but the problem is it covers only some part of screen(the size of bitmap). I want to cover whole screen with botmap. So is there any way to stratch the bitmap at run time using splash wnd.
|
|
|
Technical Support
|
Nov 11, 2009 - 11:49 AM
|
Splash windows are typically quite small and never cover the entire screen. At least we did not see such full screen splash windows. Do you mean that the splash window does not show its bitmap background correctly? Could you provide us with a screenshot demonstrating what’s wrong with the splash window in your application.
|
|
|
Christian Herger
|
Nov 10, 2009 - 8:55 AM
|
Hi there I have a cell in which I only show an icon. I inherit from CExtGridWnd and did as follows: ...
CExtCmdIcon* pIcon = new CExtCmdIcon();
pIcon->AssignFromHICON(AfxGetApp()->LoadIcon(IDI_INPUT_ACTIVE), true);
m_aImageIndexHwIndicator.Add(GridIconInsert(pIcon, -1, true));
delete pIcon;
pIcon = new CExtCmdIcon();
pIcon->AssignFromHICON(AfxGetApp()->LoadIcon(IDI_INPUT_INACTIVE), true);
m_aImageIndexHwIndicator.Add(GridIconInsert(pIcon, -1, true));
delete pIcon;
pIcon = new CExtCmdIcon();
pIcon->AssignFromHICON(AfxGetApp()->LoadIcon(IDI_INPUT_UNDEFINED), true);
m_aImageIndexHwIndicator.Add(GridIconInsert(pIcon, -1, true));
delete pIcon;
pIcon = 0;
...
and later use as follows: ...
//HW
pCell = GridCellGet(HW, i, 0, 0);
//Search the bitmap for HW indication
int ulIndex = m_aImageIndexHwIndicator.GetAt(pInputOutput->GetPurpose()->GetStateAttribute()->GetValue());
if(!pInputOutput->GetPurpose()->GetMaskAttribute()->GetValue())
{
ulIndex = m_aImageIndexHwIndicator.GetAt(m_aImageIndexHwIndicator.GetCount() - 1);
}
pCell->IconIndexSet(ulIndex);
...
but however, the cell(s) stay empty... What am I missing here? I also tried an CExtGridCellString but I think the Icon thing is implemented in the base class... Ahh, I’m using v. 2.70 thanks for any input Christain
|
|
|
Technical Support
|
Nov 11, 2009 - 11:47 AM
|
All grid cells support icons. This feature is built-in and cannot be turned off without overriding virtual methods of grid cells, data provider and/or grid control. If the icons are not displayed, then there is something wrong with implementation of your grid related classes or their initializations. Could you please send us the source code of your grid related classes to the support mail box at this web site and we will check what’s wrong. We need to take a look at the grid control initialization code and any classes derived from Prof-UIS grid cells and grid controls.
|
|
|
Christian Herger
|
Nov 12, 2009 - 1:44 AM
|
Ok now, it’s a little bit embarrassing The icon had an empty 32x32Bit image which was taken to show, obviously. Now I deleted it and the icon is shown. BUT it is streched to 32x32Bit and overlapps the cell! Originally it is only 15x13Bit. How can I prevent stretching? Thanks
|
|
|
Technical Support
|
Nov 12, 2009 - 2:28 PM
|
There is not enough information in your message to come to any conclusion about the reported icon behavior. How did you delete it? Did you unregister it from the grid control? Did you reset the cells icon index to -1?
|
|
|
Christian Herger
|
Nov 13, 2009 - 1:31 AM
|
No, sorry... As you know, an icon file (.ico) can contain many images. So I opened the icon file with an icon editor and found an empty 32x32Bit image which I then deletet within the icon file. The only image left in the icon file then was the one I needed with a size of 15x13Bit. After this the icons where visible in the grid but stretched to 32x32Bit. However, I now created a new 32x32Bit image and placed the smaller image in it. To me, this is a workaround but at least the icon is shown correctly now. My question was only: can I tell the grid cell in what ’size’ an icon has to appear? Thanks for your help and excuse my english if this is what caused the trouble
|
|
|
Technical Support
|
Nov 14, 2009 - 2:14 PM
|
It’s not important how many images are stored in the .ICO file and it’s not important which size these images have. The LoadIcon() API always loads only a 32x32 image into the ICO handle. The LoadImage() API loads an icon image of the requested size and it probably uses some algorithm for finding an icon of the closest size to avoid scaling.
The Prof-UIS grid control does not scale icons. You should just load icons of requested size using the LoadImage() API, initialize the CExtCmdIcon objects from loaded HICON handles and register icons in the grid.
|
|
|
Technical Support
|
Nov 10, 2009 - 2:33 PM
|
The icon indices can be assigned to any cell, including the basic CExtGridCell class. Please check whether you specified a valid icon index. Your code inserts 3 icons into the grid control. So, at least icon indices 0, 1 and 2 are valid. Please try to specify 0, 1 or 2 as icon index explicitly.
|
|
|
Christian Herger
|
Nov 11, 2009 - 1:18 AM
|
Hi Technical Support I’ve done this already by debugging and even changed the values then manually from 0 to 1 and 2. The indicies are stored correctly in m_aImageIndexHwIndicator (which besides is an array of int). Any other suggestions? Thanks PS: is there some sort of trick how to handle this editor? When I change the Style from ’Normal’ to ’Code’ or vice versa either nothing happens or the cursor jumps away or then it works after a couple of tries?????
|
|
|
Dirk lindner
|
Nov 9, 2009 - 5:03 AM
|
is it possible to disable the Show or Hide Panels Button in a undocked Toolbar ?

I use the OnExtMenuPrepare function to translate the menu but it dont work for this menu.
Greats Dirk Lindner
|
|
|
Technical Support
|
Nov 9, 2009 - 11:17 AM
|
You should handle the CExtControlBar::g_nMsgConstructPopupMenu registered message in your main frame class. This message allows you to rebuild or reconstruct any built-in Prof-UIS menus. For example, the ProfStudio sample application completely recreates all the built-in Prof-UIS menus. The CExtControlBar::g_nMsgConstructPopupMenu message uses pointer to the CExtControlBar::POPUP_MENU_EVENT_DATA data structure as WPARAM parameter. This message is sent twice. First time, the CExtControlBar::POPUP_MENU_EVENT_DATA::m_bPostNotification flag is set to false and you can construct popup menu from scratch. Second time, this flag is set to true and you can modify constructed by default menu. The CExtControlBar::POPUP_MENU_EVENT_DATA::m_nHelperNotificationType property specifies the type of menu. The following enumeration is defined inside the CExtControlBar::POPUP_MENU_EVENT_DATA class and specifies supported menu types:
enum // Prof-UIS notification types
{
__PMED_DOCKBAR_CTX = 0, // dockbar context menu
__PMED_CONTROLBAR_CTX = 1, // any control bar context menu (client area)
__PMED_CONTROLBAR_NC_CTX = 2, // any control bar context menu (non-client area)
__PMED_STATUSBAR_CTX = 3, // statusbar context menu
__PMED_AUTOHIDESLIDER_CTX = 4, // autohide slider window context menu
__PMED_MINIFRAME_NC_CTX = 5, // miniframe context menu (non-client area)
__PMED_MDICLIAREA_CTX = 6, // MDI client area context menu
__PMED_MDITABS_CTX = 7, // MDI-tabs window
__PMED_AUTOHIDETABS_CTX = 8, // autohide-tabs window
__PMED_DYNCBCTABS_CTX = 9, // dynamic control bar container tabs window
__PMED_CONTROLBAR_NCBTNMENU_TOP = 10, // control bar nc-area-menu-button - top level
__PMED_CONTROLBAR_NCBTNMENU_BARS = 11, // control bar nc-area-menu-button - control bars list
__PMED_CTXEXPBTN_TOP = 12, // content expand button - top level
__PMED_CTXEXPBTN_APPEND = 13, // content expand button - append to buttons list
__PMED_CTXEXPBTN_BARS = 14, // content expand button - control bars list
__PMED_CONTROLBAR_NCBTNMENU_DYNSTATE = 15, // dynamic resizable control bar nc-area-menu-button
__PMED_TAB_PAGE_CONTAINER_TABS_CTX = 16, // page-container-as-main-view-tabs window
};
The Show or Hide Panels menu is constructed by the CExtControlBar::POPUP_MENU_EVENT_DATA::__PMED_CONTROLBAR_NCBTNMENU_TOP and CExtControlBar::POPUP_MENU_EVENT_DATA::__PMED_CTXEXPBTN_APPEND menus. First is menu button of floating toolbar. Second is chevron button. You can handle post-notifications of these menus and remove menu sub levels in them. The CExtControlBar::POPUP_MENU_EVENT_DATA::m_pPopupMenuWnd property specifies pointer to the popup sub menu you want to remove. Finally, we would like to ask you why do you want to remove this built-in menu? We think it’s useful and don’t see any reasons to remove it.
|
|