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
|
Dec 8, 2008 - 9:24 AM
|
Dear Support, I have a drop-list cell of type CExtGridCellDropListComboBox , and when the user changes the selection I need to reset several depending cells. However, if the user selects the same item that was selected before, I do not need to do anything. The problem is that I use OnGridCellInputComplete as my event handler for the drop-list change, and even if the user re-select the same item this event is called. Is there a way to prevent this at the cell level, so that if the same item is selected it will not call OnGridCellInputComplete ? or do i need to implement such mechanism to remember lat selected item? Thanks, Ron.
|
|
Technical Support
|
Dec 9, 2008 - 9:56 AM
|
The CExtGridCell::OnPopupListBoxSelEndOK() virtual method handles the selection of a list box item and invokes CExtGridWnd::OnGridCellInputComplete() . We assume the selection of the same list box item can be useful because it can be interpreted as an event for refreshing some data views in your application. For your convenience, we added the following grid cell style which makes all the CExtGridCell***::OnPopupListBoxSelEndOK() virtual methods not invoking the the CExtGridWnd::OnGridCellInputComplete() virtual method if the text of the selected list box item is equal to grid cell text:
#define __EGCS_EX_DO_NOT_NOTIFY_LB_SEL_FOR_EQUAL_TEXT 0x00200000L
Here are the modified methods: bool CExtGridCell::OnPopupListBoxSelEndOK(
CExtPopupInplaceListBox & wndListBox,
CExtGridCell::TrackCellStateInfo_t & _tcsi
)
{
ASSERT_VALID( this );
ASSERT( (&_tcsi.m_cell) == this );
ASSERT_VALID( (&wndListBox) );
ASSERT_VALID( (&_tcsi.m_wndGrid) );
_tcsi.m_nItemNoSelEndOK = wndListBox.GetCurSel();
_tcsi.m_bHelperSelChanged = true;
if( (wndListBox.GetStyle()&LBS_HASSTRINGS) != 0 )
{
LONG nItemCount = wndListBox.GetCount();
if( nItemCount > 0L )
{
LONG nCurSel = wndListBox.GetCurSel();
if( 0L <= nCurSel && nCurSel < nItemCount )
{
CString strSelLbText;
wndListBox.GetText( nCurSel, strSelLbText );
DWORD dwStyleEx = GetStyleEx();
bool bSendSelEndOkOnEqualText = ( ( dwStyleEx & __EGCS_EX_DO_NOT_NOTIFY_LB_SEL_FOR_EQUAL_TEXT ) != 0 ) ? true : false;
if( ! bSendSelEndOkOnEqualText )
{
CExtSafeString strCurrentText;
TextGet( strCurrentText );
if( strCurrentText == LPCTSTR(strSelLbText) )
return false;
}
if( ! strSelLbText.IsEmpty() )
{
HRESULT hr = OnParseText( LPCTSTR(strSelLbText) );
if( hr == S_OK )
{
TextSet( LPCTSTR(strSelLbText) );
_tcsi.m_wndGrid.OnGridCellInputComplete( *this, _tcsi.m_nColNo, _tcsi.m_nRowNo, _tcsi.m_nColType, _tcsi.m_nRowType, wndListBox.GetSafeHwnd() );
} // if( hr == S_OK )
} // if( ! strSelLbText.IsEmpty() )
} // if( 0L <= nCurSel && nCurSel < nItemCount )
} // if( nItemCount > 0L )
} // if( (wndListBox.GetStyle()&LBS_HASSTRINGS) != 0 )
return false;
}
bool CExtGridCellComboBox::OnPopupListBoxSelEndOK(
CExtPopupInplaceListBox & wndListBox,
CExtGridCell::TrackCellStateInfo_t & _tcsi
)
{
ASSERT_VALID( this );
ASSERT( (&_tcsi.m_cell) == this );
ASSERT_VALID( (&wndListBox) );
ASSERT_VALID( (&_tcsi.m_wndGrid) );
_tcsi.m_nItemNoSelEndOK = wndListBox.GetCurSel();
_tcsi.m_bHelperSelChanged = true;
if( (wndListBox.GetStyle()&LBS_HASSTRINGS) != 0 )
{
LONG nItemCount = wndListBox.GetCount();
if( nItemCount > 0L )
{
LONG nCurSel = wndListBox.GetCurSel();
if( 0L <= nCurSel && nCurSel < nItemCount )
{
SetCurSel( nCurSel );
CString strSelLbText;
wndListBox.GetText( nCurSel, strSelLbText );
DWORD dwStyleEx = GetStyleEx();
bool bSendSelEndOkOnEqualText = ( ( dwStyleEx & __EGCS_EX_DO_NOT_NOTIFY_LB_SEL_FOR_EQUAL_TEXT ) != 0 ) ? true : false;
if( ! bSendSelEndOkOnEqualText )
{
CExtSafeString strCurrentText;
TextGet( strCurrentText );
if( strCurrentText == LPCTSTR(strSelLbText) )
return false;
}
TextSet( LPCTSTR(strSelLbText) );
_tcsi.m_wndGrid.OnGridCellInputComplete( *this, _tcsi.m_nColNo, _tcsi.m_nRowNo, _tcsi.m_nColType, _tcsi.m_nRowType, wndListBox.GetSafeHwnd() );
} // if( 0L <= nCurSel && nCurSel < nItemCount )
} // if( nItemCount > 0L )
} // if( (wndListBox.GetStyle()&LBS_HASSTRINGS) != 0 )
return false;
}
bool CExtGridCellBool::OnPopupListBoxSelEndOK(
CExtPopupInplaceListBox & wndListBox,
CExtGridCell::TrackCellStateInfo_t & _tcsi
)
{
ASSERT_VALID( this );
ASSERT( (&_tcsi.m_cell) == this );
ASSERT_VALID( (&wndListBox) );
ASSERT_VALID( (&_tcsi.m_wndGrid) );
_tcsi.m_nItemNoSelEndOK = wndListBox.GetCurSel();
_tcsi.m_bHelperSelChanged = true;
if( (wndListBox.GetStyle()&LBS_HASSTRINGS) != 0 )
{
LONG nItemCount = wndListBox.GetCount();
if( nItemCount > 0L )
{
LONG nCurSel = wndListBox.GetCurSel();
if( 0L <= nCurSel && nCurSel < nItemCount )
{
CString strSelLbText;
wndListBox.GetText( nCurSel, strSelLbText );
DWORD dwStyleEx = GetStyleEx();
bool bSendSelEndOkOnEqualText = ( ( dwStyleEx & __EGCS_EX_DO_NOT_NOTIFY_LB_SEL_FOR_EQUAL_TEXT ) != 0 ) ? true : false;
if( ! bSendSelEndOkOnEqualText )
{
CExtSafeString strCurrentText;
TextGet( strCurrentText );
if( strCurrentText == LPCTSTR(strSelLbText) )
return false;
}
bool bData = ( wndListBox.GetItemData( nCurSel ) != 0 ) ? true : false;
DataSet( bData );
_tcsi.m_wndGrid.OnGridCellInputComplete( *this, _tcsi.m_nColNo, _tcsi.m_nRowNo, _tcsi.m_nColType, _tcsi.m_nRowType, wndListBox.GetSafeHwnd() );
} // if( 0L <= nCurSel && nCurSel < nItemCount )
} // if( nItemCount > 0L )
} // if( (wndListBox.GetStyle()&LBS_HASSTRINGS) != 0 )
return false;
}
bool CExtGridCellUpDownFontWeight::OnPopupListBoxSelEndOK(
CExtPopupInplaceListBox & wndListBox,
CExtGridCell::TrackCellStateInfo_t & _tcsi
)
{
ASSERT_VALID( this );
ASSERT( (&_tcsi.m_cell) == this );
ASSERT_VALID( (&wndListBox) );
ASSERT_VALID( (&_tcsi.m_wndGrid) );
_tcsi.m_nItemNoSelEndOK = wndListBox.GetCurSel();
_tcsi.m_bHelperSelChanged = true;
if( (wndListBox.GetStyle()&LBS_HASSTRINGS) != 0 )
{
LONG nItemCount = wndListBox.GetCount();
if( nItemCount > 0L )
{
LONG nCurSel = wndListBox.GetCurSel();
if( 0L <= nCurSel && nCurSel < nItemCount )
{
CString strSelLbText;
wndListBox.GetText( nCurSel, strSelLbText );
DWORD dwStyleEx = GetStyleEx();
bool bSendSelEndOkOnEqualText = ( ( dwStyleEx & __EGCS_EX_DO_NOT_NOTIFY_LB_SEL_FOR_EQUAL_TEXT ) != 0 ) ? true : false;
if( ! bSendSelEndOkOnEqualText )
{
CExtSafeString strCurrentText;
TextGet( strCurrentText );
if( strCurrentText == LPCTSTR(strSelLbText) )
return false;
}
DWORD dwFontWeight = (DWORD) wndListBox.GetItemData( nCurSel );
CString strText;
strText.Format( _T("%d"), int(dwFontWeight) );
TextSet( LPCTSTR(strText) );
_tcsi.m_wndGrid.OnGridCellInputComplete( *this, _tcsi.m_nColNo, _tcsi.m_nRowNo, _tcsi.m_nColType, _tcsi.m_nRowType, wndListBox.GetSafeHwnd() );
} // if( 0L <= nCurSel && nCurSel < nItemCount )
} // if( nItemCount > 0L )
} // if( (wndListBox.GetStyle()&LBS_HASSTRINGS) != 0 )
return false;
}
|
|
Offer Har
|
Dec 9, 2008 - 4:56 PM
|
Thanks Will try that out - looks like exactly what I need.
|
|
Robert Webb
|
Dec 7, 2008 - 4:20 PM
|
Hi,
We have a bunch of dialogs that draw custom stuff in OnPaint(), but now with ProfUIS, much of it doesn’t appear.
Some of this is because Prof-UIS has filled group boxes, instead of empty (why is this? Shouldn’t the skinned background come from the dialog itself?). How do I ensure OnPaint() stuff is drawn after other controls?
But there’s also other stuff that isn’t showing up, even though those dialogs have no group boxes. Any ideas?
Thanks,
Rob.
|
|
Robert Webb
|
Dec 11, 2008 - 12:29 AM
|
So is this the simplest/recommended way even for drawing stuff in the foreground? I don’t need what I draw to show through other transparent controls for the most part. I just need a way to draw stuff that won’t overlap other controls. Rob.
|
|
Technical Support
|
Dec 11, 2008 - 10:48 AM
|
If you don’t need to draw compound inherited background, then you should simply handle the WM_PAINT message in the WindowProc() virtual method:
virtual LRESULT WindowProc( UINT message, WPARAM wParam, LPARAM lParam )
{
if( message == WM_PAINT )
{
CRect rcClient;
GetClientRect( &rcClient );
CPaintDC dcPaint( this );
CExtPaintManager::stat_ExcludeChildAreas( dcPaint, m_hWnd, CExtPaintManager::stat_DefExcludeChildAreaCallback );
CExtMemoryDC dc( &dcPaint, &rcClient );
//
// First of all we will paint default themed background.
//
if( ! ( g_PaintManager->GetCb2DbTransparentMode(this) && g_PaintManager->PaintDockerBkgnd( true, dc, this ) ) )
dc.FillSolidRect( &rcClient, g_PaintManager->GetColor( COLOR_3DFACE ) );
//
// TO-DO: Paint custom background here.
//
g_PaintManager->OnPaintSessionComplete( this );
return 0L;
}
return __BASE_CLASS__ :: WindowProc( message, wParam, lParam );
}
|
|
Technical Support
|
Dec 9, 2008 - 9:59 AM
|
|
|
Offer Har
|
Dec 6, 2008 - 7:36 PM
|
Dear Support, Any news when 2.84 will be released? Thanks, Ron.
|
|
Technical Support
|
Dec 11, 2008 - 10:45 AM
|
First of all, this problem is well known as principally never fixed issue of Windows XP and later versions:
http://connect.microsoft.com/VisualStudio/feedback/ViewFeedback.aspx?FeedbackID=354617
It appeared many years ago with release of Windows XP and still not fixed. Probably, it’s easier to code new OS than fix this problem. The fixes like the following one are incorrect:
http://www.codeproject.com/KB/bugs/MDIFlick.aspx
Now the good news. It looks like we fixed it. Here is the ZIP file with compiled sample MDI applications:
http://www.prof-uis.com/download/forums/tmp/MdiFlickerFreeTests284.zip
The problem appeared when you are activating MDI child frames via menu because the CMDIFrameWnd::OnCommand() virtual method handles these menu commands in a special way when Prof-UIS expects to intercept classic WM_MDIACTIVATE messages. Now Prof-UIS also handles the MDI window menu commands in the overriden OnCommand() virtual method of the code>CExtNCW < CMDIFrameWnd ></code> specialized template class.
It also looks like all the other known problems with skinned MDI child frame windows are gone because Prof-UIS 2.84 implements most of the MDI interface features manually (window tiling and cascading for instance). We had no chance to avoid this.
|
|
Offer Har
|
Dec 9, 2008 - 4:55 PM
|
|
|
Technical Support
|
Dec 9, 2008 - 9:54 AM
|
It is scheduled for December 15. We are sorry for the delay.
|
|
Offer Har
|
Dec 9, 2008 - 4:55 PM
|
|
|
Technical Support
|
Dec 11, 2008 - 10:45 AM
|
First of all, this problem is well known as principally never fixed issue of Windows XP and later versions:
http://connect.microsoft.com/VisualStudio/feedback/ViewFeedback.aspx?FeedbackID=354617
It appeared many years ago with release of Windows XP and still not fixed. Probably, it’s easier to code new OS than fix this problem. The fixes like the following one are incorrect:
http://www.codeproject.com/KB/bugs/MDIFlick.aspx
Now the good news. It looks like we fixed it. Here is the ZIP file with compiled sample MDI applications:
http://www.prof-uis.com/download/forums/tmp/MdiFlickerFreeTests284.zip
The problem appeared when you are activating MDI child frames via menu because the CMDIFrameWnd::OnCommand() virtual method handles these menu commands in a special way when Prof-UIS expects to intercept classic WM_MDIACTIVATE messages. Now Prof-UIS also handles the MDI window menu commands in the overriden OnCommand() virtual method of the code>CExtNCW < CMDIFrameWnd ></code> specialized template class.
It also looks like all the other known problems with skinned MDI child frame windows are gone because Prof-UIS 2.84 implements most of the MDI interface features manually (window tiling and cascading for instance). We had no chance to avoid this.
|
|
Offer Har
|
Dec 11, 2008 - 3:59 PM
|
Great news... looking forward to try it on our products next week... (we are still expecting the version to be out on the 15th - right?)
|
|
Rado Manzela
|
Dec 4, 2008 - 3:18 PM
|
My grid window contains some editable CExtGridCellDateTime cells. I’ve added __EGWS_BSE_BUTTONS_IN_FOCUSED_ROW style to grid to see dropdown buttons of selected rows only.
Is it possible to set dropdown button of some datetime cell individually to be always visible?
It seems that cell->ModifyStyle(__EGCS_BUTTON_DROPDOWN ) does not help. Thank you
|
|
Technical Support
|
Dec 6, 2008 - 7:57 AM
|
The __EGWS_BSE_BUTTONS_IN_FOCUSED_ROW style displays grid cell buttons for the focused row. May be you meant the __EGWS_BSE_BUTTONS_IN_SELECTED_ROW style.
It’s not possible to make a particular grid cell displaying buttons persistently when other cells do not do the same. But the __EGWS_BSE_BUTTONS_IN_HOVERED_ROW style will display buttons of any grid cell under the mouse cursor.
|
|
John Ritzenthaler
|
Dec 4, 2008 - 2:33 PM
|
I’m just learning Prof-UIS so I created an application that uses toolbars, the statusbar and a few controls. When I compile it in Release mode with static libraries, the executable is 6.7MB. I followed your instructions on size reduction, un-commenting all the Prof-UIS.h defines except:
//#define __EXT_MFC_NO_DYNAMIC_BAR_SITE
//#define __EXT_MFC_NO_SCROLLWND
//#define __EXT_MFC_NO_STATUSBAR
//#define __EXT_MFC_NO_NC_FRAME
I also excluded all the foreign languages. And yes, I did rebuild the libraries. Why is it still so huge?
|
|
Technical Support
|
Dec 9, 2008 - 10:00 AM
|
Prof-UIS currently does not support pre-processor macros variables for excluding particular paint manager classes from the build. But, if you don’t need the Office 2007 themes, you can comment out the following line in the ...\Include\Resources\resource.rc file: #include "Res2007\\Res2007.rc"
This should make the Prof-UIS smaller than any other code exclusions.
|
|
John Ritzenthaler
|
Dec 8, 2008 - 9:06 AM
|
Is there a way to include just ONE of the themes?
|
|
Technical Support
|
Dec 6, 2008 - 7:58 AM
|
Since the Office 2007 themes appeared in Prof-UIS, you no longer have any reason to exclude some parts of code to reduce the library size. The big size is provided by Office 2007 theme resources rather than by source code. Take a look at the ...\Prof-UIS\Include\Resources\Res2007\ folder. All the bitmaps in this folder are present in Prof-UIS resources. The big resources do not affect the DLL code loading speed.
|
|
tera tera
|
Dec 4, 2008 - 2:38 AM
|
Hello. I want to delete the line of the place that I surrounded in a red circle ---->
|
|
Technical Support
|
Dec 4, 2008 - 12:44 PM
|
We suspect this black line is painted by your code rather than by Prof-UIS. The flat tab control has a single pixel margin line around flat tab items and under tab items. The tab page window on your screenshot uses a colorized background and a dark line at the top. This dark line looks as it is painted by the page window rather than by the tab control.
|
|
Robert Webb
|
Dec 4, 2008 - 12:36 AM
|
I’m having lots of problems putting controls on toolbars successfully. Sorry if I’ve missed something obvious.
(1) None of CExtBarLabelButton, CExtBarCheckBoxButton or CExtBarRadioBoxButton appear in any of the sample code. A label is put on a toolbar in the ProfUIS_Controls sample, but it is done differently, by creating a CExtLabel and adding it with SetButtonCtrl(). One problem with this approach seems to be that it disappears when the toolbar is resized (to split over multiple lines). Why is that? Can it be avoided? Should the CExtBar*Button classes avoid that problem?
(2) When attempting to use CExtBarLabelButton, how do I set the text for the label? Nothing I’ve tried has worked. Same question for CExtBarCheckBoxButton.
(3) Is the only way to set the width of a label or check-box in a toolbar to derive new classes and override CalculateLayout()?
(4) Some reason when I create a CExtBarCheckBoxButton in your ProfUIS_Controls sample code and add it with InsertSpecButton() to a toolbar, it works (but without showing any text). However when I do the same thing in my own code, it fails, just leaving the original icon button there. One thing that’s slightly different is that in my code I am replacing existing buttons, first with InsertSpecButton() to add the new one, then with RemoveButton() to remove the original one. They have the same ID though, so is it possible the customization module is changing my check box back to whatever it thinks the button should be? Any other suggestions?
(5) I understand what you mean about making the label part of the combo box, and see that it would be a better option, but haven’t tried that yet. That may circumvent my problems with CExtBarLabelButton, but I still have all the same problems with CExtBarCheckBoxButton.
(6) I tried using SetButtonCtrlVisibleVertically() for various controls, but they just appear as wide blank areas when docked vertically. Eg edit and combo boxes behave that way. Am I doing something wrong or is this just a known limitation?
Maybe you could add some sample code to demonstrate creation of labels and check boxes on toolbars, via the CExtBar*Button and InsertSpecButton() method, which seems preferable? Showing how to control the width and text on such controls.
Thanks,
Rob.
|
|
Technical Support
|
Dec 4, 2008 - 12:52 PM
|
The CExtToolControlBar window does not contain icons nor text strings for its toolbar buttons. Both icons and text strings are stored in the command manager. You should get the command description object using the CExtCmdManager::CmdGetPtr() method and set its CExtCmdItem::m_sToolbarText () property. This approach should be used for both check box and label buttons.
The CExtToolControlBar::SetButtonCtrlVisibleVertically() and CExtBarButton::SetCtrlVisibleVertically() methods are typically used with the CExtBarButton::SetNoRotateVerticalLayout() method. All the most often used common controls have horizontal layout. So, if you want to see them in vertical toolbar, then you should make button using horizontal layout in vertically docked toolbar.
We think, we can add the new two features for all the toolbar buttons: text to display before toolbar button and text to display after it. This is easier to code in Prof-UIS than to code in standalone test project created for you as ready-to-use sample application.
|
|
tera tera
|
Dec 3, 2008 - 5:35 PM
|
Hello. Scenery becomes black as follows when I use CExtWFF. I decide to just use CListBox.
Is there a problem?
|
|
Technical Support
|
Dec 5, 2008 - 11:12 AM
|
|
|
Dominik Braendlin
|
Dec 3, 2008 - 2:00 AM
|
Dear Tech Support I am using CExtLabel to display a CExtBitmap. It seems to me that it does only handle the SS_CENTERIMAGE flag for ICONS (SS_ICON). I need to vertically and horizontally align the bitmap. I don’t want it to be stretched. Could you please tell how I can do this? Thanks Adrian
|
|
Technical Support
|
Dec 3, 2008 - 9:46 AM
|
Here is part of the WinUser.h file where the SS_*** styles of the label control are defined: /*
* Static Control Constants
*/
#define SS_LEFT 0x00000000L
#define SS_CENTER 0x00000001L
#define SS_RIGHT 0x00000002L
#define SS_ICON 0x00000003L
#define SS_BLACKRECT 0x00000004L
#define SS_GRAYRECT 0x00000005L
#define SS_WHITERECT 0x00000006L
#define SS_BLACKFRAME 0x00000007L
#define SS_GRAYFRAME 0x00000008L
#define SS_WHITEFRAME 0x00000009L
#define SS_USERITEM 0x0000000AL
#define SS_SIMPLE 0x0000000BL
#define SS_LEFTNOWORDWRAP 0x0000000CL
#if(WINVER >= 0x0400)
#define SS_OWNERDRAW 0x0000000DL
#define SS_BITMAP 0x0000000EL
#define SS_ENHMETAFILE 0x0000000FL
#define SS_ETCHEDHORZ 0x00000010L
#define SS_ETCHEDVERT 0x00000011L
#define SS_ETCHEDFRAME 0x00000012L
#define SS_TYPEMASK 0x0000001FL
#endif /* WINVER >= 0x0400 */
#define SS_NOPREFIX 0x00000080L /* Don’t do "&" character translation */
#if(WINVER >= 0x0400)
#define SS_NOTIFY 0x00000100L
#define SS_CENTERIMAGE 0x00000200L
#define SS_RIGHTJUST 0x00000400L
#define SS_REALSIZEIMAGE 0x00000800L
#define SS_SUNKEN 0x00001000L
#define SS_ENDELLIPSIS 0x00004000L
#define SS_PATHELLIPSIS 0x00008000L
#define SS_WORDELLIPSIS 0x0000C000L
#define SS_ELLIPSISMASK 0x0000C000L
#endif /* WINVER >= 0x0400 */
As you can see, the first part of styles defined above the SS_TYPEMASK preprocessor symbol definition cannot be mixed with each other. So, please check whether the SS_CENTER style is not mixed with other styles like SS_ICON . Please also ensure the CExtLabel control uses the CExtLabel::eAlign bitmap painting mode nevertheless this is the default painting mode: CExtLabel & wndLabel = . . .
CExtLabel::e_ImageMode_t eImageMode = CExtLabel::eAlign;
wndLabel.SetImageMode( eImageMode );
Finally, we have improved the CExtLabel class part which paints the CExtBitmap image and added support for the SS_CENTERIMAGE style which can be mixed with the SS_CENTER style for painting the CExtBitmap image aligned to center both vertically and horizontally. If you need to use the vertical center alignment, then please update the source code for the following method: void CExtLabel::DoPaint(
CDC * pDC,
CRect & rcClient
)
{
ASSERT_VALID( this );
ASSERT_VALID( pDC );
CExtMemoryDC dc( pDC, &rcClient );
CRgn rgnClient;
if( rgnClient.CreateRectRgnIndirect( &rcClient ) )
dc.SelectClipRgn( &rgnClient );
OnEraseBackground( dc, rcClient );
DWORD dwWndStyle = GetStyle();
DWORD dwWndType = (dwWndStyle&SS_TYPEMASK);
bool bCenterImage = ( (dwWndStyle&SS_CENTERIMAGE) != 0 );
if( ! m_bmp.IsEmpty() )
{
bool bSmootherAsPossible = true;
e_ImageMode_t eImageMode = GetImageMode();
if( eImageMode == eStretch )
m_bmp.AlphaBlendSkinParts( dc.GetSafeHdc(), rcClient, CRect(0,0,0,0), CExtBitmap::__EDM_STRETCH, true, bSmootherAsPossible );
else if( eImageMode == eTile )
m_bmp.AlphaBlendSkinParts( dc.GetSafeHdc(), rcClient, CRect(0,0,0,0), CExtBitmap::__EDM_TILE, true, bSmootherAsPossible );
else if( eImageMode == eAlign )
{
CSize szSize = m_bmp.GetSize();
CRect rcDst( rcClient.left, rcClient.top, rcClient.left + szSize.cx, rcClient.top + szSize.cy );
bool bCenterHorizontally = false;
switch( dwWndType )
{
case SS_RIGHT: rcDst.OffsetRect( rcClient.right - rcDst.right, 0 ); break;
case SS_CENTER: bCenterHorizontally = true; break;
default: /* all the other types assumed as left */ break;
}
if( bCenterHorizontally )
rcDst.OffsetRect( ( (rcClient.right - rcClient.left) - (rcDst.right - rcDst.left) ) / 2, 0 );
if( bCenterImage )
rcDst.OffsetRect( 0, ( (rcClient.bottom - rcClient.top) - (rcDst.bottom - rcDst.top) ) / 2 );
CRect rcSrc( 0, 0, szSize.cx, szSize.cy );
rcDst.top = max( rcDst.top, rcClient.top );
rcDst.left = max( rcDst.left, rcClient.left );
rcDst.bottom = min( rcDst.bottom, rcClient.bottom );
rcDst.right = min( rcDst.right, rcClient.right );
if( ::RectVisible( dc.GetSafeHdc(), &rcDst ) )
{
INT nOldStretchBltMode = bSmootherAsPossible ? ( ::GetStretchBltMode( dc.m_hDC ) ) : ( COLORONCOLOR );
if( bSmootherAsPossible )
::SetStretchBltMode( dc.m_hDC, ( g_PaintManager.m_bIsWinNT ) ? HALFTONE : COLORONCOLOR );
m_bmp.AlphaBlend( dc.m_hDC, rcDst, rcSrc );
if( bSmootherAsPossible )
::SetStretchBltMode( dc.m_hDC, nOldStretchBltMode );
}
}
}
else if( dwWndType == SS_ICON )
{
HICON hIcon = GetIcon();
if( hIcon != NULL )
{
CExtCmdIcon _icon;
_icon.AssignFromHICON( hIcon, true );
CSize szIcon = _icon.GetSize();
int nOffsetX = bCenterImage ? (rcClient.Width() - szIcon.cx) / 2 : 0;
int nOffsetY = bCenterImage ? (rcClient.Height() - szIcon.cy) / 2 : 0;
_icon.Paint( PmBridge_GetPM(), dc.GetSafeHdc(), rcClient.left + nOffsetX, rcClient.top + nOffsetY, -1, -1 );
}
}
else
{
CExtSafeString strText;
int nTextLen = GetWindowTextLength();
if( nTextLen > 0 )
{
GetWindowText( strText.GetBuffer( nTextLen + 2 ), nTextLen + 1 );
strText.ReleaseBuffer();
}
if( strText.GetLength() > 0 )
{
DWORD dwDrawTextFlags = 0;
switch( dwWndType )
{
case SS_RIGHT: dwDrawTextFlags = DT_RIGHT; break;
case SS_CENTER: dwDrawTextFlags = DT_CENTER; break;
case SS_LEFTNOWORDWRAP: dwDrawTextFlags = DT_LEFT; break;
default: /* all the other types assumed as left */ dwDrawTextFlags = DT_LEFT; break;
} // switch( dwWndType )
if( strText.Find( _T(’\t’) ) != -1 ) // do tabs expanding
dwDrawTextFlags |= DT_EXPANDTABS;
if( (dwWndType == SS_SIMPLE)
|| (dwWndStyle&(SS_CENTERIMAGE|SS_ENDELLIPSIS|SS_PATHELLIPSIS)) != 0
)
{
dwDrawTextFlags |= DT_SINGLELINE;
if( (dwWndStyle&SS_CENTERIMAGE) != 0 )
dwDrawTextFlags |= DT_VCENTER;
if( (dwWndStyle&SS_ENDELLIPSIS) != 0 )
dwDrawTextFlags |= DT_END_ELLIPSIS;
if( (dwWndStyle&SS_PATHELLIPSIS) != 0 )
dwDrawTextFlags |= DT_PATH_ELLIPSIS;
}
else
dwDrawTextFlags |= DT_WORDBREAK;
if( dwWndType == SS_LEFTNOWORDWRAP )
dwDrawTextFlags &= ~(DT_WORDBREAK|DT_SINGLELINE);
if( (dwWndStyle&SS_NOPREFIX) != 0 )
dwDrawTextFlags |= DT_NOPREFIX;
bool bEnabled = IsWindowEnabled() ? true : false;
OnDrawLabelText( dc, rcClient, strText, dwDrawTextFlags, bEnabled );
} // if( strText.GetLength() > 0 )
}
PmBridge_GetPM()->OnPaintSessionComplete( this );
if( rgnClient.GetSafeHandle() != NULL )
dc.SelectClipRgn( &rgnClient );
}
|
|
tera tera
|
Dec 2, 2008 - 11:55 PM
|
Hello. When Bar was done Show of, please teach a called virtual function. Thanks,
|
|
Technical Support
|
Dec 15, 2008 - 9:40 AM
|
Please process a WM_WINDOWPOSCHANGED message in the WindowProc() virtual method so that you can check if the control bar is visible using the CControlBar::IsVisible() method.
|
|
Technical Support
|
Dec 12, 2008 - 10:32 AM
|
You should handle a WM_WINDOWPOSCHANGED message for your control bar and determine whether the control bar contains the WS_VISIBLE style . It should be created without the WS_VISIBLE style.
|
|
tera tera
|
Dec 17, 2008 - 9:39 PM
|
Hello. What kind of message should I judge it by?
|
|
Technical Support
|
Dec 18, 2008 - 11:46 AM
|
The window displayed from auto-hide tabs using the sliding animation is called the auto-hide slider control. This window looks like control bar but it’s not a control bar. The bar’s child window (color picker on your screen shot) is temporarily moved into the auto-hide slider window when it should be displayed from auto-hide tabs. So, the bar’s child window can simply handle the WM_WINDOWPOSCHANGED message and detect whether it’s parent is the CExtControlBar window. If the parent of color picker window is not the CExtControlBar window, then the color picker is displayed from auto-hide area.
|
|
tera tera
|
Dec 15, 2008 - 2:36 AM
|
I want to catch WM_SHOWWINDOW.
In WindowProc, I cannot catch it
|
|
Technical Support
|
Dec 3, 2008 - 10:02 AM
|
There is a CExtControlBar::OnControlBarPositionChange() virtual method ,which is invoked when the window visible state and/or window position the control bar has changed.
|
|
tera tera
|
Dec 11, 2008 - 10:47 PM
|
Hello. When a bar was displayed for the first time, I want you to teach a virtual function.
|
|
Bjorn Lindahl
|
Dec 1, 2008 - 7:13 AM
|
<meta content="text/html; charset=utf-8" http-equiv="Content-Type" /> <meta content="Word.Document" name="ProgId" /> <meta content="Microsoft Word 11" name="Generator" /> <meta content="Microsoft Word 11" name="Originator" /> <link href="file:///C:\DOCUME~1\bjorlin\LOCALS~1\Temp\msohtml1\01\clip_filelist.xml" rel="File-List" /><!--[if gte mso 9]><xml> <w:WordDocument> <w:View>Normal</w:View> <w:Zoom>0</w:Zoom> <w:PunctuationKerning /> <w:ValidateAgainstSchemas /> <w:SaveIfXMLInvalid>false</w:SaveIfXMLInvalid> <w:IgnoreMixedContent>false</w:IgnoreMixedContent> <w:AlwaysShowPlaceholderText>false</w:AlwaysShowPlaceholderText> <w:Compatibility> <w:BreakWrappedTables /> <w:SnapToGridInCell /> <w:WrapTextWithPunct /> <w:UseAsianBreakRules /> <w:DontGrowAutofit /> </w:Compatibility> <w:BrowserLevel>MicrosoftInternetExplorer4</w:BrowserLevel> </w:WordDocument> </xml><![endif]--><!--[if gte mso 9]><xml> <w:LatentStyles DefLockedState="false" LatentStyleCount="156"> </w:LatentStyles> </xml><![endif]--><style type="text/css"> <!-- /* Style Definitions */ p.MsoNormal, li.MsoNormal, div.MsoNormal {mso-style-parent:""; margin:0cm; margin-bottom:.0001pt; mso-pagination:widow-orphan; font-size:12.0pt; font-family:"Times New Roman"; mso-fareast-font-family:"Times New Roman";} @page Section1 {size:612.0pt 792.0pt; margin:72.0pt 90.0pt 72.0pt 90.0pt; mso-header-margin:35.4pt; mso-footer-margin:35.4pt; mso-paper-source:0;} div.Section1 {page:Section1;} --> </style><!--[if gte mso 10]> <style> /* Style Definitions */ table.MsoNormalTable {mso-style-name:"Normal tabell"; mso-tstyle-rowband-size:0; mso-tstyle-colband-size:0; mso-style-noshow:yes; mso-style-parent:""; mso-padding-alt:0cm 5.4pt 0cm 5.4pt; mso-para-margin:0cm; mso-para-margin-bottom:.0001pt; mso-pagination:widow-orphan; font-size:10.0pt; font-family:"Times New Roman"; mso-ansi-language:#0400; mso-fareast-language:#0400; mso-bidi-language:#0400;} </style> <![endif]--> <meta content="text/html; charset=utf-8" http-equiv="Content-Type" /> <meta content="Word.Document" name="ProgId" /> <meta content="Microsoft Word 11" name="Generator" /> <meta content="Microsoft Word 11" name="Originator" /> <link href="file:///C:\DOCUME~1\bjorlin\LOCALS~1\Temp\msohtml1\01\clip_filelist.xml" rel="File-List" /><!--[if gte mso 9]><xml> <w:WordDocument> <w:View>Normal</w:View> <w:Zoom>0</w:Zoom> <w:PunctuationKerning /> <w:ValidateAgainstSchemas /> <w:SaveIfXMLInvalid>false</w:SaveIfXMLInvalid> <w:IgnoreMixedContent>false</w:IgnoreMixedContent> <w:AlwaysShowPlaceholderText>false</w:AlwaysShowPlaceholderText> <w:Compatibility> <w:BreakWrappedTables /> <w:SnapToGridInCell /> <w:WrapTextWithPunct /> <w:UseAsianBreakRules /> <w:DontGrowAutofit /> </w:Compatibility> <w:BrowserLevel>MicrosoftInternetExplorer4</w:BrowserLevel> </w:WordDocument> </xml><![endif]--><!--[if gte mso 9]><xml> <w:LatentStyles DefLockedState="false" LatentStyleCount="156"> </w:LatentStyles> </xml><![endif]--><style type="text/css"> <!-- /* Style Definitions */ p.MsoNormal, li.MsoNormal, div.MsoNormal {mso-style-parent:""; margin:0cm; margin-bottom:.0001pt; mso-pagination:widow-orphan; font-size:12.0pt; font-family:"Times New Roman"; mso-fareast-font-family:"Times New Roman";} @page Section1 {size:612.0pt 792.0pt; margin:72.0pt 90.0pt 72.0pt 90.0pt; mso-header-margin:35.4pt; mso-footer-margin:35.4pt; mso-paper-source:0;} div.Section1 {page:Section1;} --> </style><!--[if gte mso 10]> <style> /* Style Definitions */ table.MsoNormalTable {mso-style-name:"Normal tabell"; mso-tstyle-rowband-size:0; mso-tstyle-colband-size:0; mso-style-noshow:yes; mso-style-parent:""; mso-padding-alt:0cm 5.4pt 0cm 5.4pt; mso-para-margin:0cm; mso-para-margin-bottom:.0001pt; mso-pagination:widow-orphan; font-size:10.0pt; font-family:"Times New Roman"; mso-ansi-language:#0400; mso-fareast-language:#0400; mso-bidi-language:#0400;} </style> <![endif]-->Hi!
I have a question regarding menus, actually it’s for all kind of GUI resources but we stick to menus for convenience. We have split up an application in smaller parts with several dll:s with different resurcs like menus, dialogs etc. We’re not really sure how to get it to work with ProfUIS though. We have a base application which holds the main menu that every application got. For each dll they could add their own menus to the application. The main menu is loaded according to your specifications in samples and tutorials.<o:p></o:p> The question is how to correctly load more than one menu during runtime (created in the VS resource editor) and merge it with a previously created CExtMenuControlBar . Thanks in advance!
|
|
Bjorn Lindahl
|
Dec 2, 2008 - 8:15 AM
|
I’m sorry, I didn’t explain the problem as clearly as I should have. We have everything setup with MFC extension DLLs containing MFC resources as menus for instance. We load the DLLs at runtime without problem but we’re not sure how we correctly merge the menu in a DLL with the CExtMenuControlBar declared in our application. With correctly I mean how it’s supposed to be done to work as it should with ProfUIS. I’ve seen functions that merge two HMENU :s but I guess we need to do something with statBasicCommands for instance, and if so is it possible to do it at runtime?
|
|
Technical Support
|
Dec 3, 2008 - 9:28 AM
|
You can invoke the CExtCmdManager::UpdateFromMenu() method many times for updating the command manager from all the menu resources in your DLLs. Of course, all the commands in all the menu resources must have unique command identifiers. If you need to display menu in the menu bar which is combination of several menu trees, you need to code your own recursive function which will merge menu trees. This is a very specific feature. Please provide us with more details.
|
|
Technical Support
|
Dec 1, 2008 - 10:34 AM
|
You should create your DLL projects as MFC extension DLLs rather than MFC regular DLLs. The MFC extension DLLs cannot be used from non-MFC-based EXE modules. This should not be a problem. The most important thing is that you can use MFC class instances and resources of MFC extension DLL from EXE’s source code. If you need to load MFC extension library dynamically, you should use the AfxLoadLibrary() function from MFC instead of the LoadLibrary() Win32 function.
|
|
Bjorn Lindahl
|
Dec 1, 2008 - 7:14 AM
|
Feel free to remove the meta data header that was attached to my message for some reason. =)
|
|
tera tera
|
Nov 29, 2008 - 12:08 AM
|
Hello. The anchor of the dialogue that I assigned to a bar does not work when I do following how to use m_pRitsumenBar->SetRedraw(false);
m_pRitsumenBar->FloatControlBar( CPoint(480, 200) );
m_pRitsumenBar->HideBar();
m_pRitsumenBar->SetRedraw(true);
|
|
Technical Support
|
Dec 1, 2008 - 10:17 AM
|
Finally you should invoke: m_pRitsumenBar->OnRepositionSingleChild();
m_pRitsumenBar->RedrawWindow(
NULL,
NULL,
RDW_INVALIDATE|RDW_UPDATENOW
|RDW_ERASE|RDW_ERASENOW
|RDW_ALLCHILDREN
|RDW_FRAME
);
|
|
Paul Boswell
|
Nov 28, 2008 - 3:01 PM
|
I have a CExtToolControlBar in a CWnd in a CExtControlBar (like the Open GL sample app). The CExtControlBar is docked in an MDI child window. When the CExtControlBar is docked in the child window, the enabled/disabled state of the toolbar buttons is determined by the corresponding ON_UPDATE_COMMAND_UI functions in the child window (like normal). However, when the CExtControlBar is undocked, the buttons all go disabled. It seems unusual that the buttons go disabled when the control bar is undocked. Any idea how to fix this? Thanks.
|
|
Technical Support
|
Dec 1, 2008 - 10:14 AM
|
Please add the following properties into your CWnd -derived class: protected:
bool m_bEnabledControlBarUpdate:1, m_bInConrolBarUpdate:1;
And initialize them in constructor(s): : m_bEnabledControlBarUpdate( false )
, m_bInConrolBarUpdate( false )
The m_bEnabledControlBarUpdate property should be set to true in the PreSubclassWindow() virtual method: void CExtResizableDialog::PreSubclassWindow()
{
CWnd::PreSubclassWindow();
m_bEnabledControlBarUpdate = true;
}
It should be set to false in the PreSubclassWindow() virtual method: void CExtResizableDialog::PostNcDestroy()
{
m_bEnabledControlBarUpdate = false;
CWnd::PostNcDestroy();
}
The WindowProc() virtual method should invoke the CExtControlBar::DoCustomModeUpdateControlBars() static method which does command updating invocations: LRESULT CExtResizableDialog::WindowProc(UINT message, WPARAM wParam, LPARAM lParam)
{
bool bUpdateBarsOnThisMsg = false;
if( m_bEnabledControlBarUpdate )
{
CWinApp * pApp = AfxGetApp();
ASSERT( pApp != NULL );
BOOL bIdleMsg = pApp->IsIdleMessage(
#if _MFC_VER < 0x700
&pApp->m_msgCur
#else
&(::AfxGetThreadState()->m_msgCur)
#endif
);
if( bIdleMsg )
bUpdateBarsOnThisMsg = true;
}
HWND hWndThis = m_hWnd;
LRESULT lResult = CWnd::WindowProc(message, wParam, lParam);
if( hWndThis == NULL
|| ( ! ::IsWindow(hWndThis) )
)
bUpdateBarsOnThisMsg = false;
if( bUpdateBarsOnThisMsg
&& ( ! m_bInConrolBarUpdate )
)
{
m_bInConrolBarUpdate = true;
CExtControlBar::DoCustomModeUpdateControlBars( this );
m_bInConrolBarUpdate = false;
}
return lResult;
}
|
|
Paul Boswell
|
Dec 1, 2008 - 7:49 AM
|
I take that back - that didn’t completely fix the problem. Now, at least the command routing (of the buttons in the CExtToolControlBart) goes to its parent CWnd. However, it doesn’t go beyond that. For example, when handling the OnUpdateCommandUI for the toolbar buttons, any change to the state of the buttons in the rest of the app doesn’t change the state of the buttons in the said toolbar.
|
|
Paul Boswell
|
Dec 1, 2008 - 6:44 AM
|
Figured it out - I needed to add the line: (CExtToolControlBar).m_bPresubclassDialogMode = true;
|
|
Technical Support
|
Dec 1, 2008 - 10:33 AM
|
Yes, that’s right. The improvement we suggested in our previous answer will do the guaranteed command processing in the same way like MFC does in frame windows.
|
|
Paul Boswell
|
Dec 1, 2008 - 8:08 AM
|
I take that back - that didn’t completely fix the problem. Now, at least the command routing (of the buttons in the CExtToolControlBart) goes to its parent CWnd. However, it doesn’t go beyond that. For example, when handling the OnUpdateCommandUI for the toolbar buttons, any change to the state of the buttons in the rest of the app doesn’t change the state of the buttons in the said toolbar.
|
|
Paul Boswell
|
Dec 1, 2008 - 11:30 AM
|
Perfect - that’s just what I needed. Thanks a lot!
|
|
tera tera
|
Nov 26, 2008 - 7:07 PM
|
Hello. Please teach a part equivalent to CTabCtrl in Prof-uis.
|
|
Technical Support
|
Nov 27, 2008 - 11:14 AM
|
We have three types of tabs:
1) The CExtTabWnd class implements a single line tab window. There is a set of different styled versions of this class: CExtTabFlatWnd , CExtTabButtonsWnd , CExtTabWhidbeyWnd , and CExtTabOneNoteWnd . It’s not difficult to create a new themed version as it is demonstrated in the following test project: http://www.prof-uis.com//download/forums/TestIE7Tabs.zip
2) The CExtTabMdiWnd class implements a single line MDI tabs window. There is a similar set of styled MDI tabs.
3) The CExtTabPageContainerWnd implements a container window which uses CExtTabWnd single line tabs to change the selected window. There is also a similar set of styled tab page containers.
All classes are not based on the CTabCtrl class.
|
|
tera tera
|
Nov 28, 2008 - 5:31 PM
|
Hello. When I want to use CTabCtrl by all means.
Should I just use CTabCtrl?
|
|
Technical Support
|
Dec 1, 2008 - 10:16 AM
|
If you need a control which contains only a list of tab items like a CTabCtrl , the best option is CExtTabWnd . If you need a control which works as a container for page windows like a tabbed property sheet, CExtTabPageContainerWnd will certainly be better.
|
|
Paul Boswell
|
Nov 26, 2008 - 11:50 AM
|
I use EnableWindow(FALSE) to set the state of a CExtComboBox in a CExtToolControlBar to disabled. Immediately after the call, the combo box goes disabled. However, whenever I move the cursor over the box, it becomes enabled again.
How do I keep it disabled?
|
|
Technical Support
|
Nov 26, 2008 - 1:33 PM
|
Please add a command updating method for the button which was used for attaching a combo box control in the toolbar and enable this command. Alternatively you can add a command hander method for this button.
Toolbar buttons are controlled by MFC’s command updating mechanism. If a toolbar button has no handler/updating methods, it will be disabled. If some window is attached to a toolbar button, the window’s enabled state is automatically synchronized with the state of the toolbar button.
|
|
Paul Boswell
|
Nov 26, 2008 - 11:46 AM
|
I have a CExtToolControlBar and I put a CExtComboBox into it. How can I make a text label show up next to it like it would for a regular button?
|
|
Robert Webb
|
Nov 30, 2008 - 11:49 PM
|
I discovered a little more regarding my problem posted earlier. The default width for a CExtBarTextFieldButton is 100 pixels. However, in our derived classes we specify other widths in the constructor, eg 30 in this example:
MyTextField::MyTextField() : CExtBarTextFieldButton(false, 30)
{
} However, they still turn up as 100 pixels wide in the GUI, even though calling CExtBarTextFieldButton::GetTextFieldWidth() after InsertSpecButton() does indeed return 30. Why is this and how do I get it to appear as 30 pixels wide? So onto my label field. Remember I said that with method (2) the label came out in the wrong place, part-way through a text field earlier in the toolbar? Well, measuring distances, it appears that it would be in the right place IF the other text fields had appeared in their appropriate widths. So I guess the only problem here is that those text fields don’t come out in the width I set. Any thoughts? Thanks,
Rob.
|
|
Robert Webb
|
Nov 30, 2008 - 7:41 PM
|
I’m also trying to insert a label on a toolbar, but am having trouble getting it to work. It seems there are two ways: - Create a CExtBarLabelButton and insert using InsertSpecButton()
- Create a CExtLabel and replace a place-holder button with SetButtonCtrl()
Is there any reason to use one over the other? Method (1) is not used in any of the sample code and I can’t get it to work. How do I specify the text for the label? What about the width? Method (2) I did get to work, sort of, but the label appears on the wrong part of the toolbar! It starts half way through another edit control. This toolbar already has other edit-boxes and similar appearing on it, using custom classes derived from CExtBarButton. Is it necessary to derive a new class just to insert a label? Is there a problem mixing methods (1) and (2)? Thanks,
Rob.
|
|
Technical Support
|
Dec 1, 2008 - 10:25 AM
|
It is not the best option to insert a label as a standalone button. A combo box and its label then may turn out to be in two different rows in a floating toolbar, which is resized for displaying its buttons into more than one row. So, we think the best way is to code a custom CExtBarTextFieldButton -derived class which implements the CalculateLayout() , PaintCompound() and OnInplaceControlCalcRect() virtual methods. Make the CalculateLayout() and PaintCompound() similar to the original ones, but reserve some space for the label and paint it. The OnInplaceControlCalcRect() virtual method should return the correct rectangle for text/combo area inside the toolbar button. You can use this combo box button in toolbars by overriding the CExtToolControlBar::OnCreateBarCommandBtn virtual method, in which your button class should be instantiated with an appropriate command identifier. If you are using customizable toolbars and menus, you should override the CExtCustomizeSite::OnCreateToolbarButton() virtual method.
We guess the text/combo button has different widths because you are using customizable toolbars and menus. Please set text/combo field width in the command tree node using the CExtCustomizeCmdTreeNode::TextFieldWidthSet() method. Please also do not forget to remove control bar and customize site state data of your program or invoke the reset command for toolbar with combo/text field to see changes.
|
|
Robert Webb
|
Dec 11, 2008 - 12:38 AM
|
I have found that after the call to CExtCustomizeSite::EnableCustomization(), any custom buttons I have replaced using InsertSpecButton() are changed back again. I would like this toolbar to be customizable, but how? Rather than inserting the custom button into the toolbar, shouldn’t I be inserting it into the CExtCmdItem somehow? Thanks,
Rob.
|
|
Technical Support
|
Dec 11, 2008 - 10:48 AM
|
You should use the CExtToolControlBar::InsertSpecButton() method only with non-customizable toolbars. The customizable toolbars and menus are based on the CExtCustomizeCmdTreeNode command tree nodes and each toolbar button and menu item should have its own command node. The initial command trees are constructed inside customize site. You can specify the command tree flags for each node and ask customize site to create appropriate toolbar buttons. If you need to create your own button classes, then you should implement the CExtToolControlBar::OnCreateBarCommandBtn() virtual method. Please take a look at the CMainFrame::OnCreate() method in the DRAWCLI sample application. It configures several command nodes near invocation of the CExtCustomizeSite::EnableCustomization() method invocation.
|
|
Robert Webb
|
Dec 12, 2008 - 12:22 AM
|
OK, I can see that OnCreateBarCommandBtn() works, although if I customise and create a new toolbar, then it is not of my derived type, so if I drag one of my controls onto it, it won’t draw it right. Can I tell it to always use my class instead of the default? Also, I found that the reason I couldn’t get text to display next to the check box (and maybe in labels too but haven’t tested that yet) is simply because the flag to always display text is not set (__ECTN_DISPLAY_TEXTONLY_ALWAYS). But how do I set this flag? Before EnableCustomization() there’s no CExtCustomizeCmdTreeNode for the button. Afterwards I can set the flag, but it doesn’t take, presumably because the control is updated from the CExtCmdItem. But I can’t see how to tell the CExtCmdItem that this item should always show text. Any advice? Thanks,
Rob.
|
|
Technical Support
|
Dec 15, 2008 - 9:41 AM
|
If you cannot implement the OnCreateBarCommandBtn() virtual method for some of your toolbars,you can implement the CExtCustomizeSite::OnCreateToolbarButton() virtual method instead.
The __ECTN_DISPLAY_TEXTONLY_ALWAYS style can be applied using the CExtCustomizeCmdTreeNode::ModifyFlags() method. The command tree node of toolbar button is returned by the CExtBarButton::GetCmdNode() method. To update any changes of visual styles you did you should re-compute layout of toolbar’s parent frame window using the pToolbar->GetParentFrame()->RecalcLayout(); or pToolbarButton->GetBar()->GetParentFrame()->RecalcLayout(); code.
|
|
Robert Webb
|
Dec 15, 2008 - 11:47 PM
|
Oh, yes OnCreateToolbarButton() looks more useful. I’m not sure why OnCreateBarCommandBtn() would ever be used instead. I’ll try it out.
Yes, I know about ModifyFlags(). I should have asked when to set that flag rather than how, or how to make it stick. Setting before EnableCustomization() was not possible, and setting after didn’t work.
I found a solution however. I found CExtBarButton::OnCustomizeUpdateProps() and overrode that, using it to set the __ECTN_DISPLAY_TEXTONLY_ALWAYS flag. At last I have text showing up for labels and check boxes!
It really is weird though that the default flags for labels are set so that text is not visible! Took a long time to figure that out, given it was so unexpected. Maybe you should change the default flags for labels and check-boxes, or ignore the flag and always display text anyway.
Rob.
|
|
Technical Support
|
Dec 18, 2008 - 11:42 AM
|
The CExtCustomizeSite class allows you to implement customizable toolbars and menus similar to that you can see in Visual Studio and some of MS Office applications. The main idea was to provide the customizable toolbars and menus with the set of basic command items, split buttons, menu trees, edit fields and combo box like fields. These set of basic UI elements should be automatically clone-able via drag-n-dropping in the customize mode and drag-n-dropping with the ALT key pressed. All the multiple copies of each element should be automatically synchronized. This is the main idea of the CExtCustomizeSite class. It’s possible to use other toolbar buttons with the customization subsystem like label buttons in toolbar, but such label buttons assumed as advanced elements and we agree they may require some improvements in the CExtCustomizeSite class.
|
|
Technical Support
|
Nov 26, 2008 - 1:33 PM
|
Please add a command updating method for the button which was used for attaching a combo box control in the toolbar and enable this command. Alternatively you can add a command hander method for this button.
Toolbar buttons are controlled by MFC’s command updating mechanism. If a toolbar button has no handler/updating methods, it will be disabled. If some window is attached to a toolbar button, the window’s enabled state is automatically synchronized with the state of the toolbar button.
|
|
Technical Support
|
Nov 26, 2008 - 1:31 PM
|
You should insert a CExtBarLabelButton into your toolbar near the combo box button using CExtToolControlBar::InsertSpecButton() and CExtToolControlBar::CommandToIndexMethod() allows you to determine the position of the combo box button by its command identifier.
|
|
Paul Boswell
|
Nov 26, 2008 - 11:49 AM
|
I use EnableWindow(FALSE) to set the state of a CExtComboBox in a CExtToolControlBar to disabled. Immediately after the call, the combo box goes disabled. However, whenever I move the cursor over the box, it becomes enabled again. How do I keep it disabled?
|
|
Nachman Israel
|
Nov 26, 2008 - 2:50 AM
|
Hi, I’m using at my code the CExtGridWnd control, and the problem I have is that sometimes I want some of the cells to be disable in particular row when the user choose something at particular cell(meaning that cells are connected to each other), so I changed the cell’s style to read only, this works fine and the cell is truly read only but the problem is that I want it to LOOK like disable data, so the user know it’s read only, and if I only changed the style, the cell is read only, but looks the same.(user know it’s read only only when trying to type something. This problem is mainly seen in cells that are from type number or edit cells. I will be very happy to get some help, Thanks, Osnat Silberberg
|
|
Technical Support
|
Nov 26, 2008 - 10:54 AM
|
You can set the disabled text/background colors of your grid cells when you disable them or make them read-only. The CExtGridCell::TextColorSet() and CExtGridCell::BackColorSet() methods invoked with the CExtGridCell::__ECS_ALL parameter will make the grid cells using the specified text/background color persistently.
|
|
tera tera
|
Nov 25, 2008 - 2:56 AM
|
Hello. I want to change control in the dialog as follows. Please teach a method.
Thanks
|
|
Technical Support
|
Nov 25, 2008 - 12:32 PM
|
You should manually change the visibility of controls at top of your dialog and resize the gray control at bottom. The new file dialog in v.2.84 does this work. It supports a collapsing feature:
We can provide you with the source code of this dialog or latest 2.84 source code so you can use the new CExtShellDialogFile class as an example.
|
|
tera tera
|
Nov 25, 2008 - 2:39 AM
|
Hello. I made a large icon of 32x32 for ribbonnodeLarge.
Even if I set an icon of 32x32 in RibbonNodeSmall.
Is the icon done displaying compactedly of?
|
|
Technical Support
|
Nov 26, 2008 - 10:55 AM
|
If you have only a 32x32 icon, then you can create a very smoothly resized 16x16 version of this icon using highest quality resizing algorithms provided by the CExtBitmap class and not based on Win32 API. Here is the part of the CMainFrame::_InitRibbonNode_Home_Clipboard() method in the RibbonBar sample application which initializes the always big Paste ribbon button and loads the 32x32 ID_EDIT_PASTE_BIG bitmap icon into it:
. . .
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 );
. . .
We can change this code and enable small icon state of this button without creating the 16x16 icon for it: CExtRibbonNode * pNodePaste =
new CExtRibbonNode( ID_EDIT_PASTE, 0, NULL, 0, _T("Paste") );
pNodePaste->CmdKeyTipSet( new CExtCustomizeCmdKeyTip( __EXT_MFC_SAFE_TCHAR( _T(’V’) ) ), false );
// THIS LINE WAS COMMENTED: it disables all the button states excepting big state with 32x32 icon
// pNodePaste->RibbonILE_RuleArrayGet().RemoveAll();
// THIS LINE WAS COMMENTED =======================================================================
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 );
// THESE LINES WERE ADDED: creation of 16x16 icon from already loaded 32x32 icon =================
pNodePaste->m_iconSmall = pNodePaste->m_iconBig; // copy image surface
CExtBitmap::Filter _filter( CExtBitmap::Filter::lanczos ); // use extremely smooth scaling
pNodePaste->m_iconSmall.m_bmpNormal.Scale( 16, 16, _filter ); // do bitmap scaling
// THESE LINES WERE ADDED ========================================================================
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
);
|
|
Technical Support
|
Nov 25, 2008 - 12:34 PM
|
For ribbon buttons use 16x16 icons in small layout without text and normal layout with text on right. The 32x32 icons are used only in the large layout with text at bottom. If you need something else, you should use custom ribbon button and ribbon node classes.
|
|
tera tera
|
Nov 25, 2008 - 10:11 PM
|
Hello. Can RibbonMenu display 32*32 icons at Small size (16*16 size)?
|
|
tera tera
|
Nov 24, 2008 - 11:54 PM
|
Hello. BOOL CExtPopupMenuWnd::UpdateFromMenu(
HWND hWndCmdRecv,
CMenu * pBuildMenu,
bool bPopupMenu, // = true
bool bTopLevel, // = true
bool bNoRefToCmdMngr // = false
) Please teach it about the fifth parameter
Will not the menu be registered with Command Manager when I set a parameter in true?
Because I make a dynamic menu now, I am troubled when registered.
|
|
Technical Support
|
Nov 25, 2008 - 12:36 PM
|
There are two types of menu command items:
1) Menu command items that work through the command manager. The icon, menu item text, status tip and cool tip parameters of menu item are stored in the command manager. Such items can be inserted into popup menus via the CExtPopupMenuWnd::ItemInsert() method or via the CExtPopupMenuWnd::LoadMenu() and CExtPopupMenuWnd::UpdateFromMenu() methods invoked with the bNoRefToCmdMngr parameter set to false .
2) Menu command items that do not work through the command manager. The menu item’s properties are stored in a popup menu object. Such items can be inserted into popup menus by using the CExtPopupMenuWnd::ItemInsertCommand() method or via the CExtPopupMenuWnd::LoadMenu() and CExtPopupMenuWnd::UpdateFromMenu() methods invoked with the bNoRefToCmdMngr parameter set to true .
Dynamically constructed menus can contain both types of menu commands. The 2nd type is often used when menu command identifiers are generated dynamically.
|
|