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 |
|
delu qiu
|
May 25, 2006 - 1:17 PM
|
Hi,
I have a CMDIFrameWnd derived frame, I want to set the frame window to top most when it receive a user-defined WM_ message which send from frame’s child window. and the SetWindowPos function can set the position but can not put the window to top. MoveWindow take same effect;
here is my code: -------------------------------------------------------------------------------------------- class CMainFrame : public CExtNCW < CMDIFrameWnd > {
protected: //{{AFX_MSG(CMainFrame) ........... //}}AFX_MSG ......... afx_msg LRESULT OnTMClose(WPARAM wParam, LPARAM lParam); afx_msg LRESULT OnTMOpen(WPARAM wParam, LPARAM lParam);
DECLARE_MESSAGE_MAP() };
BEGIN_MESSAGE_MAP(CMainFrame, CFrameWnd) //{{AFX_MSG_MAP(CMainFrame) ON_WM_CREATE() ON_WM_TIMER() //}}AFX_MSG_MAP ................. ON_MESSAGE(WM_DISABLEMAIN ,OnTMClose) ON_MESSAGE(WM_ENABLEMAIN,OnTMOpen) .......... END_MESSAGE_MAP()
LRESULT CMainFrame::OnTMOpen(WPARAM wParam, LPARAM lParam) { bClosed=FALSE; m_wndSplitter.SetColumnInfo(0,GetSystemMetrics (SM_CXSCREEN)-DEF_RIGHTVIEWWIDTH,500); m_wndSplitter.SetColumnInfo(1,DEF_RIGHTVIEWWIDTH,20); m_wndSplitter.RecalcLayout(); m_wndStatusBar.ShowWindow(SW_SHOW); EnableWindow(TRUE); CWnd * pParent=::AfxGetMainWnd(); BOOL bOpen; bOpen=::SetWindowPos(pParent->m_hWnd, HWND_TOPMOST ,//wndBottom wndNoTopMost wndTop 0,0,GetSystemMetrics (SM_CXSCREEN ), GetSystemMetrics (SM_CYSCREEN ),SWP_SHOWWINDOW); if (!bOpen) { CString Err; Err.Format("LastError %d",GetLastError()); AfxMessageBox(Err); } /* ShowWindow(SW_SHOWMAXIMIZED); CRect cRect; cRect.top = 0; cRect.left = 0; cRect.right = GetSystemMetrics (SM_CXSCREEN); cRect.bottom = GetSystemMetrics (SM_CYSCREEN); MoveWindow (&cRect); ::SetForegroundWindow (this->m_hWnd); ::BringWindowToTop(this->m_hWnd); ::SetActiveWindow(this->m_hWnd); */
return 0; }
|
|
Technical Support
|
May 26, 2006 - 2:25 AM
|
We guess the problem hides somewhere outside the source code provided in your message. We have been using the CFrameWnd::BringToTop() method in our projects and never had any problems.
|
|
Aurelien BOUDOUX
|
May 24, 2006 - 2:20 PM
|
Hi, and sorry for my english
I’m testing the new Prof-UIS 2.54 library, and something sound wrong with MDI app...
When I open a new Document/View in a main frame where all windows are in fullscreen, the new doc/view don’t appear in fullscreen mode like other windows, due to ResizeParentToFit !
Prof-UIS 2.53 don’t do this, so what append ?
|
|
Technical Support
|
May 25, 2006 - 8:57 AM
|
We cannot confirm that this problem occurs and the document/view architecture has nothing to do with what you are talking about. We added the ActivateFrame() virtual method to the CChildFrame class of the FullScreenState sample application and it creates a maximized MDI child frame windows without any problems. Here is the method’s source code: void CChildFrame::ActivateFrame(int nCmdShow)
{
nCmdShow = SW_SHOWMAXIMIZED;
CMDIChildWnd::ActivateFrame(nCmdShow);
}
|
|
Raffaele Cappelli
|
May 23, 2006 - 4:08 PM
|
I am experiencing flickering when switching tabs. This happens when the child window corresponding to new selected tab was smaller and has to be resized.
If in function CExtTWPC<_BT>::OnTabWndSelectionChange(...) I move GetParent()->CWnd::RepositionBars( 0, 0xFFFF, 0x101 + nNewItemIndex ) before ::ShowWindow( hWndNew, SW_SHOW ); then the problem seems to be solved. Do you think there is any side effect of this fix?
|
|
Technical Support
|
May 24, 2006 - 1:01 PM
|
We agree the painting code for the tab area should be improved in the Native XP theme. We have two improved methods related to the tab page containers: CExtTWPC::OnTabWndSelectionChange() and CExtTabPageContainerWnd::_RepositionBarsImpl() . Here is the source code: virtual bool OnTabWndSelectionChange(
LONG nOldItemIndex,
LONG nNewItemIndex,
bool bPreSelectionTest
)
{
if( ! _BT::OnTabWndSelectionChange(
nOldItemIndex,
nNewItemIndex,
bPreSelectionTest
)
)
return false;
if( (! bPreSelectionTest ) && nNewItemIndex >= 0 && _BT::ItemGetCount() > 0 )
{
GetParent() -> CWnd::RepositionBars( 0, 0xFFFF, 0x101 + nNewItemIndex );
HWND hWndNew = NULL;
if( nOldItemIndex >= 0 )
{
hWndNew = (HWND) _BT::ItemLParamGet( nNewItemIndex );
if( hWndNew != NULL && ::IsWindow( hWndNew ) )
::ShowWindow( hWndNew, SW_SHOW );
else
hWndNew = NULL;
}
if( nOldItemIndex >= 0 )
{
HWND hWndOld = (HWND) _BT :: ItemLParamGet( nOldItemIndex );
if( hWndOld != NULL && ::IsWindow( hWndOld ) )
::ShowWindow( hWndOld, SW_HIDE );
}
HWND hWndFocus = ::GetFocus();
if( hWndFocus != NULL && hWndNew != NULL )
::SetFocus( hWndNew );
}
return
((CExtTabPageContainerWnd*)GetParent())->OnTabWndSelectionChange(
nOldItemIndex,
nNewItemIndex,
bPreSelectionTest
);
}
void CExtTabPageContainerWnd::_RepositionBarsImpl()
{
int nPos = 0, nAdjustPos = -1;
if( m_pWndTab->GetSafeHwnd() != NULL )
{
nPos = (int)m_pWndTab->SelectionGet();
if( nPos < 0 )
nPos = 0;
else
nAdjustPos = nPos;
}
CWnd::RepositionBars( 0, 0xFFFF, 0x101 + nPos );
if( nAdjustPos >= 0 )
{
HWND hWnd = (HWND) m_pWndTab->ItemLParamGet( nAdjustPos );
if( hWnd != NULL
&& ::IsWindow( hWnd )
&& ( ::GetWindowLong( hWnd, GWL_STYLE ) & WS_VISIBLE ) == 0
)
::ShowWindow( hWnd, SW_SHOW );
}
}
|
|
Raffaele Cappelli
|
May 25, 2006 - 2:37 AM
|
Actually I noted the flickering in the Office 2007 Obsidian theme (since with the black background it was more evident).
In any case, I confirm that in the last version it is solved.
|
|
Raffaele Cappelli
|
May 21, 2006 - 12:15 PM
|
I would like to create a child property sheet using CExtTabPageContainerWnd and child dialogs as pages. Is there a way to paint the background of the child dialog so that it is "consistent" with the active tab background? Something similar to EnableThemeDialogTexture() with ETDT_USETABTEXTURE, but that could work with any of your PaintManagers. My apologies in advance if I have missed this in one of the samples or in a FAQ.
|
|
Technical Support
|
May 22, 2006 - 4:30 AM
|
Thank you for the interesting question. The CChildView class in the TabbedBars sample is derived from the CExtTabPageContainerOneNoteWnd class and used as the main SDI view window. This class demonstrates two backgrounds: OneNote-consistent and a custom hurricane-like. Now let us explain the details. Prof-UIS features the 100% implemented support for inheritable custom background painting, but this feature is turned off by default. To turn it on, invoke the following code both at start up and after installing a new paint manager on-the-fly: pPM->m_bCustomBackgroundInheritanceEnabled = true; After this flag is set on, any our paint manager sends the CExtPaintManager::g_nMsgPaintInheritedBackground registered windows message to allow painted windows to draw the inheritable custom background which is consistent between child/parent windows. This message is handled in the CMainFrame::OnMsgPaintInheritedBackground() and CChildView::OnMsgPaintInheritedBackground() methods in the TabbedBars sample. The main frame window handles this message to paint the hurricane-like background of dock bar windows and control bars. The child view window handles this message to paint the custom background of dialog pages and this case seems is what you really need. We implemented a gradient background of dialog pages which (as we hope) looks good because it uses both light and dark colors of the tab item in the OneNote tab control. But it is not a problem to use only the dark color and paint solid colored tab page background.
|
|
Raffaele Cappelli
|
May 22, 2006 - 10:44 AM
|
Thank you for the explanation. If I understand correctly, this works with CExtTabPageContainerOneNoteWnd, CExtTabPageContainerFlatWnd, and CExtTabPageContainerWhidbeyWnd. It would be nice to enable this to work also for CExtTabPageContainerWnd: this in the native xp paint manager should correspond to the normal windows xp theme behavious for the property sheet, and in the other paint managers should be consistent to the tab style. However, I understand this would be more complicated since the look of CExtTabPageContainerWnd tabs is different in each paint manager.
|
|
Technical Support
|
May 24, 2006 - 1:04 PM
|
We can implement a custom tab page container background in each paint manager but in most cases it is not needed because the tab window in the style of Visual Studio .NET / 2005 is designed as a stand-alone scrollable tab control which eats less possible space and does not control the background of other windows. The consistent background may really be needed in the Native WinXP theme and in custom tab page containers like One Note.
|
|
Raffaele Cappelli
|
May 25, 2006 - 2:38 AM
|
I agree it is not worth to develop a custom tab child window background for each paint manager. In my application at the end I decided to just add a thin border to separate the tabs from the child, and it looks good.
|
|
Sergei Nikitin
|
May 19, 2006 - 11:03 AM
|
Hi,
Is there any way to implement a subject using CExtTabWnd?
I want to create a tab container like the VS built in HTML editor (open any HTML file in VS). It has to 2 buttons: design and HTML.
|
|
Technical Support
|
May 20, 2006 - 8:38 AM
|
The code for the tab window you described may look like this: #if (! defined __EXT_TAB_FLAT_WND_H)
#include <ExtTabFlatWnd.h>
#endif
class CExtTabButtonsWnd : public CExtTabFlatWnd
{
public:
DECLARE_DYNCREATE( CExtTabButtonsWnd );
CExtTabButtonsWnd();
//{{AFX_VIRTUAL(CExtTabButtonsWnd)
//}}AFX_VIRTUAL
virtual ~CExtTabButtonsWnd();
protected:
void OnTabWndDrawItem(
CDC & dc,
CRect & rcTabItemsArea,
LONG nItemIndex,
TAB_ITEM_INFO * pTii,
bool bTopLeft,
bool bHorz,
bool bSelected,
bool bCenteredText,
bool bGroupedMode,
bool bInGroupActive,
bool bInvertedVerticalMode,
const CRect & rcEntireItem,
CSize sizeTextMeasured,
CFont * pFont,
__EXT_MFC_SAFE_LPCTSTR sText,
CExtCmdIcon * pIcon
);
void OnTabWndMeasureItemAreaMargins(
LONG & nSpaceBefore,
LONG & nSpaceAfter,
LONG & nSpaceOver
);
virtual void OnTabWndUpdateItemMeasure(
TAB_ITEM_INFO * pTii,
CDC & dcMeasure,
CSize & sizePreCalc
);
virtual void OnTabWndEraseClientArea(
CDC & dc,
CRect & rcClient,
CRect & rcTabItemsArea,
CRect & rcTabNearBorderArea,
DWORD dwOrientation,
bool bGroupedMode
);
virtual void OnTabWndDrawEntire(
CDC & dc,
CRect & rcClient
);
virtual INT OnTabWndGetParentSizingMargin(
DWORD dwOrientation
) const;
virtual void OnFlatTabWndQueryItemInclines(
LONG nItemIndex,
bool bSelected,
bool * p_bItemHasInclineBefore,
bool * p_bItemHasInclineAfter
)
{
ASSERT_VALID( this );
nItemIndex;
bSelected;
if( p_bItemHasInclineBefore != NULL )
*p_bItemHasInclineBefore = 0;
if( p_bItemHasInclineAfter != NULL )
*p_bItemHasInclineAfter = 0;
}
//{{AFX_MSG(CExtTabButtonsWnd)
//}}AFX_MSG
afx_msg LRESULT OnSizeParent( WPARAM wParam, LPARAM lParam );
DECLARE_MESSAGE_MAP()
}; // class CExtTabButtonsWnd
Here is implementation:
#if (!defined __AFXPRIV_H__)
#include <AfxPriv.h>
#endif
#if _MFC_VER < 0x700
#include <../src/AfxImpl.h>
#else
#include <../src/mfc/AfxImpl.h>
#endif
#ifdef _DEBUG
#define new DEBUG_NEW
#undef THIS_FILE
static char THIS_FILE[] = __FILE__;
#endif
IMPLEMENT_DYNCREATE( CExtTabButtonsWnd, CExtTabFlatWnd );
CExtTabButtonsWnd::CExtTabButtonsWnd()
{
}
CExtTabButtonsWnd::~CExtTabButtonsWnd()
{
}
BEGIN_MESSAGE_MAP(CExtTabButtonsWnd, CExtTabFlatWnd)
//{{AFX_MSG_MAP(CExtTabButtonsWnd)
//}}AFX_MSG_MAP
ON_MESSAGE( WM_SIZEPARENT, OnSizeParent )
END_MESSAGE_MAP()
void CExtTabButtonsWnd::OnTabWndDrawItem(
CDC & dc,
CRect & rcTabItemsArea,
LONG nItemIndex,
TAB_ITEM_INFO * pTii,
bool bTopLeft,
bool bHorz,
bool bSelected,
bool bCenteredText,
bool bGroupedMode,
bool bInGroupActive,
bool bInvertedVerticalMode,
const CRect & rcEntireItem,
CSize sizeTextMeasured,
CFont * pFont,
__EXT_MFC_SAFE_LPCTSTR sText,
CExtCmdIcon * pIcon
)
{
ASSERT_VALID( this );
ASSERT_VALID( pTii );
pTii;
ASSERT( dc.GetSafeHdc() != NULL );
ASSERT( pFont != NULL );
ASSERT( pFont->GetSafeHandle() != NULL );
nItemIndex;
rcTabItemsArea;
bGroupedMode;
bInGroupActive;
bHorz;
bTopLeft;
CRect rcItem( rcEntireItem );
switch( OrientationGet() )
{
case __ETWS_ORIENT_TOP:
rcItem.DeflateRect( 0, 1, 0, 0 );
break;
case __ETWS_ORIENT_BOTTOM:
rcItem.DeflateRect( 0, 0, 0, 1 );
break;
case __ETWS_ORIENT_LEFT:
rcItem.DeflateRect( 1, 0, 0, 0 );
break;
case __ETWS_ORIENT_RIGHT:
rcItem.DeflateRect( 0, 0, 1, 0 );
break;
}
CRect rcExtendClip( rcItem );
CRect rcClient;
GetClientRect( &rcClient );
if( bHorz )
{
rcExtendClip.top = rcClient.top;
rcExtendClip.bottom = rcClient.bottom;
rcExtendClip.left = max( rcClient.left, rcTabItemsArea.left );
rcExtendClip.right = min( rcExtendClip.right, rcTabItemsArea.right );
}
else
{
rcExtendClip.left = rcClient.left;
rcExtendClip.right = rcClient.right;
rcExtendClip.top = max( rcClient.top, rcTabItemsArea.top );
rcExtendClip.bottom = min( rcExtendClip.bottom, rcTabItemsArea.bottom );
}
CRgn rgnExtendClip;
if( rgnExtendClip.CreateRectRgnIndirect( &rcExtendClip ) )
dc.SelectClipRgn( &rgnExtendClip, RGN_OR );
bool bSelectedAppearance = false;
if( ( bGroupedMode && bInGroupActive )
|| ( (!bGroupedMode) && bSelected )
)
bSelectedAppearance = true;
COLORREF clrLight;
COLORREF clrShadow;
COLORREF clrDkShadow;
COLORREF clrTabBk;
COLORREF clrText;
OnFlatTabWndGetItemColors(
nItemIndex,
bSelectedAppearance,
clrLight,
clrShadow,
clrDkShadow,
clrTabBk,
clrText
);
if( bSelectedAppearance )
{
dc.FillSolidRect( &rcItem, clrTabBk );
dc.Draw3dRect( &rcItem, clrDkShadow, clrDkShadow );
}
CSize _sizeIcon( 0, 0 );
bool bDrawIcon = (
pIcon != NULL
&& (!pIcon->IsEmpty())
&& (GetTabWndStyle()&__ETWS_HIDE_ICONS) == 0
);
if( bDrawIcon )
{
_sizeIcon = pIcon->GetSize();
ASSERT( _sizeIcon.cx > 0 && _sizeIcon.cy > 0 );
}
CRect rcItemForIcon( rcItem );
if( bDrawIcon
&& _sizeIcon.cx > 0
&& _sizeIcon.cy > 0
)
{
rcItemForIcon.right = rcItemForIcon.left + _sizeIcon.cx;
rcItemForIcon.bottom = rcItemForIcon.top + _sizeIcon.cy;
rcItemForIcon.OffsetRect(
bHorz ? 0 : ((rcItem.Width() - _sizeIcon.cx) / 2),
bHorz ? ((rcItem.Height() - _sizeIcon.cy) / 2) : 0
);
if( rcItemForIcon.left < (rcItem.left+1) )
rcItemForIcon.left = (rcItem.left+1);
if( rcItemForIcon.right < (rcItem.right-1) )
rcItemForIcon.right = (rcItem.right-1);
if( rcItemForIcon.top < (rcItem.top+1) )
rcItemForIcon.top = (rcItem.top+1);
if( rcItemForIcon.bottom < (rcItem.bottom-1) )
rcItemForIcon.bottom = (rcItem.bottom-1);
}
CExtSafeString sItemText( (sText == NULL) ? _T("") : sText );
CRect rcText(
rcItem.left
+ ( bHorz
? (_sizeIcon.cx +
((_sizeIcon.cx > 0) ? __EXTTAB_MARGIN_ICON2TEXT_X : 0)
)
: 0
),
rcItem.top
+ ( bHorz
? 0
: (_sizeIcon.cy +
((_sizeIcon.cy > 0) ? __EXTTAB_MARGIN_ICON2TEXT_Y : 0)
)
),
rcItem.right,
rcItem.bottom
);
if( ! bHorz )
{
int nWidth0 = rcText.Width();
int nWidth1 = rcItem.Width() + __EXTTAB_MARGIN_ICON2TEXT_X*2;
if( nWidth1 > nWidth0 )
{
if( bInvertedVerticalMode )
rcText.left = rcText.right - nWidth1;
else
rcText.right = rcText.left + nWidth1;
}
}
CSize _sizeText = rcText.Size();
bool bDrawText = ( rcText.Width() > 6 && rcText.Height() > 6 ) ? true : false;
if( (!bDrawText) && (!( bGroupedMode && (!bInGroupActive) )) )
{
rcItemForIcon.OffsetRect(
bHorz ? (rcItem.Width() - _sizeIcon.cx)/2 : 0,
bHorz ? 0 : (rcItem.Height() - _sizeIcon.cy)/2
);
}
if( bDrawIcon )
{
if( (bHorz && rcItemForIcon.Width() >= _sizeIcon.cx )
|| (!bHorz && rcItemForIcon.Height() >= _sizeIcon.cy)
)
{
CRect rcTmpText( 0, 0, 0, 0 );
rcItemForIcon.OffsetRect( -4, -1 );
PmBridge_GetPM()->PaintIcon(
dc,
true,
sItemText,
pIcon,
rcItemForIcon,
rcTmpText,
false,
pTii->EnabledGet(),
false,
0
);
}
}
if( bDrawText )
{
ASSERT( pFont != NULL );
ASSERT( pFont->GetSafeHandle() != NULL );
COLORREF clrOldText = dc.SetTextColor( clrText );
INT nOldBkMode = dc.SetBkMode( TRANSPARENT );
CFont * pOldFont = dc.SelectObject( pFont );
if( ! bHorz )
{
if( ! bDrawIcon )
rcText.top += 4;
else
{
rcText.top =
rcItemForIcon.top
+ _sizeIcon.cy
+ __EXTTAB_MARGIN_ICON2TEXT_Y;
}
rcText.OffsetRect(
bInvertedVerticalMode
? ((sizeTextMeasured.cy/2) + 3)
: - ((sizeTextMeasured.cy/2) + 3)
,
0
);
CPoint ptCenter = rcText.CenterPoint();
if( bCenteredText )
{
UINT nOldTA = dc.SetTextAlign( TA_CENTER | TA_BASELINE );
dc.ExtTextOut(
ptCenter.x,
ptCenter.y,
ETO_CLIPPED,
&rcText,
sItemText,
sItemText.GetLength(),
NULL
);
dc.SetTextAlign( nOldTA );
}
else
{
UINT nOldTA = dc.SetTextAlign( TA_TOP | TA_BASELINE );
if( bInvertedVerticalMode )
ptCenter.y =
rcText.bottom - (rcText.Height() - sizeTextMeasured.cx)
;
else
ptCenter.y =
rcText.top
;
dc.ExtTextOut(
ptCenter.x,
ptCenter.y,
ETO_CLIPPED,
&rcText,
sItemText,
sItemText.GetLength(),
NULL
);
dc.SetTextAlign( nOldTA );
}
}
else
{
UINT nFormat =
DT_SINGLELINE|DT_VCENTER|DT_END_ELLIPSIS;
if( bCenteredText )
nFormat |= DT_CENTER;
else
nFormat |= DT_LEFT;
if( ! bDrawIcon )
rcText.left += 4;
else
{
rcText.left =
rcItemForIcon.left
+ _sizeIcon.cx
+ __EXTTAB_MARGIN_ICON2TEXT_X;
}
dc.DrawText(
sItemText,
sItemText.GetLength(),
rcText,
nFormat
);
}
dc.SelectObject( pOldFont );
dc.SetBkMode( nOldBkMode );
dc.SetTextColor( clrOldText );
}
}
void CExtTabButtonsWnd::OnTabWndMeasureItemAreaMargins(
LONG & nSpaceBefore,
LONG & nSpaceAfter,
LONG & nSpaceOver
)
{
ASSERT_VALID( this );
nSpaceBefore;
nSpaceAfter;
nSpaceOver;
}
void CExtTabButtonsWnd::OnTabWndUpdateItemMeasure(
TAB_ITEM_INFO * pTii,
CDC & dcMeasure,
CSize & sizePreCalc
)
{
ASSERT_VALID( this );
ASSERT( dcMeasure.GetSafeHdc() != NULL );
pTii;
dcMeasure;
sizePreCalc;
}
void CExtTabButtonsWnd::OnTabWndEraseClientArea(
CDC & dc,
CRect & rcClient,
CRect & rcTabItemsArea,
CRect & rcTabNearBorderArea,
DWORD dwOrientation,
bool bGroupedMode
)
{
ASSERT_VALID( this );
ASSERT( dc.GetSafeHdc() != NULL );
rcTabItemsArea;
rcTabNearBorderArea;
dwOrientation;
bGroupedMode;
CExtPaintManager * pPM = PmBridge_GetPM();
if( ! pPM->PaintDockerBkgnd( true, dc, this ) )
dc.FillSolidRect(
&rcClient,
pPM->GetColor(
CExtPaintManager::CLR_3DFACE_OUT,
this
)
);
}
void CExtTabButtonsWnd::OnTabWndDrawEntire(
CDC & dc,
CRect & rcClient
)
{
ASSERT_VALID( this );
ASSERT( dc.GetSafeHdc() != NULL );
CExtTabWnd::OnTabWndDrawEntire(
dc,
rcClient
);
}
INT CExtTabButtonsWnd::OnTabWndGetParentSizingMargin(
DWORD dwOrientation
) const
{
ASSERT_VALID( this );
switch( dwOrientation )
{
case __ETWS_ORIENT_TOP:
return 3;
case __ETWS_ORIENT_BOTTOM:
return 1;
case __ETWS_ORIENT_LEFT:
return 3;
case __ETWS_ORIENT_RIGHT:
return 1;
default:
ASSERT( FALSE );
return 0;
}
}
LRESULT CExtTabButtonsWnd::OnSizeParent( WPARAM wParam, LPARAM lParam )
{
ASSERT_VALID( this );
return CExtTabWnd::OnSizeParent( wParam, lParam );
}
|
|
Patrick MITTON
|
May 18, 2006 - 2:37 AM
|
In my application I have the same two asserts repeatedly when my application load reg infos with CExtControlBar::ProfileBarStateLoad First one in CExtCustomizeCmdTreeNode::Serialize(....) line 2055 Second one in CExtCustomizeCmdTreeNode::InsertNode(.....) line 2820
When all assert are passed the application load positions correctly
Assert are only when registry is not empty. The same code works perfectly on other application without assert. Any idea of what occurs ?
I use the 2.53 commercial version of prof-uis
|
|
Technical Support
|
May 18, 2006 - 4:04 AM
|
Both lines are assertion failures of this type: ASSERT_KINDOF( CExtCustomizeCmdTreeNode, pNode ); Please let us know what is pNode in both cases. We think that the error with loading the state depends on the customize site initialization which may done incorrectly in your application. Please check this issue. If the problem persists, we will need to take look at your source code: send us your project or the source code of the main frame.
|
|
Patrick MITTON
|
May 18, 2006 - 6:56 AM
|
pnode are CExtCustomizeCmdTreeNode objects. What kind of corect initialisation should I do on customize site ?
This is my oncreate method where I load registry (my mainframe sources are very long): int CMainFrame::OnCreate(LPCREATESTRUCT lpCreateStruct) { if (CMyMDIFrameWndSizeDock::OnCreate(lpCreateStruct) == -1) return -1; CWinApp * pApp = ::AfxGetApp(); ASSERT( pApp != NULL ); ASSERT( pApp->m_pszRegistryKey != NULL ); ASSERT( pApp->m_pszRegistryKey[0] != _T(’\0’) ); ASSERT( pApp->m_pszProfileName != NULL ); ASSERT( pApp->m_pszProfileName[0] != _T(’\0’) );
ASSERT( pApp->m_pszProfileName != NULL );
g_CmdManager->ProfileSetup(pApp->m_pszProfileName,GetSafeHwnd()); VERIFY(g_CmdManager->UpdateFromMenu(pApp->m_pszProfileName, IDR_MAINFRAME));
LitInfosFenetre();
m_wndMenuBar.SetMdiWindowPopupName( _T("Window") ); if(!m_wndMenuBar.Create(_T("Menu"), this, ID_MENUBAR1)) { TRACE0("Failed to create menubar\n"); return -1; } if (!m_wndToolBar.Create(_T("Général"),this,ID_TOOLBAR1) || !m_wndToolBar.LoadToolBar(IDR_MAINFRAME)) { TRACE0("Failed to create toolbar\n"); return -1; // fail to create }
if (!m_wndControlsBar.Create(_T("Contrôles"),this, ID_TOOLBAR2) || !m_wndControlsBar.LoadToolBar(IDR_TOOLBAR_CONTROLS)) { TRACE0("Failed to create toolbar controls\n"); return -1; // fail to create }
if (!m_wndAlignementBar.Create(_T("Alignements"),this, ID_TOOLBAR3) || !m_wndAlignementBar.LoadToolBar(IDR_TOOLBAR_ALIGNEMENTS)) { TRACE0("Failed to create toolbar alignement\n"); return -1; // fail to create }
if (!m_wndBuildBar.Create(_T("Build"),this, ID_TOOLBAR4) || !m_wndBuildBar.LoadToolBar(IDR_TOOLBAR_BUILD)) { TRACE0("Failed to create toolbar build\n"); return -1; // fail to create }
if (!m_wndAffichageBar.Create(_T("Affichage"),this, ID_TOOLBAR5) || !m_wndAffichageBar.LoadToolBar(IDR_TOOLBAR_AFFICHAGE)) { TRACE0("Failed to create toolbar affichage\n"); return -1; // fail to create }
if (!m_wndParamBar.Create(_T("Paramétrage"),this,ID_TOOLBAR6) || !m_wndParamBar.LoadToolBar(IDR_TOOLBAR_PARAM)) { TRACE0("Failed to create toolbar Param\n"); return -1; // fail to create }
if (!m_wndStatusBar.Create(this) || !m_wndStatusBar.SetIndicators(indicators, sizeof(indicators)/sizeof(UINT))) { TRACE0("Failed to create status bar\n"); return -1; // fail to create } m_wndStatusBar.SetPaneInfo(1, ID_PANE_CURSOR, SBPS_NORMAL, 125);
m_wndMenuBar.EnableDocking(CBRS_ALIGN_ANY); m_wndToolBar.EnableDocking(CBRS_ALIGN_ANY); m_wndControlsBar.EnableDocking(CBRS_ALIGN_ANY); m_wndAlignementBar.EnableDocking(CBRS_ALIGN_ANY); m_wndBuildBar.EnableDocking(CBRS_ALIGN_ANY); m_wndAffichageBar.EnableDocking(CBRS_ALIGN_ANY); m_wndParamBar.EnableDocking(CBRS_ALIGN_ANY);
if( !CExtControlBar::FrameEnableDocking(this) ) { ASSERT( FALSE ); return -1; }
if(!CExtCustomizeSite::EnableCustomization(this, __ECSF_DEFAULT)) { ASSERT( FALSE ); return -1; } CExtCustomizeSite::CategoryUpdate( IDR_MAINFRAME );
CExtCustomizeSite::CategoryMakeAllCmdsUnique(); CExtCustomizeSite::CategoryAppendAllCommands(); CExtCustomizeSite::CategoryAppendNewMenu();
CExtCustomizeSite::CustomizeStateLoad(pApp->m_pszRegistryKey,pApp->m_pszProfileName,pApp->m_pszProfileName); if(!CExtControlBar::ProfileBarStateLoad(this, pApp->m_pszRegistryKey, pApp->m_pszProfileName, pApp->m_pszProfileName, &m_dataFrameWP)) { DockControlBar(&m_wndMenuBar); DockControlBar(&m_wndToolBar); DockControlBar(&m_wndAlignementBar); DockControlBar(&m_wndControlsBar); DockControlBar(&m_wndBuildBar); DockControlBar(&m_wndAffichageBar); DockControlBar(&m_wndParamBar); } g_CmdManager->SerializeState(pApp->m_pszProfileName, pApp->m_pszRegistryKey, pApp->m_pszProfileName, false);
return 0; }
|
|
Technical Support
|
May 18, 2006 - 9:16 AM
|
The following part at the end of the CMainFrame::OnCreateMethod() listed in your message:
if(!CExtCustomizeSite::EnableCustomization(this, __ECSF_DEFAULT))
{
ASSERT( FALSE );
return -1;
}
CExtCustomizeSite::CategoryUpdate( IDR_MAINFRAME );
CExtCustomizeSite::CategoryMakeAllCmdsUnique();
CExtCustomizeSite::CategoryAppendAllCommands();
CExtCustomizeSite::CategoryAppendNewMenu();
CExtCustomizeSite::CustomizeStateLoad(pApp->m_pszRegistryKey,pApp->m_pszProfileName,pApp->m_pszProfileName);
if(!CExtControlBar::ProfileBarStateLoad(this, pApp->m_pszRegistryKey, pApp->m_pszProfileName, pApp->m_pszProfileName, &m_dataFrameWP))
{
DockControlBar(&m_wndMenuBar);
DockControlBar(&m_wndToolBar);
DockControlBar(&m_wndAlignementBar);
DockControlBar(&m_wndControlsBar);
DockControlBar(&m_wndBuildBar);
DockControlBar(&m_wndAffichageBar);
DockControlBar(&m_wndParamBar);
}
g_CmdManager->SerializeState(pApp->m_pszProfileName, pApp->m_pszRegistryKey, pApp->m_pszProfileName, false);
return 0; actually should be replaced with g_CmdManager->SerializeState( // SHOULD BE MOVED UP INTO THIS PLACE
pApp->m_pszProfileName,
pApp->m_pszRegistryKey,
pApp->m_pszProfileName,
false
);
VERIFY( // YOU FORGOT THIS
CExtCustomizeSite::MenuInfoAdd(
this,
_T("Default"),
IDR_MAINFRAME,
true
)
);
VERIFY( // YOU FORGOT THIS
CExtCustomizeSite::MenuInfoLoadAccelTable(
_T("Default"),
IDR_MAINFRAME
)
);
(!CExtCustomizeSite::EnableCustomization(this, __ECSF_DEFAULT))
{
ASSERT( FALSE );
return -1;
}
CExtCustomizeSite::CategoryUpdate( IDR_MAINFRAME );
CExtCustomizeSite::CategoryMakeAllCmdsUnique();
CExtCustomizeSite::CategoryAppendAllCommands();
CExtCustomizeSite::CategoryAppendNewMenu();
CExtCustomizeSite::CustomizeStateLoad(pApp->m_pszRegistryKey,pApp->m_pszProfileName,pApp->m_pszProfileName);
if(!CExtControlBar::ProfileBarStateLoad(this, pApp->m_pszRegistryKey, pApp->m_pszProfileName, pApp->m_pszProfileName, &m_dataFrameWP))
{
DockControlBar(&m_wndMenuBar);
DockControlBar(&m_wndToolBar);
DockControlBar(&m_wndAlignementBar);
DockControlBar(&m_wndControlsBar);
DockControlBar(&m_wndBuildBar);
DockControlBar(&m_wndAffichageBar);
DockControlBar(&m_wndParamBar);
}
g_CmdManager->SerializeState(pApp->m_pszProfileName, pApp->m_pszRegistryKey, pApp->m_pszProfileName, false);
return 0;
|
|
Patrick MITTON
|
May 18, 2006 - 10:05 AM
|
Now with the following code I have news asserts with empty registry in CExtCustomizeSite::MenuInfoAdd and CExtCustomizeSite::EnableCustomizationof my mainframe. News asserts appear in CExtCustomizeSite::CustomizeStateSave my DestroyWindow. When there are information in registry, asserts in CExtCustomizeSite::CustomizeStateLoad are always here.
My new oncreate :
int CMainFrame::OnCreate(LPCREATESTRUCT lpCreateStruct) { if (CMyMDIFrameWndSizeDock::OnCreate(lpCreateStruct) == -1) return -1; CWinApp * pApp = ::AfxGetApp(); ASSERT( pApp != NULL ); ASSERT( pApp->m_pszRegistryKey != NULL ); ASSERT( pApp->m_pszRegistryKey[0] != _T(’\0’) ); ASSERT( pApp->m_pszProfileName != NULL ); ASSERT( pApp->m_pszProfileName[0] != _T(’\0’) ); ASSERT( pApp->m_pszProfileName != NULL ); g_CmdManager->ProfileSetup(pApp->m_pszProfileName,GetSafeHwnd()); VERIFY(g_CmdManager->UpdateFromMenu(pApp->m_pszProfileName, IDR_MAINFRAME)); // LitInfosFenetre(); // m_wndMenuBar.SetMdiWindowPopupName( _T("Window") ); if(!m_wndMenuBar.Create(_T("Menu"), this, ID_MENUBAR1)) { TRACE0("Failed to create menubar\n"); return -1; } if (!m_wndToolBar.Create(_T("Général"),this,ID_TOOLBAR1) || !m_wndToolBar.LoadToolBar(IDR_MAINFRAME)) { TRACE0("Failed to create toolbar\n"); return -1; // fail to create } if (!m_wndControlsBar.Create(_T("Contrôles"),this, ID_TOOLBAR2) || !m_wndControlsBar.LoadToolBar(IDR_TOOLBAR_CONTROLS)) { TRACE0("Failed to create toolbar controls\n"); return -1; // fail to create } if (!m_wndAlignementBar.Create(_T("Alignements"),this, ID_TOOLBAR3) || !m_wndAlignementBar.LoadToolBar(IDR_TOOLBAR_ALIGNEMENTS)) { TRACE0("Failed to create toolbar alignement\n"); return -1; // fail to create } if (!m_wndBuildBar.Create(_T("Build"),this, ID_TOOLBAR4) || !m_wndBuildBar.LoadToolBar(IDR_TOOLBAR_BUILD)) { TRACE0("Failed to create toolbar build\n"); return -1; // fail to create } if (!m_wndAffichageBar.Create(_T("Affichage"),this, ID_TOOLBAR5) || !m_wndAffichageBar.LoadToolBar(IDR_TOOLBAR_AFFICHAGE)) { TRACE0("Failed to create toolbar affichage\n"); return -1; // fail to create } if (!m_wndParamBar.Create(_T("Paramétrage"),this,ID_TOOLBAR6) || !m_wndParamBar.LoadToolBar(IDR_TOOLBAR_PARAM)) { TRACE0("Failed to create toolbar Param\n"); return -1; // fail to create } if (!m_wndStatusBar.Create(this) || !m_wndStatusBar.SetIndicators(indicators, sizeof(indicators)/sizeof(UINT))) { TRACE0("Failed to create status bar\n"); return -1; // fail to create } m_wndStatusBar.SetPaneInfo(1, ID_PANE_CURSOR, SBPS_NORMAL, 125); m_wndMenuBar.EnableDocking(CBRS_ALIGN_ANY); m_wndToolBar.EnableDocking(CBRS_ALIGN_ANY); m_wndControlsBar.EnableDocking(CBRS_ALIGN_ANY); m_wndAlignementBar.EnableDocking(CBRS_ALIGN_ANY); m_wndBuildBar.EnableDocking(CBRS_ALIGN_ANY); m_wndAffichageBar.EnableDocking(CBRS_ALIGN_ANY); m_wndParamBar.EnableDocking(CBRS_ALIGN_ANY); if( !CExtControlBar::FrameEnableDocking(this) ) { ASSERT( FALSE ); return -1; } g_CmdManager->SerializeState(pApp->m_pszProfileName,pApp->m_pszRegistryKey,pApp->m_pszProfileName,false); VERIFY(CExtCustomizeSite::MenuInfoAdd(this,_T("Menu"),IDR_MAINFRAME,true)); VERIFY(CExtCustomizeSite::MenuInfoLoadAccelTable(_T("Menu"),IDR_MAINFRAME)); if(!CExtCustomizeSite::EnableCustomization(this, __ECSF_DEFAULT)) { ASSERT( FALSE ); return -1; } CExtCustomizeSite::CategoryUpdate( IDR_MAINFRAME ); CExtCustomizeSite::CategoryMakeAllCmdsUnique(); CExtCustomizeSite::CategoryAppendAllCommands(); CExtCustomizeSite::CategoryAppendNewMenu(); CExtCustomizeSite::CustomizeStateLoad(pApp->m_pszRegistryKey,pApp->m_pszProfileName,pApp->m_pszProfileName); if(!CExtControlBar::ProfileBarStateLoad(this, pApp->m_pszRegistryKey, pApp->m_pszProfileName, pApp->m_pszProfileName, &m_dataFrameWP)) { DockControlBar(&m_wndMenuBar); DockControlBar(&m_wndToolBar); DockControlBar(&m_wndAlignementBar); DockControlBar(&m_wndControlsBar); DockControlBar(&m_wndBuildBar); DockControlBar(&m_wndAffichageBar); DockControlBar(&m_wndParamBar); } return 0; }
And my DestroyWindow
BOOL CMainFrame::DestroyWindow() { CWinApp * pApp = ::AfxGetApp(); ASSERT( pApp != NULL ); ASSERT( pApp->m_pszRegistryKey != NULL ); ASSERT( pApp->m_pszRegistryKey[0] != _T(’\0’) ); ASSERT( pApp->m_pszProfileName != NULL ); ASSERT( pApp->m_pszProfileName[0] != _T(’\0’) ); VERIFY( CExtCustomizeSite::CustomizeStateSave( pApp->m_pszRegistryKey, pApp->m_pszProfileName, pApp->m_pszProfileName)); VERIFY(CExtControlBar::ProfileBarStateSave(this,pApp->m_pszRegistryKey,pApp->m_pszProfileName,pApp->m_pszProfileName,&m_dataFrameWP)); VERIFY(g_CmdManager->SerializeState(pApp->m_pszProfileName,pApp->m_pszRegistryKey,pApp->m_pszProfileName,true)); g_CmdManager->ProfileWndRemove( GetSafeHwnd() ); return CMyMDIFrameWndSizeDock::DestroyWindow(); }
|
|
Patrick MITTON
|
May 19, 2006 - 9:46 AM
|
Hy,
we found another thing which seem’s corrupted: At CExtCustomizeCmdTreeNode::Serialize(....) line 2055 we found that we have two CRuntimeClass instance with the same m_lpszClassName "CExtCustomizeCmdTreeNode". This is why the ASSERT is launch.
Have you ever seen something like this ? Have you an issue ?
To know: we have a ’big’ project including many dlls whith some linked with profuis
|
|
Technical Support
|
May 20, 2006 - 8:45 AM
|
Your last versions of the CMainFrame::OnCreate() and CMainFrame::DestroyWindow() methods look absolutely correct. Please provide us with more details about your projects which depend on Prof-UIS. Please note, if some of your DLLs are regular DLLs, then they should use RDE configuration(s) of Prof-UIS. The errors described in your post may be caused by regular DLLs which are linked with a non-RDE Prof-UIS configuration. Any regular DLL based on Prof-UIS should have the __PROF_UIS_FOR_REGULAR_DLL symbol defined in the pre-processor settings of the regular DLL project.
|
|
Patrick MITTON
|
May 22, 2006 - 2:02 AM
|
Thanks for your help!
One of my DLL was build without _MBCS and __PROF_UIS_FOR_REGULAR_DLL symbols. So two versions of profuis’s dll were loaded : ProfUIS250n.dll and ProfUIS250m.dll, and I haven’t seen it. Now it’s work perfectly.
|
|
delu qiu
|
May 17, 2006 - 10:38 AM
|
Hi,
I got a problem when I call m_Skin.Load() function to lnstall a xml skin,
here is my code: ------------------------------------------------------------------------ CString strPath = "C:\\Aqua.xml";
ASSERT( ! strPath.IsEmpty() ); CExtPaintManagerSkin * pPM = new CExtPaintManagerSkin; if( ! pPM->m_Skin.Load( LPCTSTR(strPath) ) ) { ::AfxMessageBox( _T("Failed to load initial skin.") ); delete pPM; } else g_PaintManager.InstallPaintManager( pPM ); ------------------------------------------------------------------------
I trace the Load function, and it failed at: --------c:\.......\VC98\Include\COMIP.H------------------------------ hr = CoCreateInstance(rclsid, pOuter, dwClsContext, __uuidof(IUnknown),
reinterpret_cast<void**>(&pIUnknown));
How can I make it work? In addition, I can successfully run the similar sample project
"\Prof-UIS\Samples\Skinable".
Thanks
|
|
Technical Support
|
May 17, 2006 - 11:46 AM
|
Please make sure that you initialized OLE support for the application. This is required for the MSXML parser: BOOL CSkinableApp::InitInstance()
{
...
if( ! ::AfxOleInit() )
{
ASSERT( FALSE );
return FALSE;
}
...
|
|
delu qiu
|
May 17, 2006 - 11:59 AM
|
Thanks,
I add the AfxOleInit to the project
and I got a ’Debug Assertion Failed’ when I trace to below zin ExtSkinItem.cpp -------------------------------------------------------------------------------------------------- try { if( ! _LoadGlyphsCollection( pElement ) ) throw 0; if( ! _LoadNestedCollection( pElement ) ) //’Debug Assertion Failed’ throw 0;
|
|
Technical Support
|
May 18, 2006 - 3:58 AM
|
Please let us know if the Skinable or Pluggable sample applications can load successfully the same XML file. Please also ensure the following: 1) If you want to place the Aqua skin into some folder, you should copy both the Aqua.XML file and the Aqua folder with all the subfolders and .PNG files into your folder. 2) You should use both XML and binary skin files from the same version of Prof-UIS which is used in your application.
|
|
Massimo Germi
|
May 17, 2006 - 4:55 AM
|
Hi, I have two simple questions:
1) How to navigate from first to last item, in a CExtPropertyGridCtrl derived class, to get changes? 2) How to handle user selection without derive a class from CExtPropertyGridCell?
tx a lot
|
|
Technical Support
|
May 18, 2006 - 3:56 AM
|
The CExtPropertyGridCtrl window displays the contents of the tree-like data structure that contains CExtPropertyItem objects. The root object is CExtPropertyStore. Others are CExtPropertyCategory and CExtPropertyValue. You can invoke CExtPropertyItem::IsModified() method of any property item to get the flag indicating whether the property item (or any of its children) is modified. To get the property store which is currently displayed in the property grid control, use the CExtPropertyGridWnd::PropertyStoreGet() method. Please note the returned property store may be combined from several other property stores as it is demonstrated in the PropertyGrid and CompoundProperties samples. The property grid control does not create and does not destroy any property store trees. It simply displays the contents of the currently attached property store. So, you should keep your propery store trees for all the configurable objects in your application independently from the property grid control. You can use a CExtPropertyGridCtrl -derived class and override the CExtPropertyGridCtrl::OnPgcInputComplete() and CExtPropertyGridCtrl::OnPgcResetValue() virtual methods to detect two possible events in the property grid when some propery value gets changed. In both methods you have a pointer to the modified propery value and you do not need to traverse the property store tree. You should override the CExtPropertyGridCtrl::RedrawFocusDependentChildren() method to catch the focus change in the active tree grid window. The CExtPropertyGridCtrl window works as a container for one or more CExtPropertyGridWnd tree grid windows and other optional windows. The property grid control automatically synchronizes the focused propery item in active and all inactive tree grid windows to let the user see the same property item focused when switching between tree grids. The CExtPropertyGridCtrl::RedrawFocusDependentChildren() method is invoked when the focus synchronization complete. If you have a pointer to the CExtPropertyGridCtrl window, then you can get a pointer to the focused property item using the following code: CExtPropertyGridCtrl * pPGC = . . .
CExtPropertyGridWnd * pActiveGrid = pPGC->GetActiveGrid();
if( pActiveGrid == NULL )
return ((CExtPropertyItem*)NULL);
HTREEITEM hTreeItem = pActiveGrid->ItemFocusGet();
if( hTreeItem != NULL )
return ((CExtPropertyItem*)NULL);
CExtPropertyItem * pPropertyItem =
pActiveGrid->PropertyItemFromTreeItem( hTreeItem );
return pPropertyItem;
|
|
Mark Walsen
|
May 15, 2006 - 10:23 PM
|
A CExtButton, child of a CExtControlBar, does not display its text as bold until it has been clicked once. (Then it stays bold forever thereafter.) How can I make the button text to be displayed initially bold, so that there is no changing from normal to bold when it is clicked the first time.
Thanks!
-- Mark
|
|
Technical Support
|
May 16, 2006 - 6:48 AM
|
Would you tell us how you set the button font?
|
|
Mark Walsen
|
May 17, 2006 - 9:59 AM
|
The text is supplied to the CExtButton in its Create() function:
CString strButton = "Add"; rExtButton.Create(strButton, WS_CHILD | WS_VISIBLE | BS_PUSHBUTTON , CRect(0,0,0,0), this, nCtlID);
Cheers -- Mark
|
|
Technical Support
|
May 17, 2006 - 11:49 AM
|
We asked you to show how you set the button font, not text. Anyway, recently we found a bug in the CExtButton class that may cause the problem with the bold font. Please find the following lines in the ExtButton.cpp file: _lf.lfWeight =
( m_nButtonType == BS_DEFPUSHBUTTON )
? FW_BOLD
: FW_NORMAL; And replace them with the following if( m_nButtonType == BS_DEFPUSHBUTTON )
_lf.lfWeight =
(_lf.lfWeight > FW_BOLD)
? _lf.lfWeight
: FW_BOLD; Now you can set a custom font and the weight attribute will not be reset to FW_NORMAL .
|
|
Mark Walsen
|
May 15, 2006 - 10:24 PM
|
(I forgot to set a checkmark next to ’Notify me when I get a reply’.)
|
|
Sungsoo Yoon
|
May 15, 2006 - 8:56 PM
|
Dear
I’d like to change the separator character ’,’ into ’-’ in ExtPropertyValueCompund. In my application I used CExtPropertyGridCtrl to get a name and the number composed like 123456-1234567. In getting a name I tried to get surname and given name separately so I used ExtPropertyValueCompund, not ExtPropertyValue. That is fine! great working. But I got a problem in handling with the number. I also want to get two number separately and display the number like this "123456-1234567" but now it is displed like this "123456, 1234567"
How can I change the separator character? Thanks always for your help.
|
|
Technical Support
|
May 16, 2006 - 9:52 AM
|
The separator string used in the property grid control is taken from the Windows system settings (the list separator). This string is typically one character and depends on the current locale. The property grid’s source code queries the list separator string in many places and there is no easy way to replace it with your preferred separator string. The propery grid uses a resource manager wrapper method to get the locale information including the list separator. So, the easiest way is to implement your own CExtResourceManager -derived class which returns your custom list separator, but this will change the list separators in other Prof-UIS component like the grid cell which displays RGB colors. If this solution is acceptable for you, then you should code your CExtResourceManager -derived class which overrides the CExtResourceManager::GetLocaleInfo() virtual method and returns a custom list separator if the LCType parameter is set to LOCALE_SLIST value.
|
|
delu qiu
|
May 15, 2006 - 3:12 PM
|
Hi,
I place serveral CExtLabel in my dialog, and I setfont for the CExtLabel like below:
--------------------------------------- class CSPSSelection:public CExtNCW < CExtResizableDialog> ....
LOGFONT lf; CFont *pFont; memset(&lf, 0, sizeof(LOGFONT)); lf.lfHeight = 20; lf.lfWeight = 700; lf.lfCharSet = DEFAULT_CHARSET; strcpy(lf.lfFaceName, "Arial"); pFont = CFont::FromHandle(CreateFontIndirect(&lf)); m_staticBig.SetFont (pFont, false); ------------------------------------------------------- but m_staticBig display normal size, What is the way to make it bold?
Thanks
|
|
Technical Support
|
May 16, 2006 - 9:43 AM
|
There is a bug in the CExtLabel class that causes the problem. Please find the CExtLabel::OnDrawLabelText() method and replace the following line: lf.lfWeight = m_bFontBold ? FW_BOLD : FW_NORMAL; with this if( m_bFontBold )
lf.lfWeight =
(lf.lfWeight > FW_BOLD)
? lf.lfWeight
: FW_BOLD; Now you can set a custom font and the weight attribute will not be reset to FW_NORMAL .
|
|
Technical Support
|
May 16, 2006 - 6:42 AM
|
First, you need to set a negative value for the lfHeight attribute: lf.lfHeight = -20; Second, if you just need to make the static bold, you can use the CExtLabel::SetFontBold() method.
|
|
delu qiu
|
May 16, 2006 - 8:47 AM
|
Thank you, It’s works.
By the way, where I can found the help document of SetFontBold? I can’t find it in Prof-UIS Help.
Thanks.
|
|
Technical Support
|
May 16, 2006 - 10:11 AM
|
This method was added recently and it is not yet included in the documentation. The updated documentation will be available soon.
|
|
Il Hwan Jeong
|
May 13, 2006 - 4:13 AM
|
Let me know. How to use property grid with CPropertyPage.
Additionally, I want to hide CExtPropertyGridComboBoxBar and just read serialized binary data from CFile or memory struct without class defined data.
Is it possible?
Or can i use CExtGridWnd on CPropertyPage
class CPartWizardFeaturePage1 : public CPropertyPage, public CExtPropertyItem::IPropertyItemEnumSite { DECLARE_DYNAMIC(CPartWizardFeaturePage1)
public: CPartWizardFeaturePage1(); virtual ~CPartWizardFeaturePage1();
enum { IDD = IDD_DIALOG_PROPERTY_PAGE_1 };
protected: CExtPropertyStore m_PropertyStoreAll; CExtPropertyGridCtrl m_PGC;
void _CombineMixedStoreAll();
virtual void DoDataExchange(CDataExchange* pDX);
DECLARE_MESSAGE_MAP() public: virtual BOOL OnInitDialog();
virtual void SetPropertyGridOption(BOOL bState); virtual void SetPropertyGridComboBoxState(BOOL bState); virtual void SetPropertyGridToolBarState(BOOL bState); virtual void SetPropertyGridHelpBarState(BOOL bState); virtual void SetPropertyGridWndCategorizedState(BOOL bState); virtual void SetPropertyGridWndBackGeoundState(BOOL bState); virtual void SetPropertyGridWndTreeBoxState(BOOL bState); virtual void SetPropertyGridWndSortedCategoryState(BOOL bState); virtual void SetPropertyGridWndFullRowSelectState(BOOL bState); virtual void SetPropertyGridWndFilledTreeBoxState(BOOL bState); virtual void SetPropertyGridWndSortedValueState(BOOL bState); virtual void SetPropertyGridWndGridCellState(BOOL bState); virtual void SetPropertyGridWndSortedGridState(BOOL bState); virtual void SetPropertyGridWndVBStyleState(BOOL bState); virtual void SetPropertyGridWndDrawFocusState(BOOL bState); virtual void SetPropertyGridWndBalloonState(BOOL bState); };
BOOL CPartWizardFeaturePage1::OnInitDialog() { TRACE0("in CPartWizardFeaturePage1::OnInitDialog\n");
m_PropertyStoreAll.NameSet( _T("Analyzer Options") );
_CombineMixedStoreAll();
CExtPropertyGridComboBoxBar * pCombo = STATIC_DOWNCAST( CExtPropertyGridComboBoxBar, m_PGC.GetChildByRTC( RUNTIME_CLASS(CExtPropertyGridComboBoxBar) ) ); ASSERT_VALID( pCombo ); pCombo->PropertyStoreInsert( &m_PropertyStoreAll );
SetPropertyGridOption(FALSE); return TRUE; }
void CPartWizardFeaturePage1::_CombineMixedStoreAll() { m_PropertyStoreAll.ItemRemove(); //ASSERT_VALID( this ); //if( m_pPS != NULL ) // return m_pPS;
CExtPropertyStore * pPS = new CExtPropertyStore;
CExtPropertyCategory * pCategoryLight = new CExtPropertyCategory( _T("Lights") ); //pCategoryWindow->ExpandedSet( false ); //pCategoryLight->DescriptionSet( _T("Light value") ); VERIFY( pPS->ItemInsert( pCategoryLight ) ); /* pCategoryLight->ItemInsert( new CStarButtonProperty_Caption( this ) ); pCategoryLight->ItemInsert( new CStarButtonProperty_Handle( this ) ); */
m_PropertyStoreAll.Combine( pPS );
CExtPropertyGridComboBoxBar * pCombo = STATIC_DOWNCAST( CExtPropertyGridComboBoxBar, m_PGC.GetChildByRTC( RUNTIME_CLASS(CExtPropertyGridComboBoxBar) ) ); if( pCombo == NULL ) return; ASSERT_VALID( pCombo ); if( pCombo->GetCurSel() == 1 ) m_PGC.PropertyStoreSynchronize(); }
|
|
Technical Support
|
May 13, 2006 - 12:47 PM
|
You can certainly use the CExtPropertyGridCtrl window as a child control inside your property page window. Just think about your property page window as though it is a simple dialog window. There are two samples in Prof-UIS where the property grid control is used in the dialog window: PropertyGrid and CompoundProperties. There is a IDD_DIALOG_MAIN dialog template resource in the PropertyGrid sample. The IDC_PROPERTY_GRID_CTRL custom control is used as the property grid control on this dialog. So, insert the same custom control into your property page’s dialog template resource and specify exactly the same properties of the custom control. The CMainDlg class in the PropertyGrid sample application corresponds to the IDD_DIALOG_MAIN dialog template resource. This class is the dialog window, but there is no principal differences between the dialog and the property page. The CMainDlg::m_PGC property is a CExtPropertyGridCtrl window. You should insert the same property into your property page class. Finally, add the following line to the DoDataExchange() virtual method of your property page class as it is done in the CMainDlg::DoDataExchange() method of the PropertyGrid sample: DDX_Control( pDX, IDC_PROPERTY_GRID_CTRL, m_PGC ); Now you should see the propery grid control created correctly inside your property page window and you can initialize it in the OnInitDialog() method. You should use the following code to hide the combo box bar inside the property grid control:
CExtPropertyGridComboBoxBar * pCombo =
STATIC_DOWNCAST(
CExtPropertyGridComboBoxBar,
m_PGC.GetChildByRTC(
RUNTIME_CLASS(CExtPropertyGridComboBoxBar)
)
);
ASSERT_VALID( pCombo );
pCombo->ShowWindow( SW_HIDE );
m_PGC.RecalcLayout(); It is not necessary to use the collection of property stores and the combo box bar. You can keep one property store and attach it to the property grid control using the following code: CExtPropertyStore * pPS = . . .
m_PGC.PropertyStoreSet( pPS );
|
|
John Kiernan
|
May 12, 2006 - 12:39 PM
|
Sorry about such a basic question, but I’ve been searching around everywhere I can’t seem to figure out how to get just a plain static bitmap to work. (i.e. placing a CStatic type bitmap on a dialog)
|
|
Technical Support
|
May 15, 2006 - 1:36 AM
|
You should add the a static bitmap control to your dialog template resource and specify the identifier of a bitmap resource to be displayed in it. This can be done by specifying the properties of the static bitmap control. You can also use the CStatic::SetBitmap() API to assign the bitmap handle to the static control.
|
|
John Kiernan
|
May 15, 2006 - 8:20 AM
|
Yeah, sorry I was a bit vague on my question. I guess my question was really "How do I get a static bitmap to work _correctly_ with Prof-UIS?" If I add a static bitmap normally (Through the VS7.10 GUI) -- The bitmap is there initially but if I minimize the window and restore the window the Bitmap is not re-drawn properly. The static bitmap is the only control that is not based on a Prof-UIS class so I’m guessing I’m not doing something right with the static bitmap.
|
|
Technical Support
|
May 15, 2006 - 10:18 AM
|
We recommend you use the following rules when coding a dialog, especially a resizable dialog: 1) Subclass all common controls with Prof-UIS classes. Use the CExtLabel class for a static bitmap. 2) Specify the WS_CLIPSIBLINGS|WS_CLIPCHILDREN styles in the properties of the dialog template resource. This is required to avoid flickering of popup and child dialogs. 3) If you have a group box window, the CExtGroupBox class should be used for subclassing it and the tab order number of the group box control should be greater than the tab order of any control inside the group box. We may guess the problem described in your message is caused by an incorrect tab order.
|
|
Sergio Buonanno
|
May 12, 2006 - 9:09 AM
|
If have a CExtPageNavigator object with some problems with panes. When I start my application I load a Tree View Control with some favorite items (it looks like Microsoft Outlook) in the top pane (I have 2 panes exactly like Outlook). The problem is that when I load favorites from an external file and the Page Navigator is docked and hidden (Auto hide property of its parent Control Bar set to true) the method ItemRectGet of CExtPageNavigatorWnd::ITEM_PANE_INFO returns 0. It looks like it returns the height of the pane when it was first created not considering that I have changed the height by calling HeightSet further on in my code. When the Page Navigator is shown (auto hide property set to false), it works fine. Any hint?
|
|
Technical Support
|
May 13, 2006 - 12:36 PM
|
The resizable control bar adjusts the size of its child window only when this adjustment is needed. This behavior is implemented for optimization reasons. The auto-hidden control bar is simply a hidden control bar. The window which is sliding out from the grouped auto-hidden tabs is an auto-hide slider and it is not a control bar. The child window of the resizable control bar window is temporarily moved into this auto-hide slider window when it needs to be shown. The child window of the resizable control bar window is moved back into the bar when the auto-hide slider window needs to be hidden. You should not think about the size of the panes inside the page navigator window. These panes may become zero sized if the size of the parent control bar is quite small.
|
|
Sergio Buonanno
|
May 15, 2006 - 2:37 AM
|
I didn’t make myself clear. The problem isn’t the parent Control Bar, the problem is the Page Navigator Control pane. The Page Navigator doesn’t resize the top pane as I’d like when it is hidden, I mean when the parent Control Bar has the auto-hide property set to true (as I told you there are 2 panes in my Page Navigator and their height depends on the number of items displayed in their child Tree View control. Same behavior of MS Outlook) so that, when the User Open the Navigator Control the top pane appears with a wrong height. This in case the Navigator Control top pane’s Tree View control is filled with new items and its height is changed while it’s hidden. All this to just say that any call to CExtPageNavigatorWnd::ITEM_PANE_INFO:::HeightSet(…), when the Page Navigator is hidden does nothing, and when the user open the hidden Page Navigator (hovering on the parent Control Bar’ tab), the top pane appears with the height it was created with and not with the height I set later after loading favorite items from an external file. The pane’s height is set but the pane is not updated before is displayed. If I dock the Navigator Control and I make it visible (I mean auto-hide off) everything works fine, therefore the problem is only when the auto-hide property is true.
|
|
Technical Support
|
May 15, 2006 - 7:54 AM
|
The windows inside resizable bars and inside the page navigator cannot be strongly restricted in size. Please run the PageNavigator sample application and select the Mail page. The Favorite Folders pane inside the Mail page is restricted to have some constant height and contains a static control with the Drag Your Favorite Folders Here text. If you decrease the height of the main frame window, the height of the page navigator window will also be decreased and you can reach the state when the height of the Favorite Folders static gets very small and even equal to zero. The same can occur with the page navigator window inside the resizable control bar window. That is why we do not perform any adjustment of the window size for the windows inside invisible resizable control bars. Any window must be ready to have a zero width and/or height. If some control crashes in these cases and/or restores its state incorrectly, then this control is not bug free. We guess you would like the tab page navigator and its contained windows never have a zero size due to some specific conditions. It is possible to create some container window which is a child of the resizable control bar or dynamic auto-hide slider and parent of the page navigator window. This container window will resize its child page navigator to fit all the container’s client area. If the client area is enough small, then the child page navigator window will be resized to some minimal size. Please let us know whether this solution is acceptable for you?
|
|
Sergio Buonanno
|
May 15, 2006 - 8:18 AM
|
The problem is not the 0 height. The problem is that the Page Navigator’s pane doesn’t adjust its size when its parent Page Navigator control is being displayed (mouse pointer hovers over Control Bar’s tab); it remains with its original height and the height I set by calling CExtPageNavigatorWnd::ITEM_PANE_INFO:HeightSet () is totally ignored. The pane should update its size when is displayed instead it will remain with the height it was created with. If the original height is set to 10 pixels, it will remain so even if I call HeightSet(20). The pane’s height variable is updated but the Page Navigator control’s User Interface isn’t changed even when the user displays the hidden Page Navigator. Instead, if I call CExtPageNavigatorWnd::ITEM_PANE_INFO:::HeightSet(…) with Page Navigator visible, it works just fine, I don’t think this behavior is correct otherwise to change pane’s height (and have the correct visual aspect updated) I must display the Page Navigator, set the new height and then hide the Page Navigator control once again. It must be a way to have the height changed when the Page Novigator control is hidden and visual aspect of the pane updated when the Page Navigator is displayed by the user. Probably I’m doing something wrong somewhere in my code, but why when the Pane is visible haven’t I any problems (using exactly the same height values) ?
|
|
Technical Support
|
May 15, 2006 - 11:46 AM
|
We failed to reproduce the problem with the modified version of the PageNavigator sample and the latest version of Prof-UIS. We sent the details and the sample to you by e-mail.
|
|
Roger Taplin
|
May 10, 2006 - 11:57 PM
|
Is it possible to nest CExtTabPageContainerWnd class objects?
I have created a property-sheet-like dialogue using a CExtTabPageContainerWnd container for several child pages, as in your test_page_sheet example. This works well.
I want to create two grandchild pages within one of the dialogue child pages.
I experimented with creating a second CExtTabPageContainerWnd container (with different ID) in the child page, and inserting two grandchild pages into it with tabs at the bottom rather than the top of the page.
All works well except that the nested tab buttons are not responsive. I’ve not succeeded in detecting messages using Spy++ either.
|
|
Roger Taplin
|
May 11, 2006 - 1:00 AM
|
My mistake.
I created the offending parent page as a property page (IDD_PROPPAGE_LARGE) in the resource editor and then changed the border and clipping styles. I didn’t notice that the page was therefore also created with a Disabled style.
The nested CExtTabPageContainerWnd objects work fine now that that is fixed.
|
|
Offer Har
|
May 9, 2006 - 9:06 AM
|
Hi, I would like to have two sized icons in my application: 1. For toolbars i would like to have a 24x24 icons 2. For menus and tabs, bars etc. i would like to have a 16x16 icons. What is the way to achieve this behavior? Currently, when i change the icons in the toolbar to be 24x24, all icons are 24x24, which does not look good in menus for example. Thanks in advance
|
|
Technical Support
|
May 10, 2006 - 4:36 AM
|
First of all, you should have two toolbar resources (one with 16x16 images and another with 24x24 images) and you should update the command manager from both of them. Second, use two sets of command identifiers for the commands which need images of different sizes in menus and in the toolbar. For example, if you have ID_FILE_NEW in the toolbar and in the menu, divide it into two commands: the ID_FILE_NEW_SMALL command, which will be used in menus and in toolbar resource with 16x16 images, the ID_FILE_NEW_LARGE command, which will be used in the toolbar resource with 24x24 images and this resource should be used for the toolbar window. You should use "small" commands to code your application regardless of whether you are using or not using the Visual Studio’s wizard. After you added a command handler or command updating method for the ID_FILE_NEW_SMALL command in some class, you need to add the message map entry for the ID_FILE_NEW_LARGE command manually. The manually added message map entry should refer to the same method.
|
|
delu qiu
|
May 9, 2006 - 9:01 AM
|
Hi,
How to disable and gray a specified button on toolbar?
Thanks
|
|
Technical Support
|
May 10, 2006 - 4:22 AM
|
The toolbar window is based on MFC’s command updating mechanism. Therefore add command updating methods for command buttons in your toolbar and use the CCmdUI::Enable() method for changing command states. If you need a toolbar which is not based on the command updating, use a CExtToolControlBar -derived class which overrides the CExtToolControlBar::OnUpdateCmdUI() virtual method. Your method should have an empty body. This custom toolbar will never update states of its buttons and you have to access the CExtBarButton objects using the CExtToolControlBar::GetButtonsCount() and CExtToolControlBar::GetButton() methods. The state of each CExtBarButton object can be changed if you apply or remove the TBBS_DISABLED style using the CExtBarButton::ModifyStyle() method. You can get the button styles with the CExtBarButton::GetStyle() method.
|
|
Suhai Gyorgy
|
May 10, 2006 - 1:54 AM
|
As you’d do in any MFC application:
In your MainFrm.h:
afx_msg void OnUpdateMyCommand(CCmdUI* pCmdUI);
In your MainFrm.cpp:
BEGIN_MESSAGE_MAP(CMainFrame, CFrameWnd) ... ON_UPDATE_COMMAND_UI(ID_OF_MY_COMMAND, OnUpdateMyCommand) ... END_MESSAGE_MAP()
void CMainFrame::OnUpdateMyCommand(CCmdUI *pCmdUI) { if ( some_condition ) pCmdUI->Enable(false); else pCmdUI->Enable(true); }
Actually you could put that also in your view class (I think), but usually it’s in MainFrm. And of course this will disable not only the toolbar button, but also the menu entry connected to this ID.
Hope that helps: Chris.
|
|
delu qiu
|
May 12, 2006 - 9:55 AM
|
It’s work perfectly, Thanks a lot.
|
|
delu qiu
|
May 8, 2006 - 12:03 PM
|
Hi,
How to accurately postion an icon on a toolbar, I want to place a icon align right of the toolbar, and place other icons align left.
Thanks
|
|
Technical Support
|
May 10, 2006 - 4:21 AM
|
Simply override the CExtToolControlBar::_RecalcPositions() virtual method. Your method should invoke the parent method and then shift some buttons to the right. Please note that, if there is no room to make all the toolbar buttons visible then some of them at the right side get hidden and available only from the popup menu displayed when you click the chevron button. The last toolbar button is the chevron button, so do not shift to the right. The CExtToolControlBar::GetButtonsCount() , CExtToolControlBar::GetButton() , CExtBarButton::Rect() , and CExtBarButton::SetRect() methods allows you handy for what you need.
|
|
delu qiu
|
May 12, 2006 - 9:59 AM
|
wow, It’s works, thank you.
|
|
delu qiu
|
May 8, 2006 - 8:17 AM
|
Hi,
I am trying to apply Aqua.Skin to a CExtResizableDialog derived dialog, but all CExtButton seems on focus when the dialog be loaded. as the default CExtButton shows a on-focus color with a on-focus rectangle, and other CExtButton shows a on-focus color.
My code like this: class CSPSSelection:public CExtNCW < CExtResizableDialog> { ... }
CSPSSelection::CSPSSelection(CWnd* pParent /*=NULL*/) : CExtNCW < CExtResizableDialog > ( CSPSSelection::IDD,pParent ) { //{{AFX_DATA_INIT(CSPSSelection) //}}AFX_DATA_INIT }
int CSPSSelection::OnCreate(LPCREATESTRUCT lpCreateStruct) { if (CExtResizableDialog::OnCreate(lpCreateStruct) == -1) return -1;
CExtPaintManagerSkin * pPM = new CExtPaintManagerSkin; if( ! pPM->m_Skin.SearchAndLoadSkinFile( _T("Aqua.Skin"), false ) ) { ::AfxMessageBox( _T("Failed to load initial skin.") ); delete pPM; } else g_PaintManager.InstallPaintManager( pPM );
return 0; }
Do I miss something?
Thanks
|
|
Technical Support
|
May 10, 2006 - 3:37 AM
|
The appearance of the button in the focused and hovered states when the Aqua skin is applied is very close to the appearance of the default push button. The default push button is dark under this skin. We may guess all the buttons on your dialog are marked as default buttons. Please check this.
|
|
delu qiu
|
May 12, 2006 - 9:57 AM
|
Just like you said, all the buttons on my dialog are marked as default buttons. It looks fine now, thanks.
|
|
Andrew Nanopoulos
|
May 5, 2006 - 10:08 AM
|
The shadow renderes with garbage for a button drop menu in toolbar on IE under win98, I sent a screen shot to support.
Happens on multiple machines and vid cards/drivers.
|
|
Technical Support
|
May 6, 2006 - 9:18 AM
|
The problems on Windows 98 are caused by using the msimg32.dll library which is buggy on any OS earlier than Windows 2000 and may even throw unhandled exceptions such as memory access violations. Please find the following line in the ExtPaintManager.cpp file: m_hDllMsImg = ::LoadLibrary(_T("msimg32.dll")); Please replace this line with the following two lines: if( m_bIsWin2000orLater )
m_hDllMsImg = ::LoadLibrary(_T("msimg32.dll")); The problems on Windows 98 will gone.
|
|