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 |
|
Offer Har
|
Nov 10, 2008 - 4:13 PM
|
|
|
Technical Support
|
Nov 11, 2008 - 9:27 AM
|
We have successfully re-produced this issue and are working on it. Thank you.
|
|
Offer Har
|
Nov 10, 2008 - 5:21 AM
|
|
|
Technical Support
|
Nov 10, 2008 - 11:40 AM
|
Yes. This feature is called best fitting. It’s supported both for columns and rows. The CExtGridWnd::BestFitColumn() method does best-fitting for columns and CExtGridWnd::BestFitRow() for rows. The set of __EGBS_BSE_EX_DBLCLK_BEST_FIT_*** styles allows you to turn on best-fitting on double clicks between columns and/or rows. It’s possible to enable double clicks between outer header cells and/or inner data cells. It’s possible to configure best-fitting to use measured outer header cells, all the inner data cells or only displayed on the screen inner data cells.
|
|
Offer Har
|
Nov 10, 2008 - 4:19 PM
|
|
|
tera tera
|
Nov 10, 2008 - 1:28 AM
|
Hello. Please teach a sample to load Text data or Save Text Data.
|
|
Technical Support
|
Nov 10, 2008 - 11:41 AM
|
The rich edit control supports stream based getting and setting of its text. Here is the very simple article describing how to load rich text into rich text editor control:
http://www.codeguru.com/richedit/rtf_string_streamin.shtml
Here is the source code based on article above: class CTeraRichEditCtrl : public CRichEditCtrl
{
public:
CString GetRTF();
void SetRTF( const CString & sRTF );
CString GetPlainText();
void SetPlainText( const CString & sPlainText );
protected:
static __EXT_MFC_DWORD_PTR CALLBACK stat_StreamIn( __EXT_MFC_DWORD_PTR dwCookie, LPBYTE pbBuff, LONG cb, LONG *pcb );
static __EXT_MFC_DWORD_PTR CALLBACK stat_StreamOut( __EXT_MFC_DWORD_PTR dwCookie, LPBYTE pbBuff, LONG cb, LONG* pcb );
};
CString CTeraRichEditCtrl::GetRTF()
{
EDITSTREAM es;
es.dwError = 0;
es.pfnCallback = stat_StreamOut;
CString sRTF = _T("");
es.dwCookie = (__EXT_MFC_DWORD_PTR) &sRTF;
StreamOut( SF_RTF, es );
return sRTF;
}
void CTeraRichEditCtrl::SetRTF( const CString & sRTF )
{
EDITSTREAM es;
es.dwError = 0;
es.pfnCallback = stat_StreamIn;
es.dwCookie = (__EXT_MFC_DWORD_PTR) LPVOID(&sRTF);
StreamIn( SF_RTF, es );
}
CString CTeraRichEditCtrl::GetPlainText()
{
HideSelection( TRUE, FALSE );
long nStartChar = 0, nEndChar = 0;
GetSel( nStartChar, nEndChar );
long nTextLength = GetTextLength();
SetSel( 0, nTextLength );
CString strPlainText( _T("") );
strPlainText = GetSelText();
SetSel( nStartChar, nEndChar );
HideSelection( FALSE, FALSE );
return strPlainText;
}
void CTeraRichEditCtrl::SetPlainText( const CString & sPlainText )
{
EDITSTREAM es;
es.dwError = 0;
es.pfnCallback = stat_StreamIn;
es.dwCookie = (__EXT_MFC_DWORD_PTR) LPVOID(&sPlainText);
StreamIn( SF_TEXT, es );
}
__EXT_MFC_DWORD_PTR CALLBACK CTeraRichEditCtrl::stat_StreamIn( __EXT_MFC_DWORD_PTR dwCookie, LPBYTE pbBuff, LONG cb, LONG *pcb )
{
CString *pstr = (CString *) dwCookie;
if ( pstr->GetLength() < cb )
{
(*pcb) = pstr->GetLength();
::memcpy( pbBuff, (LPCSTR) *pstr, *pcb );
pstr->Empty();
}
else
{
*pcb = cb;
::memcpy( pbBuff, (LPCSTR) *pstr, *pcb );
*pstr = pstr->Right(pstr->GetLength() - cb);
}
return 0;
}
__EXT_MFC_DWORD_PTR CALLBACK CTeraRichEditCtrl::stat_StreamOut( __EXT_MFC_DWORD_PTR dwCookie, LPBYTE pbBuff, LONG cb, LONG *pcb )
{
CString * pStream = (CString*)dwCookie;
ASSERT( pStream != NULL );
char * tmp_buf = (char *)::malloc( cb+1 );
if( tmp_buf != NULL )
{
::memcpy( tmp_buf,pbBuff, cb );
tmp_buf[cb] = ’\0’;
(*pStream) += tmp_buf;
::free( tmp_buf );
}
return 0;
}
|
|
tera tera
|
Nov 10, 2008 - 5:30 PM
|
|
|
Offer Har
|
Nov 9, 2008 - 8:24 AM
|
I have a dialog with a scroll-bar of type CExtZoomScrollBar . I initialize it in OnInitDialog like this:
BOOL CDataDlg::OnInitDialog()
{
CExtResizableDialog::OnInitDialog();
ShowSizeGrip(FALSE);
m_wndZoomer.m_eSO = CExtScrollBar::__ESO_BOTTOM;
SCROLLINFO si;
si.fMask = SIF_ALL;
si.nMin = 0;
si.nMax = 100;
si.nPage = 1;
si.nPos = 50;
si.nTrackPos = 50;
VERIFY( m_wndZoomer.SetScrollInfo( &si ) );
m_wndZoomer.m_bEnabledToolTips = true;
m_wndZoomer.m_strTipTextForThumbButton = _T("Zoom Slider");
m_wndZoomer.m_strTipTextForUpButton = _T("Zoom Out");
m_wndZoomer.m_strTipTextForDownButton = _T("Zoom In");
SubclassChildControls();
return TRUE;
} But something is wrong: 1) Even though I said the that I want the position to be in the middle (50) it starts in the left side. 2) in the OnHScroll call, when I look into SCROLLINFO I see that all the values atr zero (min=max=pos=0) Did I miss anything? Is there something wrong in 2,84?
|
|
Technical Support
|
Nov 10, 2008 - 11:44 AM
|
|
|
Offer Har
|
Nov 17, 2008 - 11:17 AM
|
Thanks very much for your help - found my problem.
|
|
Offer Har
|
Nov 9, 2008 - 7:11 AM
|
I have a docked bar that I want to behave like this: 1) Docked to the left 2) No title 3) Cannot be closed 4) Cannot be moved from the left 5) Other bars can be tabbled into it This is how I created it:
m_wndBar.Create("Data", m_pChildFrm, 12001,
WS_CHILD|WS_VISIBLE|CBRS_TOP|CBRS_TOOLTIPS|CBRS_FLYBY|CBRS_SIZE_DYNAMIC|CBRS_HIDE_INPLACE);
m_wndBar.EnableDocking(CBRS_ALIGN_LEFT);
m_wndBar.DockControlBarInnerOuter(AFX_IDW_DOCKBAR_LEFT, true, m_pChildFrm, true); All is fine unless another control-bar is tabbed together with it - then I can start and move this bar around and close it. The images below ilustrate the probelm:
|
|
Offer Har
|
Nov 10, 2008 - 4:11 PM
|
I don’t understand why something so simple like preventing the closing of a control-bar should involve writing so much code, which I still don’t see how it can even do what I need: I must have a control-bar that cannot be closed ever - the user have no way of bringing it back. Ron.
|
|
Technical Support
|
Nov 11, 2008 - 9:13 AM
|
Please implement the CExtControlBar::_ClosingIsEnabled() virtual method in your CExtControlBar -derived class and simply return false() from it. You should not implement your own tabbed bar class for this task. Your control bar will not be close-able. The tabbed group of bars with your bar will also not be close-able.
|
|
Offer Har
|
Nov 11, 2008 - 3:31 PM
|
Thanks - I still have one problem. When I tab another control-bar into this control-bar, I can start draging it around by tearing it with a drag from teh tab-control. Can this be prevented?
|
|
Technical Support
|
Nov 12, 2008 - 1:06 PM
|
It should not be difficult to make one of the control bars in the SDI sample application based on your control bar class. We would be happy to clarify what’s wrong in your bar class. It should not take much time.
|
|
Offer Har
|
Nov 11, 2008 - 9:20 AM
|
Great! that’s exactly what I need - will try it out soon...
|
|
Technical Support
|
Nov 10, 2008 - 11:46 AM
|
A tabbed bar group is also a kind of control bar. Here is the description of how to remove the "X"-button from bar caption and how to make Prof-UIS using your custom tabbed control bar class:
http://www.prof-uis.com/prof-uis/tech-support/faq/control-bars.aspx#how-to-remove-the-close-button-x-from-the-control-bar
So, you will have two control bar classes: a simple control bar and a tabbed group bar. Both of them can determine whether the control bar drag-n-dropping is enabled. If the CExtControlBar::_DraggingIsEnabled() virtual method returns false , the control bar drag-and-drop is not enabled. The simple control bar class should implement this method and simply return false from it. The tabbed bar should not implement this virtual method. It’s already implemented: the CExtDynControlBar::_DraggingIsEnabled() method invokes the CExtControlBar::_DraggingIsEnabled() virtual methods of all the control bars in container and returns false if some of contained bars does not allow drag-and-drop.
|
|
Offer Har
|
Nov 10, 2008 - 4:12 PM
|
I don’t understand why something so simple like preventing the closing of a control-bar should involve writing so much code, which I still don’t see how it can even do what I need: I must have a control-bar that cannot be closed ever - the user have no way of bringing it back. Ron.
|
|
Offer Har
|
Nov 8, 2008 - 9:19 AM
|
I am trying to build ProfUIS_Controls to reporduce the check-box bug I reported I still get these errors I reported a while ago - please explain what is missing, and how to fix it: 1>MainDlg.obj : error LNK2019: unresolved external symbol "public: __thiscall CPageShellDialogBrowseFor::CPageShellDialogBrowseFor(class CWnd *)" (??0CPageShellDialogBrowseFor@@QAE@PAVCWnd@@@Z) referenced in function "protected: virtual int __thiscall CMainDlg::OnInitDialog(void)" (?OnInitDialog@CMainDlg@@MAEHXZ)
1>MainDlg.obj : error LNK2019: unresolved external symbol "public: __thiscall CPageShellDialogFile::CPageShellDialogFile(class CWnd *)" (??0CPageShellDialogFile@@QAE@PAVCWnd@@@Z) referenced in function "protected: virtual int __thiscall CMainDlg::OnInitDialog(void)" (?OnInitDialog@CMainDlg@@MAEHXZ)
1>MainDlg.obj : error LNK2019: unresolved external symbol "public: __thiscall CPageShellBrowser::CPageShellBrowser(class CWnd *)" (??0CPageShellBrowser@@QAE@PAVCWnd@@@Z) referenced in function "protected: virtual int __thiscall CMainDlg::OnInitDialog(void)" (?OnInitDialog@CMainDlg@@MAEHXZ)
1>MainDlg.obj : error LNK2019: unresolved external symbol "public: __thiscall CPageShellTreeCtrl::CPageShellTreeCtrl(class CWnd *)" (??0CPageShellTreeCtrl@@QAE@PAVCWnd@@@Z) referenced in function "protected: virtual int __thiscall CMainDlg::OnInitDialog(void)" (?OnInitDialog@CMainDlg@@MAEHXZ)
1>MainDlg.obj : error LNK2019: unresolved external symbol "public: __thiscall CPageShellListCtrl::CPageShellListCtrl(class CWnd *)" (??0CPageShellListCtrl@@QAE@PAVCWnd@@@Z) referenced in function "protected: virtual int __thiscall CMainDlg::OnInitDialog(void)" (?OnInitDialog@CMainDlg@@MAEHXZ)
1>MainDlg.obj : error LNK2019: unresolved external symbol "public: __thiscall CPageTreeCtrl::CPageTreeCtrl(class CWnd *)" (??0CPageTreeCtrl@@QAE@PAVCWnd@@@Z) referenced in function "protected: virtual int __thiscall CMainDlg::OnInitDialog(void)" (?OnInitDialog@CMainDlg@@MAEHXZ)
1>MainDlg.obj : error LNK2019: unresolved external symbol "public: __thiscall CPageListCtrl::CPageListCtrl(class CWnd *)" (??0CPageListCtrl@@QAE@PAVCWnd@@@Z) referenced in function "protected: virtual int __thiscall CMainDlg::OnInitDialog(void)" (?OnInitDialog@CMainDlg@@MAEHXZ)
1>MainDlg.obj : error LNK2019: unresolved external symbol "public: __thiscall CPageMaskedEdit::CPageMaskedEdit(class CWnd *)" (??0CPageMaskedEdit@@QAE@PAVCWnd@@@Z) referenced in function "protected: virtual int __thiscall CMainDlg::OnInitDialog(void)" (?OnInitDialog@CMainDlg@@MAEHXZ)
|
|
Technical Support
|
Nov 10, 2008 - 11:46 AM
|
If you see these errors, you are using enough old Prof-UIS 2.84. Please drop us an e-mail so we will provide you with the source code update. This also explains why the tree grid sorting and plain grid sorting does not work properly in your test projects.
|
|
tera tera
|
Nov 7, 2008 - 11:33 PM
|
Hello. When I do Create() of a dialogue.
When I perform ShowWindow.
A focus moves. I do not want to move a focus.
Is there the good method?
|
|
tera tera
|
Nov 7, 2008 - 9:33 PM
|
Hello. When a button was pushed, I want to move a focus on this button.
|
|
Technical Support
|
Nov 10, 2008 - 11:49 AM
|
The grid cells can have focused state. The built-in buttons inside grid cells cannot be focused.
|
|
tera tera
|
Nov 10, 2008 - 9:44 PM
|
Hello. When a grid is set by line selection ( __EGBS_SFM_FULL_ROWS )
When I clicked a cell button, I want to move a cell
|
|
Technical Support
|
Nov 11, 2008 - 9:12 AM
|
If your grid window uses the full-row selection model, any stand-alone grid cells cannot be focused nor selected. Please use the __EGBS_SFM_CELLS_HV style instead and add the following virtual methods to your grid class: virtual CRect & _SelectionAreaConvert( CRect & rcArea ) const
{
ASSERT_VALID( this );
rcArea.left = 0;
rcArea.right = ColumnCountGet();
if( rcArea.right > 0 )
rcArea.right --;
return rcArea;
}
virtual COLORREF OnGridCellQueryTextColor(
const CExtGridCell & _cell,
CDC & dc,
LONG nVisibleColNo,
LONG nVisibleRowNo,
LONG nColNo,
LONG nRowNo,
INT nColType,
INT nRowType,
DWORD dwAreaFlags,
DWORD dwHelperPaintFlags
) const
{
ASSERT_VALID( this );
COLORREF clrText =
CExtGridWnd::OnGridCellQueryTextColor(
_cell,
dc,
nVisibleColNo,
nVisibleRowNo,
nColNo,
nRowNo,
nColType,
nRowType,
dwAreaFlags,
dwHelperPaintFlags
);
if( clrText != COLORREF(-1L) )
return clrText;
if( (SiwGetStyle()&__EGBS_SFB_MASK) == __EGBS_SFB_CELLS )
{
if( nColType == 0 && nRowType == 0 && nColNo >= 0 && nRowNo >= 0 )
{
CPoint ptFocus = FocusGet();
if( ptFocus.x == nColNo && ptFocus.y == nRowNo )
return OnSiwGetSysColor( COLOR_BTNTEXT );
}
}
return COLORREF(-1L);
}
virtual bool OnGridHookCellPaintBackground(
const CExtGridCell & _cell,
CDC & dc,
LONG nVisibleColNo,
LONG nVisibleRowNo,
LONG nColNo,
LONG nRowNo,
INT nColType,
INT nRowType,
const RECT & rcCellExtra,
const RECT & rcCell,
const RECT & rcVisibleRange,
DWORD dwAreaFlags,
DWORD dwHelperPaintFlags
) const
{
ASSERT_VALID( this );
if( ( dwAreaFlags & __EGBWA_INNER_CELLS ) != 0 )
{
CPoint ptFocus = FocusGet();
if( ptFocus.x == nColNo && ptFocus.y == nRowNo )
{
COLORREF clrAlternativeFocus1 =
OnSiwGetSysColor( COLOR_HIGHLIGHT );
COLORREF clrAlternativeFocus2 =
OnSiwGetSysColor( COLOR_WINDOW );
COLORREF clrAlternativeFocus =
CExtPaintManager::stat_RGB_Enlight(
clrAlternativeFocus1,
clrAlternativeFocus2,
32
);
dc.FillSolidRect(
&rcCell,
clrAlternativeFocus
);
return true;
}
}
return
CExtGridWnd::OnGridHookCellPaintBackground(
_cell,
dc,
nVisibleColNo,
nVisibleRowNo,
nColNo,
nRowNo,
nColType,
nRowType,
rcCellExtra,
rcCell,
rcVisibleRange,
dwAreaFlags,
dwHelperPaintFlags
);
}
As a result, your grid window will use the full-row selection and column based focus models.
|
|
Offer Har
|
Nov 7, 2008 - 2:42 PM
|
I have a control-bar whose title may be longer then the width of the control-bar. Is there a way to make the full title appear in a tool-tip like the one displayed when a tab’s text does not fit into the tab?
|
|
Technical Support
|
Nov 10, 2008 - 11:51 AM
|
The following class displays a tooltip like you need: class CMyControlBar : public CExtControlBar
{
protected:
virtual LRESULT WindowProc( UINT message, WPARAM wParam, LPARAM lParam )
{
switch( message )
{
case WM_MOUSEMOVE:
case WM_NCMOUSEMOVE:
if( IsBarWithGripper() )
{
if( ! OnQueryBarHoverProcessingEnabled() )
return 0;
CExtPopupMenuTipWnd * pATTW = OnAdvancedPopupMenuTipWndGet();
if( pATTW == NULL )
return 0;
CPoint ptScreen;
if( ! ::GetCursorPos(&ptScreen) )
return 0;
CExtBarNcAreaButton * pBtn = NULL;
NcButtons_HitTest( ptScreen, &pBtn );
if( pBtn != NULL )
break;
CRect rcArea = _RectGripGet();
rcArea.DeflateRect( 2, 0 );
NcButtons_CalcGripperTextLocation( rcArea );
if( rcArea.left >= rcArea.right )
return 0;
CWindowDC dcMeasure( this );
CExtSafeString sCaption;
OnGetBarCaptionText( __EBCT_SINGLE_CAPTION_DOCKED, sCaption );
INT nCaptionTextWidthPX = CExtPaintManager::stat_CalcTextDimension( dcMeasure, PmBridge_GetPM()->m_FontCaption, sCaption ).Width();
INT nAreaWidthPX = rcArea.Width();
if( nAreaWidthPX >= nCaptionTextWidthPX )
return 0;
CRect rcDefOffsetWnd;
GetWindowRect( &rcDefOffsetWnd );
rcArea.OffsetRect( rcDefOffsetWnd.TopLeft() );
OnAdvancedPopupMenuTipWndDisplay( *pATTW, rcArea, LPCTSTR( sCaption ) );
return 0;
}
break;
}
LRESULT lResult = CExtControlBar::WindowProc( message, wParam, lParam );
return lResult;
}
};
You should repeat the same for tabbed group classes.
|
|
Offer Har
|
Nov 7, 2008 - 10:49 AM
|
Dear Support, We are using grids taht wroked well in 2.82, 2.83 and before, and now when hitting the header column for sorting things are messed up (we did not do any code change, just moved to the experimental 2.84): 1) Sorting is not done - we just use the defualt lexicographical sort 2) If you click to sort column 1, and then click column 2 header, you see two sort arrows... 3) If you click second time on a column with a sort arrow, the arrow does not flip (the ascending/descending arrow) So, we can say that in general, sorting stopped working. As we said before, we are in a rush to release a version, and we need these features to work ASAP Thanks, Ron.
|
|
Technical Support
|
Nov 10, 2008 - 11:50 AM
|
This happens because your copy of Prof-UIS 2.84 is old enough and sorting features are not finally implemented in it. Please drop us an e-mail so we will provide you with the latest update.
|
|
Technical Support
|
Nov 7, 2008 - 3:21 PM
|
We confirm you may come across with the problems described in your message. We have replied your e-mails several times and provided you with the Prof-UIS 2.84 download more than once. Please ensure you have downloaded the Prof-UIS 2.84 referred in our last e-mail. We can resend you download information.
|
|
Offer Har
|
Nov 7, 2008 - 3:25 PM
|
I have the latest 2.84 that you e-mail me - these bugs are there. If you have found them and fixed them please let me know ASAP! PS - this have nothing to do with other problems I have or other bugs I have reported in 2.84
|
|
Offer Har
|
Nov 7, 2008 - 10:19 AM
|
I have a grid with X columns, each one have an initial width. I need to change the width of one of the columns (only one, and not always the last one) when the window width changes. Can this be done? Thanks.
|
|
Technical Support
|
Nov 10, 2008 - 11:51 AM
|
Yes, you are right. But, if you want one or more columns to be automatically resized when the grid window’s width changes, you should turn off horizontal scrolling. Otherwise automatic resizing of grid columns cannot be done.
You can leave all the other columns resizable by the user in your grid window. You should not set equal the minimal/current/maximal size for all other columns. But you should set their proportional extent to zero.
|
|
Offer Har
|
Nov 17, 2008 - 7:26 PM
|
OK - got it - it was ExtentPercentSet and not ExtentSet. Works very nice
|
|
Offer Har
|
Nov 17, 2008 - 7:19 PM
|
I tried it and it did not work - this is what I tried to do: I have a grid with 3 columns, and I want the last column’s size to change when the winodw is resized, and that the first two columns will left as-is. As you suggested I did this:
SiwModifyStyle(__ESIS_STH_NONE,__ESIS_STH_PIXEL);
BseModifyStyleEx( __EGBS_BSE_EX_PROPORTIONAL_COLUMN_WIDTHS);
for (int i=0; i<(ColumnCountGet()-1); i++)
{
CExtGridCellHeaderChecked* pCell =
(CExtGridCellHeaderChecked*)GridCellGetOuterAtTop(i, 0);
pCell->ExtentSet(0.0);
}
CExtGridCellHeaderChecked* pCell =
(CExtGridCellHeaderChecked*)GridCellGetOuterAtTop(ColumnCountGet()-1, 0);
pCell->ExtentSet(1.0); But, only the last column is visible now, and it occupy the whole grid. What am I missing? Thanks, Ron.
|
|
Offer Har
|
Nov 10, 2008 - 4:04 PM
|
Wait - so I can do it without the call to ExtentSet to all the other columns? Now I am confused......
|
|
Technical Support
|
Nov 11, 2008 - 9:25 AM
|
Use the CExtGridCell::ExtentSet() method for all header cells in order to set a column width. Do not invoke this method for any of header cells for limiting minimal or maximal column widths. Now grid columns have some initial widths in pixels. The next step is to assign proportional extents to them. Please invoke the CExtGridCell::ExtentPercentSet() method for all columns. You should set a 0.0 proportional extent to all the columns but one of them. This one column needs the 1.0 proportional extent. As a result, only one column will be automatically resized during grid resizing.
|
|
Technical Support
|
Nov 7, 2008 - 3:19 PM
|
This task can be done automatically if the grid window does not use horizontal scrolling (the __ESIS_STH_NONE style is specified in invocation of grid’s SiwModifyStyle() method) and proportion resizing feature for columns (the __EGBS_BSE_EX_PROPORTIONAL_COLUMN_WIDTHS style is specified in invocation of grid’s BseModifyStyleEx() method). If you need only the one column to be automatically resizable, then all the other columns should have equal minimal and maximal width in pixels. This means you should invoke pHeaderCell->ExtentSet( nSomeWidth, -1 ); pHeaderCell->ExtentSet( nSomeWidth, 0 ); pHeaderCell->ExtentSet( nSomeWidth, 0 ); code for all the header cells in all the fixed size columns and you should not invoke this code only for one column which will be automatically resized. This automatically resized column can be any of your grid’s columns.
|
|
Offer Har
|
Nov 7, 2008 - 3:23 PM
|
What you say is this: 1) No horizontal scroll bar 2) No column width can be changed but the one I want to be changed when the width of the window changes These are too much contsrtains and cannot work for me. Why are these constrains needed?
|
|
Offer Har
|
Nov 7, 2008 - 10:17 AM
|
Did you fix this in 2.84?
|
|
Offer Har
|
Nov 7, 2008 - 7:34 AM
|
I have a normal check-box, and when it have the focus rectangle, it touches the text as you can see below. Please fix.
|
|
Technical Support
|
Nov 11, 2008 - 9:22 AM
|
In the ProfUIS_Controls sample (the Buttons dialog page) demonstrates how to configure button margins at run-time. The test CExtButton window shows how to set custom margins. These margins can also be set for a CExtCheckBox . You can access and modify button margins using these methods:
- CExtButton::GetTextMargins - CExtButton::SetTextMargins - CExtButton::GetIconMargins - CExtButton::SetIconMargins
You can also used for that the following protected methods and properties:
- CExtButton::OnQueryMarginsText() - CExtButton::OnQueryMarginsIcon() - CExtButton::m_rcIconMargins - CExtButton::m_rcTextMargins
|
|
Technical Support
|
Nov 8, 2008 - 7:43 AM
|
Here is how a check box looks like without any modifications:
In all paint managers, the same code of CExtPaintManager::PaintCheckOrRadioButtonText() is used for painting text and the focus rectangle regardless of Windows version, desktop theme and DPI. The check box margins are initialized in the constructor of the CExtCheckBox class. The screen shot above is the Prof-UIS controls sample application. Please check whether you see the same on your computer.
We suspect one of the following really happened with your "Edit" check box control:
- You may have changed margin parameters of check box control using methods of CExtButton class. - You may have resized the check box control on the dialog template resource and made it having not enough large width.
|
|
Offer Har
|
Nov 8, 2008 - 8:07 AM
|
I for sure have enough space for the edit text in the dialog template. I did change the margins anywhere in the code - I didn;t even know I can do it - can you point me to the code to change these margins? There must be some other reason for this bug... can you please point me to the pont in teh code where you draw the rectangle, and the text so I can try and debug it myself? There is obvioustly something wrong there.
|
|
Technical Support
|
Nov 10, 2008 - 11:47 AM
|
We need your help in re-producing this issue. Could you please create a test project which does with the label control the same things as your real project and send it to us?
|
|
Offer Har
|
Nov 10, 2008 - 4:08 PM
|
Before I spend several hours creating a sample application, can you please explain to me what you mean by these: - You may have changed margin parameters of check box control using methods of CExtButton class. Where do I change this margin?
|
|
tera tera
|
Nov 7, 2008 - 1:53 AM
|
Hello. BEGIN_MESSAGE_MAP(CSamplePopupDlg, CExtResizableDialog)
//{{AFX_MSG_MAP(CSamplePopupDlg)
ON_UPDATE_COMMAND_UI( 32123 , OnUpdateCmd)
ON_UPDATE_COMMAND_UI( 32124 , OnUpdateCmd) Without describing ON_UPDATE_COMMAND_UI.
I want to let a menu activate by a Virtual function of CExtPopupMenuWnd.
Please teach it. Thanks,
|
|
Technical Support
|
Nov 10, 2008 - 11:53 AM
|
Could you provide some more details about what variable menu is ?
|
|
Technical Support
|
Nov 7, 2008 - 3:17 PM
|
Please let us know more details about your task. You simply added command updating message map entries for two command identifiers. What exactly do you expect from the popup menu?
|
|
tera tera
|
Nov 7, 2008 - 5:11 PM
|
Hello. I want to make a variable menu.
However, it seems to be able to come true in the following function counties. TrackPopupMenu (
TPMX_NO_CMD_UI | _ItemFocusSet(
_EndSequence( Thanks,
|
|
Robert Webb
|
Nov 6, 2008 - 9:47 PM
|
I want to put a text label on one of my buttons in the right button collection (right-hand side buttons on same line as ribbon bar tabs), but it only seems to allow icons. I can set the text but it doesn’t show up. Any thoughts?
Thanks,
Rob.
|
|
Technical Support
|
May 19, 2009 - 1:22 AM
|
We fixed the [_][o][x] button colors for dark/obsidian Office 2007 themes. The fixes are applied both to menu bar and ribbon bar buttons. The previous text fix is also part of Prof-UIS 2.85. You can drop us an e-mail to the support mail box at this web site so we will provide you with the FTP download.
|
|
Robert Webb
|
Nov 17, 2008 - 7:31 PM
|
Ah thanks! It did just what I need. Rob.
|
|
Technical Support
|
Nov 17, 2008 - 11:12 AM
|
Thank you for the very interesting question. The CExtBarButton::RibbonILV_Get() virtual method limits visual informativeness level of all the buttons at right side of the tabs to minimal. So, to make any of these buttons displaying text we need to change its informativeness level to normal. This requires two new small classes: the ribbon button class with constantly having normal informativeness level inside ribbon bar and ribbon command tree node class creating ribbon button object. If you replace the CMainFrame::_InitRibbon_RightButtonsCollection() method in the RibbonBar sample application with the following code, then you will see the About button displaying text:
class CMyLocalToolBarButton : public CExtRibbonButton
{
public:
DECLARE_DYNCREATE( CMyLocalToolBarButton );
CMyLocalToolBarButton(
CExtRibbonPage * pBar = NULL,
UINT nCmdID = ID_SEPARATOR,
UINT nStyle = 0
) : CExtRibbonButton( pBar, nCmdID, nStyle )
{
}
virtual INT RibbonILV_Get( INT nType ) const
{
ASSERT_VALID( this );
nType;
return __EXT_RIBBON_ILV_SIMPLE_NORMAL;
}
};
IMPLEMENT_DYNCREATE( CMyLocalToolBarButton, CExtRibbonButton );
class CMyLocalRibbonNodeWithAlwaysNormalILV : public CExtRibbonNode
{
public:
CMyLocalRibbonNodeWithAlwaysNormalILV(
UINT nCmdIdBasic = 0L, UINT nCmdIdEffective = 0L, CExtRibbonNode * pParentNode = NULL,
DWORD dwFlags = 0L, __EXT_MFC_SAFE_LPCTSTR strTextInToolbar = NULL,
__EXT_MFC_SAFE_LPCTSTR strTextInMenu = NULL, __EXT_MFC_SAFE_LPCTSTR strTextUser = NULL,
LPARAM lParam = 0L, CExtCmdIcon * pIconCustomized = NULL
#if (!defined __EXT_MFC_NO_BUILTIN_TEXTFIELD)
, INT nTextFieldWidth = 100, INT nDropDownWidth = -2, INT nDropDownHeightMax = 250
#endif
) : CExtRibbonNode( nCmdIdBasic, nCmdIdEffective, pParentNode, dwFlags,
strTextInToolbar, strTextInMenu, strTextUser, lParam, pIconCustomized
#if (!defined __EXT_MFC_NO_BUILTIN_TEXTFIELD)
, nTextFieldWidth, nDropDownWidth, nDropDownHeightMax
#endif
)
{
}
CMyLocalRibbonNodeWithAlwaysNormalILV( CExtRibbonNode & other ) : CExtRibbonNode( other )
{
}
virtual CRuntimeClass * _OnRibbonGetButtonRTC()
{
ASSERT_VALID( this );
return RUNTIME_CLASS( CMyLocalToolBarButton );
}
};
CExtRibbonNodeRightButtonsCollection * CMainFrame::_InitRibbon_RightButtonsCollection()
{
CExtRibbonNodeRightButtonsCollection * pRibbonNodeRightButtonsCollection =
new CExtRibbonNodeRightButtonsCollection;
CExtRibbonNode * pNodeRTL =
new CExtRibbonNode(
ID_RTL,
ID_RTL,
NULL,
0L,
_T("Right-To-Left")
);
VERIFY(
pNodeRTL->m_iconSmall.m_bmpNormal.LoadBMP_Resource(
MAKEINTRESOURCE( IDB_RTL )
)
);
pNodeRTL->m_iconSmall.m_bmpNormal.Make32( false );
pNodeRTL->m_iconSmall.m_bmpNormal.AlphaColor( RGB(255,0,255), RGB(0,0,0), BYTE(0) );
pRibbonNodeRightButtonsCollection->InsertNode(
NULL,
pNodeRTL
);
CExtRibbonNode * pNodeAppAbout =
new CMyLocalRibbonNodeWithAlwaysNormalILV( // new CExtRibbonNode(
ID_APP_ABOUT,
ID_APP_ABOUT,
NULL,
0L,
_T("About")
);
VERIFY(
pNodeAppAbout->m_iconSmall.m_bmpNormal.LoadBMP_Resource(
MAKEINTRESOURCE( ID_APP_ABOUT_16x16 )
)
);
pNodeAppAbout->m_iconSmall.m_bmpNormal.PreMultiplyRGBChannels( false );
CExtCustomizeCmdScreenTip * pCmdScreenTip = new CExtCustomizeCmdScreenTip;
pCmdScreenTip->TextMainSet( _T("About") );
pNodeAppAbout->CmdScreenTipAttach( pCmdScreenTip );
pRibbonNodeRightButtonsCollection->InsertNode(
NULL,
pNodeAppAbout
);
return pRibbonNodeRightButtonsCollection;
}
|
|
Robert Webb
|
Apr 23, 2009 - 12:20 AM
|
One problem remains. The text on the button in the right button collection is in a colour which doesn’t necessarily show up against the background, most noticeably when using the obsidian (black) themes the text is also black and hard to see. Ideally the button text should be the same colour as the text on ribbon tabs (other than the current one). This would always show up well. The text is also drawn a pixel or two higher than text on the ribbon tabs. This is not so important, but does look a little odd. How can I fix these things? Thanks, Rob.
|
|
Robert Webb
|
May 13, 2009 - 7:25 PM
|
I’m still waiting for an answer to this. How do I make text on a button in the right-button-collection (made possible via the fix you supplied above) the same colour as text on non-current ribbon bar tabs? Currently we have black text on a black background. Thanks, Rob.
|
|
Technical Support
|
May 16, 2009 - 3:24 PM
|
We are sorry for the delay with this reply. Please find the following code in the CExtPaintManagerOffice2007_Impl::Ribbon_PaintPushButton() method:
if( nTextLength > 0 || _ppbd.m_bDropDown )
{
CFont * pFont = pTBB->GetBar()->OnGetToolbarFont( false, false );
ASSERT( pFont->GetSafeHandle() != NULL );
CFont * pOldFont = dc.SelectObject( pFont );
int nOldBkMode = dc.SetBkMode( TRANSPARENT );
COLORREF clrText =
_ppbd.m_bEnabled
? m_clrRibbonButtonNormal
: m_clrRibbonButtonDisabled
;
and then append the following code immediately after the clrText variable assignment. if( ( ! ( _ppbd.m_bHover || _ppbd.m_bPushed ) )
&& IsKindOf( RUNTIME_CLASS(CExtPaintManagerOffice2007_R2_Obsidian) )
)
{
CExtCustomizeCmdTreeNode * pNode = pTBB->GetCmdNode();
if( pNode != NULL )
{
pNode = pNode->GetParentNode();
if( pNode != NULL
&& pNode->IsKindOf( RUNTIME_CLASS(CExtRibbonNodeRightButtonsCollection) )
)
clrText =
_ppbd.m_bEnabled
? m_clrNcFrameTextActive
: m_clrNcFrameTextInactive
;
}
}
Now the text inside the ribbon buttons displayed as part of the right buttons collection has the correct color. We tested this issue using the ID_RTL button displayed near the about button in the right buttons collection in the RibbonBar sample application. We made this button displaying text and used it in our tests. This ribbon button is already initialized with text to display in toolbar/ribbon bar in the CMainFrame::_InitRibbon_RightButtonsCollection() method: CExtRibbonNode * pNodeRTL =
new CExtRibbonNode(
ID_RTL,
ID_RTL,
NULL,
0L,
_T("Right-To-Left")
);
Now what we did to make this button displaying the _T("Right-To-Left") text near the small RTL icon: 1) We need to declared the following classes in the MainFrm.h file: class CMyRibbonButtonAlwaysDisplayingText : public CExtRibbonButton
{
public:
DECLARE_DYNCREATE( CMyRibbonButtonAlwaysDisplayingText );
CMyRibbonButtonAlwaysDisplayingText(
CExtRibbonPage * pBar = NULL,
UINT nCmdID = ID_SEPARATOR,
UINT nStyle = 0
)
: CExtRibbonButton( pBar, nCmdID, nStyle )
{
}
virtual INT RibbonILV_Get(
INT nType = 0 // -1 min, 0 current, 1 - max
) const
{
ASSERT_VALID( this );
nType;
return __EXT_RIBBON_ILV_SIMPLE_NORMAL;
}
};
class CMyRibbonNodeAlwaysDisplayingText : public CExtRibbonNode
{
public:
DECLARE_SERIAL( CMyRibbonNodeAlwaysDisplayingText );
CMyRibbonNodeAlwaysDisplayingText(
UINT nCmdIdBasic = 0L,
UINT nCmdIdEffective = 0L,
CExtRibbonNode * pParentNode = NULL,
DWORD dwFlags = 0L,
__EXT_MFC_SAFE_LPCTSTR strTextInToolbar = NULL,
__EXT_MFC_SAFE_LPCTSTR strTextInMenu = NULL,
__EXT_MFC_SAFE_LPCTSTR strTextUser = NULL,
LPARAM lParam = 0L,
CExtCmdIcon * pIconCustomized = NULL
#if (!defined __EXT_MFC_NO_BUILTIN_TEXTFIELD)
,
INT nTextFieldWidth = 100,
INT nDropDownWidth = -2, // (-1) - auto calc, (-2) - same as button area
INT nDropDownHeightMax = 250
#endif // (!defined __EXT_MFC_NO_BUILTIN_TEXTFIELD)
)
: CExtRibbonNode(
nCmdIdBasic, nCmdIdEffective, pParentNode, dwFlags,
strTextInToolbar, strTextInMenu, strTextUser,
lParam, pIconCustomized
#if (!defined __EXT_MFC_NO_BUILTIN_TEXTFIELD)
, nTextFieldWidth, nDropDownWidth, nDropDownHeightMax
#endif // (!defined __EXT_MFC_NO_BUILTIN_TEXTFIELD)
)
{
}
virtual CRuntimeClass * _OnRibbonGetButtonRTC()
{
ASSERT_VALID( this );
return RUNTIME_CLASS(CMyRibbonButtonAlwaysDisplayingText);
}
};
2) Then we put the following two lines into the MainFrm.cpp file: IMPLEMENT_DYNCREATE( CMyRibbonButtonAlwaysDisplayingText, CExtRibbonButton );
IMPLEMENT_SERIAL( CMyRibbonNodeAlwaysDisplayingText, CExtRibbonNode, VERSIONABLE_SCHEMA|1 );
3) Then we should modify the code lines of the CMainFrame::_InitRibbon_RightButtonsCollection() method meant above to make them using the CMyRibbonNodeAlwaysDisplayingText class type for the ID_RTL ribbon button: CExtRibbonNode * pNodeRTL =
new CMyRibbonNodeAlwaysDisplayingText(
ID_RTL,
ID_RTL,
NULL,
0L,
_T("Right-To-Left")
);
4) Finally, we compiled the Prof-UIS library with the text color fix meant above, rebuilt the RibbonBar sample application and run it.
|
|
Robert Webb
|
May 17, 2009 - 9:33 PM
|
Excellent, thanks! So this will be a permenant part of Prof-UIS now I hope? Also, could you do the same for the MDI buttons on that same row (level wth ribbon tabs)? They also come out black on black and are hard to see with the obsidian theme. Thanks,
Rob.
|
|
Robert Webb
|
Nov 6, 2008 - 9:41 PM
|
Is there a way to display different icons (ie both large and small icons) on different ribbon bar buttons that share the same command ID? Or are they forever tied to the command manager? Currently as I create my ribbon bar buttons, when I create a new button with the same ID as an old one, the icon I specify filters back to the old button as well, even though I specified a different icon when I created it. Thanks,
Rob.
|
|
Technical Support
|
Nov 7, 2008 - 3:16 PM
|
Yes, you can initialize different icons while initializing command tree nodes. But there is no reason for that because two ribbon buttons with the same command identifier will be handled by one command handler method and updated by one command updating method.
|
|
Robert Webb
|
Nov 11, 2008 - 8:22 PM
|
Sorry, I’m not sure how this answer relates to the question. What I want is two ribbon bar buttons with the same ID, but each using a different icon. Yes, both buttons will be handled by the same command handler, but they should maintain different icons. Maybe this sounds like a strange request, but it makes sense in context. I know I could use different IDs that lead to the same command handler, but there’s quite a lot of these to go through so I was hoping to avoid that. Thanks,
Rob.
|
|
Technical Support
|
Nov 13, 2008 - 12:22 PM
|
We modified the CMainFrame::_InitRibbonNode_Home_Clipboard() method in the RibbonBar sample: 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 );
// 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 ) );
// 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 );
// 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
// );
CExtRibbonNode * pNodePaste1 =
new CExtRibbonNode( ID_EDIT_PASTE, 0, NULL, 0, _T("Paste") );
pNodePaste1->CmdKeyTipSet( new CExtCustomizeCmdKeyTip( __EXT_MFC_SAFE_TCHAR( _T(’V’) ) ), false );
pNodePaste1->RibbonILE_RuleArrayGet().RemoveAll();
VERIFY( pNodePaste1->m_iconBig.m_bmpNormal.LoadBMP_Resource( MAKEINTRESOURCE(ID_EDIT_PASTE_BIG) ) );
pNodePaste1->m_iconBig.m_bmpNormal.Make32();
pNodePaste1->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 );
pNodePaste1->CmdScreenTipAttach( pCmdScreenTip );
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 );
pNodePaste1->CmdScreenTipAttach( pCmdScreenTip, false );
pRibbonGroup->InsertNode(
NULL,
pNodePaste1
);
CExtRibbonNode * pNodePaste2 =
new CExtRibbonNode( ID_EDIT_PASTE, 0, NULL, 0, _T("Paste") );
pNodePaste2->CmdKeyTipSet( new CExtCustomizeCmdKeyTip( __EXT_MFC_SAFE_TCHAR( _T(’V’) ) ), false );
pNodePaste2->RibbonILE_RuleArrayGet().RemoveAll();
VERIFY( pNodePaste2->m_iconBig.m_bmpNormal.LoadBMP_Resource( MAKEINTRESOURCE(ID_QUICK_STYLES_BIG) ) );
pNodePaste2->m_iconBig.m_bmpNormal.Make32();
pNodePaste2->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_QUICK_STYLES_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 );
pNodePaste2->CmdScreenTipAttach( pCmdScreenTip );
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 );
pNodePaste2->CmdScreenTipAttach( pCmdScreenTip, false );
pRibbonGroup->InsertNode(
NULL,
pNodePaste2
);
// 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;
}
We commented out initialization of the pNodePaste node in the original method. We added the pNodePaste1 and pNodePaste2 nodes instead and both of them have the same ID_EDIT_PASTE identifier and different icons. We simply used different icons and equal identifiers. There are no other specific things required.
|
|
Offer Har
|
Nov 6, 2008 - 7:13 PM
|
Maybe I’ll get an answer this time...
|
|
Offer Har
|
Nov 6, 2008 - 2:20 PM
|
I need to set focus to a control-bar when the user clicks on a button - how to do this? Thanks.
|
|
Technical Support
|
Nov 14, 2008 - 12:14 PM
|
Please compile and run the <span class="newgreen">ProfStudio</code> sample application. You can press the Ctrl+Shift+C keys. This will activate the Class View bar and its child window will become focused. Now you can try to hide the Class View bar, auto-hide it, float it, dock it into some tabbed group with other bars, make it non-selected bar in tabbed group and do everything else with it. You can press the Ctrl+Shift+C keys after each operation with the Class View bar. It will become visible again. Its child window will become focused again. The Class View bar is created in the <span class="newgreen">ProfStudio</code> sample application using the ID_VIEW_BAR_CLASS_VIEW identifier. This identifier is also present in menu and it’s used in the accelerator table entry with the Ctrl+Shift+C key combination. Believe or not, pressing the Ctrl+Shift+C keys is just sending the WM_COMMAND message to the main frame window and specifying the ID_VIEW_BAR_CLASS_VIEW value in its WPARAM parameter.
|
|
Offer Har
|
Nov 17, 2008 - 9:47 AM
|
Yep... it was all in the flag. By the way, this is much simpler then how you explained it, all I had to do for this is a one-line:
CExtControlBar::DoFrameBarCheckCmd(pParentFrame, pBar->GetDlgCtrlID(), false);
|
|
Offer Har
|
Nov 17, 2008 - 9:13 AM
|
Dear Support, I think I know why we have this miss-communication... I use the main-frame OnBarCheck like this:
BOOL CBaseMainFrm::OnBarCheck(UINT nID)
{
return CExtControlBar::DoFrameBarCheckCmd(this, GetSmallID(nID), true);
}
Note that last parameter is true, and in the help file it’s written: <dt>bResizableCheckmarks </dt>- Check mark mode (for resizable control bars only). If this mode is set to true, the show/hide command turns on or turns off visibility of the resizable bar. If false, the method shows the invisible bar wherever it is and sets focus on it.
So, I use the command to show/hide the control bar, and I need in another place to set focus to it even if it shown, that is, call the same function with true, so your approach of sending WM_COMMAND will not work. I see in the help that I can also just call DoFrameBarCheckCmd , in the article How to show a hidden control bar, and then I can set the third parameter to false, and the focus will be handled correctly. Can it be that we were having this long conversation over one flag...?
|
|
Technical Support
|
Nov 7, 2008 - 5:09 AM
|
No problem. The following code activates/showa a control bar in any state, set focus on it: CExtControlBar * pBar = . . .
CFrameWnd * pMainFrame = . . .
pMainFrame->SendMessage( WM_COMMAND, WPARAM( pBar->GetDlgCtrlID() ) );
This makes the control bar’s child window focused. This child window also can forward focus to any of its child windows.
|
|
Offer Har
|
Nov 7, 2008 - 2:30 PM
|
Would like to add that this should work also when the control-bars are tabbed, in which case the tab of the control-bar should be selected. The proposed solution does not work for such case.
|
|
Technical Support
|
Nov 10, 2008 - 11:52 AM
|
The proposed solution works for tabbed case, for auto-hidden case, for floating case. Sending the WM_COMMAND message is exactly the same what popup menu do when you are displaying control bar via invoking menu command. The proposed solution may not work if some or all of your control bars does not have message map entries in main frame’s message map. And of course, it requires the CMainFrame::OnBarCheck() and CMainFrame::OnUpdateControlBarMenu() methods like implemented in the main frame class of the ProfStudio sample application.
|
|
Offer Har
|
Nov 10, 2008 - 4:01 PM
|
Dear Support, I think you do not understand why I ask. The control-bar is already displayed, but does not have the focus - i want to bring him to the front - it is already shown... but in the z orer he’s not on top.
|
|
Technical Support
|
Nov 11, 2008 - 9:27 AM
|
) If you have some resizable control bar with ID_MY_BAR identifier in your main frame window:
CExtControlBar * pBar = . . .
CFrameWnd * pMainFrame = . . .
2) If your main frame has valid message map entries for this bar: ON_COMMAND_EX( ID_MY_BAR, OnBarCheck )
ON_UPDATE_COMMAND_UI( ID_MY_BAR, OnUpdateControlBarMenu )
3) And, finally, if your main frame window has correctly implemented OnBarCheck() and OnUpdateControlBarMenu() handler methods: void CMainFrame::OnUpdateControlBarMenu(CCmdUI* pCmdUI)
{
CExtControlBar::DoFrameBarCheckUpdate(
this,
pCmdUI,
false // ATTENTION: this parameter is false - not true
);
}
BOOL CMainFrame::OnBarCheck(UINT nID)
{
return
CExtControlBar::DoFrameBarCheckCmd(
this,
nID,
false // ATTENTION: this parameter is false - not true
);
}
Then the following code will do what you need: pMainFrame->SendMessage( WM_COMMAND, WPARAM(pBar->GetDlgCtrlID()) );
And the following code is exactly the same: pMainFrame->SendMessage( WM_COMMAND, ID_MY_BAR );
Sending the WM_COMMAND to main frame window with bar’s identifier in WPARAM parameter will show control bar, make its caption active and its children window focused. This command will show auto-hidden control bar or hidden control bar floating or docked. It will bring to top tab page in tabbed bar group. It will activate already shown bar and set focus to bar’s child window. Of course, the items 1, 2 and 3 in the list above should be true
|
|
Offer Har
|
Nov 13, 2008 - 8:15 AM
|
This is all nice, and I have this implemented, but this DOES NOT bring the control-bar to the front of the Z-Order, and DOES NOT faint it’s title bar in in orange in the black theme. I need something that will simulate the click on the title-bar of teh control-bar so it will move to front. The scenario is that I have a lot of control-bars open, and when the user is clicking on some button, he expect to see the control-bar he is looking for in front of all teh others.
|
|
Technical Support
|
Nov 13, 2008 - 1:29 PM
|
You asked a very simple question. Our answer was also very simple: you should send a WM_COMMAND message to your main frame window and specify control bar’s dialog control identifier in the WPARAM parameter. This is the same as clicking on the caption of displayed control bar. This is the same as invoking control bar displaying command from menu or toolbar. If this simple and extremely often used thing is not working in your application, then the control bar displaying command in menu must also not work. This is the first and the most important thing to check. Both programmatically send WM_COMMAND message should work equally in your project or may not work. If the both are not working, then you didn’t implemented message map entry like we asked you in one of our recent messages or you have some other magic issue(s) in your project. If the WM_COMMAND is not working when the menu item is OK or vice versa, then you need to get a coffee break and only then check everything as carefully and accurately as possible.
|
|
Offer Har
|
Nov 13, 2008 - 1:42 PM
|
Let me give you an example why your approach is wrong - what happens if the control-bar is displayed... it will be hidden... this is wrong. I just want it to get focus!
|
|
Offer Har
|
Nov 13, 2008 - 1:39 PM
|
I tried it and it did not work... I wouldn’t have been asking again and again had it worked. Aperantly it is not the same as clikcing the control-bar title. Why can’t there be some simple function in the control-bar SetFocus() ?
|
|
Offer Har
|
Nov 7, 2008 - 2:14 PM
|
Tried it, but it did not work. If there are two control bars, and the one I want to give the focus to is below another it does not comes to front. Is there any way to simulate the click on the title of the control bar?
|
|
Offer Har
|
Nov 6, 2008 - 7:52 AM
|
I need some answer ASAP... please try and be a little bit responsive this time. Thanks.
|
|
tera tera
|
Nov 6, 2008 - 2:21 AM
|
|
|
Technical Support
|
Nov 6, 2008 - 7:00 AM
|
The CExtPopupBaseWnd::g_nMsgTranslateMouseMoveEvent registered message is sent on each mouse move message while a popup menu is displayed on the screen. It allows you to watch, intercept and/or filter and handle mouse movement events of popup menus. The WPARAM parameter of this message is a pointer to the CExtPopupBaseWnd::TranslateMouseMoveEventData_t data object which contains details about mouse movement and your handler method should set its m_bMessageHandled property to true value if you want to intercept mouse movement and not let menu to handle it. The LPARAM parameter is unused. The CExtPopupBaseWnd::g_nMsgTranslateMouseMoveEvent registered message is very specific and you typically never need to handle it.
|
|