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 |
|
James Hughes
|
Feb 9, 2004 - 1:57 PM
|
Hi I’m trying to create a child window (custom drawn control) on a window (which happens to the child of another). The parent window is filled with a custom gardient, when I create the child it is always filling in the rectangle in white. I am more than likely be silly here. Both windows are derived from a class which extends CWnd. It handles the WM_ERASEBKGRND & WM_PAINT messages. The WM_PAINT function is defined as follows:
void CSEWnd::OnPaint() {
CRect clientRect;
CPaintDC dcPaint( this);
GetClientRect(clientRect);
CExtMemoryDC dc( &dcPaint, &clientRect ); // Exclude the child areas from repaints
CExtPaintManager::stat_ExcludeChildAreas(
dcPaint.GetSafeHdc(),
GetSafeHwnd()
); // Emulate erase background
DefWindowProc( WM_ERASEBKGND, WPARAM( dc.GetSafeHdc() ), LPARAM(0) ); // Store original colour & modes int nOldBkMode = dc.GetBkMode();
COLORREF crOldTxtColour = dc.GetTextColor();
CExtMemoryDC dcsrc;
dcsrc.CreateCompatibleDC( &dc );
// Call the derived classes OnDraw function
OnDraw( dc, clientRect ); // Restore old colours
dc.SetTextColor( crOldTxtColour );
dc.SetBkMode(nOldBkMode);
}
Any ideas what I am doing wrong here?
Cheers
James Hughes
|
|
Technical Support
|
Feb 10, 2004 - 3:43 AM
|
Dear James,
We believe that the WM_PAINT handler is not the best place to process WM_ERASEBKGND messages. To resolve the problem with an invalid background drawing, please modify the WindowProc method of your control (or alternatively you could modify the handlers of the WM_ERASEBKGND and WM_PAINT messages):
virtual LRESULT WindowProc(
UINT uMsg,
WPARAM wParam,
LPARAM lParam
)
{
if( uMsg == WM_ERASEBKGND )
return (!0);
if( uMsg == WM_PAINT )
{
CRect rcClient;
GetClientRect( &rcClient );
CPaintDC dcPaint( this );
CExtMemoryDC dc( &dcPaint, &rcClient );
bool bTransparentBk = false;
if( g_PaintManager->GetCb2DbTransparentMode(this) )
{
// paint gradient backgroung
CExtPaintManager::stat_ExcludeChildAreas(
dc,
GetSafeHwnd(),
CExtPaintManager::stat_DefExcludeChildAreaCallback
);
if( g_PaintManager->PaintDockerBkgnd( dc, this ) )
bTransparentBk = true;
} // if( g_PaintManager->GetCb2DbTransparentMode(this) )
if( !bTransparentBk )
// paint solid backgroung
dc.FillSolidRect( &rcClient, g_PaintManager->GetColor( CExtPaintManager::CLR_3DFACE_OUT) );
// place your painting code here
// .........
g_PaintManager->OnPaintSessionComplete( this );
return 0;
}
return CWnd::WindowProc(uMsg, wParam, lParam);
}
All should work OK after that.
|
|
Neville Franks
|
Feb 6, 2004 - 10:00 PM
|
Hi, With the following code which I call from a OnRButtonUp() handler I run into problems if the user Right clicks while the menu is up. The Prof-UIS MsgLoop sends me another RightButtonUp and of course I have a problem as my code will try to display the menu again. ie. The code calls itself. I tried adding: TPM_RIGHTBUTTON but this appears to be ignored and I couldn’t find an equivelant TPMX_xx #define. I could add code to my OnRButtonUp() handler to ignore the recursive call but this doesn’t seem like the correct solution, then again maybe it is! I’d prefer a new TPMX_xxx #def that didn’t pass on mouse clicks or kbd msgs to the menu’s parent. Maybe you have another existing solution? DWORD dwTrackFlags = TPMX_DO_MESSAGE_LOOP | TPMX_NO_WM_COMMAND | TPMX_NO_CMD_UI | TPMX_NO_HIDE_RARELY; pPopupWnd->TrackPopupMenu( dwTrackFlags, point.x, point.y, NULL, NULL, NULL, &nResultCmdID ); Thanks, Neville - http://www.surfulater.com
|
|
Technical Support
|
Feb 7, 2004 - 9:16 AM
|
Dear Neville,
The Prof-UIS menu currently allows you to invoke its commands only with the left mouse button - you cannot do this with the right button (nothing happens). Furthermore, if you press down a menu item with the left button and then move away the mouse pointer over to some other window and release the mouse button, then it is that other window which receives the WM_RBUTTONUP message. We believe this behavior is acceptable.
Of course, we would process the right button click over a menu item in such a way that the related command will be invoked. Please let us know whether it is what you mean.
|
|
Neville Franks
|
Feb 8, 2004 - 2:08 PM
|
Hi, I think you misunderstood my problem. I’m not interested in enabling right click to work on menus. My problem is that when a menu is displayed using TrackPopupMenu() with the Flags I mentioned earlier the user can right click "outside" of the menu and my app gets the right click message. In my app right click is used to popup context menus, so now I get a second menu, when the user hasn’t finished with the first one and on it goes. I’m reasonably sure this doesn’t happen with the Win32 API version of TrackPopupMenu() with the TPM_RETURNCMD flag. Is there a way that I can detect if a popup menu is currently displayed? If so I can test this and not popup a second menu. Again not an ideal solution but it would do. Thanks, Neville
|
|
Technical Support
|
Feb 10, 2004 - 9:29 AM
|
Dear Neville, We try to get the behavior you are describing and failed. Please send us a sample application.
|
|
Emil Pop
|
Jan 29, 2004 - 8:08 PM
|
Hi, I try to create a resizable control bar containing a dialog box with several sliders. Everything seems OK in XP and 2K look and feel but for the 2003 look and feel the sliders do not seem to update properly (I e-mailed a snapshot). Is there an issue with the code or am I missing something (control transparency, etc.). Thanks, Emil Gettica Inc.
|
|
Technical Support
|
Feb 2, 2004 - 3:39 AM
|
Dear Emil,
There are two ways to avoid flickering slider controls in resizable windows.
1) Adding the WS_CLIPCHILDREN style to your dialog allows all sliders in the dialog to have their own background. In other words this style clips all other overlapped child windows out of the region of the dialog to be updated. This method is not very good because it causes some other controls (e.g. a static control) to flicker.
2) Repainting the slider control would be much better:
class CCustomPaintedSliderCtrl : public CSliderCtrl
{
protected:
virtual LRESULT WindowProc(
UINT message,
WPARAM wParam,
LPARAM lParam
)
{
ASSERT_VALID( this );
if( message == WM_ERASEBKGND )
return TRUE;
if( message == WM_NCCALCSIZE )
return 0L;
if( message == WM_PAINT )
{
CPaintDC dcPaint( this );
CExtPaintManager::stat_ExcludeChildAreas(
dcPaint.GetSafeHdc(),
GetSafeHwnd()
);
CRect rcClient;
GetClientRect( &rcClient );
CExtMemoryDC dc(
&dcPaint,
&rcClient
);
if( g_PaintManager>GetCb2DbTransparentMode(this) )
g_PaintManager>PaintDockerBkgnd( dc, this );
else
dc.FillSolidRect(
&rcClient,
g_PaintManager->GetColor(
CExtPaintManager::CLR_3DFACE_OUT
)
);
DWORD dwWndStyle = GetStyle();
bool bHorz = ( (dwWndStyle&TBS_VERT) != 0 ) ? false : true;
COLORREF clrFace = g_PaintManager->GetColor( COLOR_3DFACE );
COLORREF clrHilight = g_PaintManager->GetColor( COLOR_3DHILIGHT );
COLORREF clrShadow = g_PaintManager->GetColor( COLOR_3DSHADOW );
CRect rcChannel;
//CSliderCtrl::GetChannelRect( &rcChannel );
rcChannel = rcClient;
CRect rcThumb;
CSliderCtrl::GetThumbRect( &rcThumb );
if( bHorz )
{
rcChannel.top = rcThumb.top;
rcChannel.bottom = rcThumb.bottom;
rcChannel.DeflateRect(
rcThumb.Width(),
( rcChannel.Height() - rcThumb.Width() ) / 2
);
} // if( bHorz )
else
{
rcChannel.left = rcThumb.left;
rcChannel.right = rcThumb.right;
rcChannel.DeflateRect(
( rcChannel.Width() - rcThumb.Height() ) / 2,
rcThumb.Height()
);
} // else from if( bHorz )
dc.FillSolidRect( &rcChannel, clrFace );
dc.Draw3dRect( &rcChannel, clrShadow, clrHilight );
dc.FillSolidRect( &rcThumb, clrFace );
dc.Draw3dRect( &rcThumb, clrHilight, clrShadow );
return TRUE;
} // if( message == WM_PAINT )
LRESULT lResult = CSliderCtrl::WindowProc( message, wParam, lParam );
return lResult;
}
}; // class CCustomPaintedSliderCtrl
You can add the CCustomPaintedSliderCtrl class to your project and use it inside your dialog (instead of CSliderCtrl ). Of course, if a new look of the slider control does not fit your requirements, we can modify it.
|
|
Emil Pop
|
Jan 9, 2004 - 8:04 AM
|
Hi, I experience the following problem: Whenever shadowed menus (CExtPopupMenuWnd::g_bMenuWithShadows = true;) are used in Prof-UIS samples, on some platforms, the menu shadow covers the actual menu. The menu shadow contains a snapshot of the upper left corner of my screen. The pop-up menu is being refreshed only if I hover the mouse over an enabled item of the window. If the pop-up menu contains only disabled items, it will not be refreshed, no matter whether I hover the mouse or not. If I use CExtPopupMenuWnd::g_bMenuWithShadows = false; (the way GLViews project demonstrates) everything seems to be fine. I can provide you with some snapshots if you want to. I would really appreciate your help. Thanks, Emil PS
|
|
Technical Support
|
Jan 12, 2004 - 3:31 AM
|
Dear Emil,
Please send us a screenshot with the distorted shadow and give us more information on which platforms such misbehavior takes place, so that we can find and fix the bug in the shortest time possible.
|
|
Emil Pop
|
Jan 12, 2004 - 11:53 AM
|
Hi, I’ve e-mailed you the snapshots. For the record, - the menus seem to be displayed properly for an instant but they are immediately overwritten by the "shadow" (e.g., the snapshot of the upper-left corner) - the platform used is a Win2K server with Service Pack 4 Build 2195; the only peculiar thing is that my customer uses a dual processor machine. - I built the samples using MS VC 7.1 Build 3088. Emil
|
|
Alexander Bodnarchuk
|
Jan 13, 2004 - 4:44 AM
|
Dear Emil,
We tested all our samples on Windows 2000 Server SP4 installed on Dual Xeon 2.4(+HyperThreading). No problems have been found yet. We sent you an updated version of the GLViews sample. Please test it out on your machine. If the problem persists, send us extra information described in the e-mail.
|
|
Emil Pop
|
Jan 14, 2004 - 6:01 AM
|
Hi, I got your sample but it still has the bad behaviour on my custumer’s machine. It works well on mine though. It looks like the snapshot is not actually the shadow: the menu is properly rendered (including the shadow!); the snapshot of the upper left corner of the screen occurs a few moments later and covers the menu. However, if one looks carefully on the samples I sent you guys, the snapshot is not exactly as big as the shadow! I am using PROFUIS223md.dll. Emil PS Sent also an e-mail.
|
|
Technical Support
|
Jan 15, 2004 - 3:30 AM
|
Dear Emil,
Would you try and run the SDI sample application (comes with the library) whose client area contains an image with the very same shadow as in the menu? We wonder whether the the snapshot of the upper left corner of the screen will appear over this image.
|
|
Emil Pop
|
Jan 15, 2004 - 7:19 AM
|
Hi, I am not really sure what are you asking for. Nevertheless I’ll e-mail you the snapshots with SDI. Please note the first and the last menu do not get overriden (they contain just one menu item). I am not really a GUI person (this is why I bought ProfUIS!) but I was wondering: what if the order in the Z-buffer used in CExtPopupMenuWnd.cpp to render the menu is random? I am talking about SendWindowPos() call at line 6662 and the menu is placed inadvertently under the desktop. Thanks, Emil
|
|
Technical Support
|
Jan 16, 2004 - 11:39 AM
|
Dear Emil,
It seems that the problem is not related to the popup menu window at all. It is the code responsible for painting the compound shadow that probably produces invalid images. You can make sure of this yourself if you pay attention to the image which is drawn in the application’s client area of the SDI sample:
The compound shadow both for this image and for the menu is drawn with the same algorithm. Nevertheles, even if we look at the screenshots with the correctly rendered menu (in the SDI sample application running on the dual machine in question) that you sent to us, we can see that the images with rectangulars in the client area are drawn incorrectly.
To find the cause, we try and code a test application, which we will send to you.
|
|
Emil Pop
|
Jan 21, 2004 - 7:30 PM
|
Hi, Thank you for the testing program you sent. After running it for an hour, the results were random: for rough screen resolutions "Use buffer painting" option worked well but all other combinations generated wrong shadows. However after increasing the resolution to 1280x1024 pixels, I couldn’t get a good behaviour with any combination of options. Switching back to rough resolutions didn’t improve the situation to the initial performance.
The machine has an NVidia card TNT2 Model 64 with 32M of RAM; the latest version of the driver is also installed.
I fixed though the problem by updating Intel’s AGP2PCI driver that monitors the bridge between the video card and the main bus. It was almost two years old. Guys, I apologize for driving you nuts with this issue but I couldn’t figure out faster such an obscure cause and my client was pressing me. I really appreciate your help that was prompt and professional. Regards,
Emil PS
On a side note, Visual Studio .NET installed on the buggy machine didn’t exhibit the shadow problem!
I used Hypercam to take movie snapshots of your testing program and I discovered that all the movies were displaying the upper left corner of the desktop. That was the thing that convinced me that there must be something wrong with the video card.
|
|
Emil Pop
|
Jan 8, 2004 - 8:39 PM
|
Hi, Several examples bundled with the library crash under the following circumstances: assume we have several control bars (CExtControlBar) grouped into two tabbed containers. Now if I drag one container over the other, position the mouse over the tabs of the second container and drop the first container, the application crashes with access violation. This behaviour happens consistently with Server Explorer over Class View containers in ProfStudio project (but there are other cases, as well). Thanks, Emil
|
|
Technical Support
|
Jan 9, 2004 - 7:27 AM
|
Dear Emil, We fixed the bug you reported and are ready to send you a bug free version. Please let us know whether we should provide you with it immediately or you can wait a little until version 2.24 is released (at the end of the month).
|
|
Emil Pop
|
Jan 9, 2004 - 7:53 AM
|
Thanks a lot, If you think you guys can realease by the end of January, I could wait till then. However, if you think you’ll slip after mid-February, I would prefer to get the fix sooner. Cheers, Emil
|
|
Daniel Tiedy
|
Dec 29, 2003 - 1:16 PM
|
Is there a way to safelty toggle on and off the TabMdiWnd at run time?
|
|
Daniel Tiedy
|
Dec 29, 2003 - 3:04 PM
|
I simply Destroy and ReCreate the window and it seems to work find, but I wasn’t sure if there might be ramifications to doing this.
|
|
Technical Support
|
Dec 30, 2003 - 5:27 AM
|
Dear Daniel, If you want to toggle the visibility of the MDI tab window at run time, you should override the OnTabWndSyncVisiblilty() method. Please use CExtTabMdiWnd -derived class like this: class CMyExtTabMdiWnd : public CExtTabMdiWnd
{
public:
void SetVisibility(bool bVisible=true){
m_bVisible = bVisible;
}
protected:
bool m_bVisible:true;
virtual void OnTabWndSyncVisiblilty()
{
ShowWindow( m_bVisible ? SW_SHOW : SW_HIDE );
}
}; // class CMyExtTabMdiWnd After invoking SetVisibility() please do not forget to invoke RecalcLayout() of your frame window.
|
|
Neville Franks
|
Dec 17, 2003 - 1:11 AM
|
Is there any way to get toolbar combo’s drop down list to size horizontally and vertically to fit there content? For example when CMainFrame::OnPopupListBoxInitContent() has finished. This is for lists which are using the default font, not owner draw.
Thanks, Neville
|
|
Technical Support
|
Dec 18, 2003 - 7:21 AM
|
Dear Neville, The OnPopupListBoxInitContent() method just puts items into the list-box. To measure the size of the popup, you should override OnPopupListBoxMeasureTrackSize() . Prof-UIS stores no instances of list-boxes, nor does it keep their item strings. Each list-box is created on-the-fly. So, every time these two methods initialize its contents and size corresponding to the data you provide.
|
|
Neville Franks
|
Dec 16, 2003 - 11:38 PM
|
Hi, I’ve got several toolbar combo’s based on the Style Editor sample app and I want to update the combo current selection (font name/size etc.) as the user moves around in the text. My only problem is getting the combo to redraw efficiently.
I’ve added the following OnUpdatexxx:
void CFMNView::OnUpdateGenericEditRedraw(CCmdUI* pCmdUI) { pCmdUI->Enable( Editing() );
// Force Toolbar Combo to show correct Style. pMainFrame()->CExtCustomizeSite::RedrawCommandItems( pCmdUI->m_nID ); }
which works, however with three toolbar combos (ie. 3 calls to RedrawCommandItems()) it slows down my app considerably. So what is the best, most efficient way of doing this.
I’d also like to only update the respective combo’s if the selection actually needs changing (eg. caret is on text which is a different size to combo).
Thanks, Neville
|
|
Technical Support
|
Dec 18, 2003 - 7:18 AM
|
Dear Neville, The following code seems to be a solution to what you need: CExtCustomizeSite::RedrawCommandItems(nID0, false) CExtCustomizeSite::RedrawCommandItems(nID1, false)
. . . CExtCustomizeSite::RedrawCommandItems(nIDN, false) CExtCustomizeSite::UpdateAllCommandItems() ;
That should increase the speed.
|
|
Neville Franks
|
Dec 10, 2003 - 2:54 PM
|
In my app and the ProfStudio sample if you say use Alt+Backspace in the Profstudio child window or command window after typing some text, when Alt is released, the menu bar is active. ie. Cursor left/right/down all work with the menu. This definitely shouldn’t be happening. The menu bar should only become active if no other key was pressed while the Alt key was down.
|
|
Technical Support
|
Dec 11, 2003 - 2:12 AM
|
Dear Neville,
We have already fixed this bug and will send you the update today.
|
|
Kishore Gagrani
|
Dec 9, 2003 - 6:51 AM
|
I have an application that has customization enabled, and I was wondering how changes to my menus get propagated to the users of my app. I have a 1.0 version of my app that has customization, and in my 1.1 version I want change my menu resources (add some for a new feature, and remove some for a feature that changed). When I run the app, my newly added menu items don’t appear, which I assume is being caused by the customization feature reading in the old menu from the registry. I also get a bunch of asserts when I run in debug mode because the commands being read from the registry no longer exist in the app for the removed menu items. Is there any way I can get around these issues when I ship my new version, apart from clearing the user’s registry entries? Some Visual Studio plug-ins seem to clear the registry and I despise having to recreate all my menus and toolbars again.
|
|
Technical Support
|
Dec 11, 2003 - 2:09 AM
|
Dear Kishore,
The Prof-UIS customization subsystem stores two versions of the menu trees: initial and current (or customized). It is the customized version that is loaded from the registry every time. The menu bar always display the customized version of the menu trees. To reset the menu bar, you need to use the initial version. So, when your new version 1.1 loads its initial menu tree, you should copy it to the current (customized) version of the menu or, in other words, you should reset the menu bar.
First, please get both command trees:
CExtCustomizeSite::CCmdMenuInfo * pMenuInfo =
CExtCustomizeSite::MenuInfoGetByName(
_T("Default") // menu name
);
CExtCustomizeCmdTreeNode * pNodeInitial =
pMenuInfo-> GetNode( true );
CExtCustomizeCmdTreeNode * pNodeCustomized =
pMenuInfo-> GetNode( false );
Then, reset the current menu tree:
(*pNodeCustomized) = (*pNodeInitial);
|
|
Kishore Gagrani
|
Dec 15, 2003 - 7:51 AM
|
Thanks for the response. Where exactly am I supposed to put this code? When I put this code in (see below), I get asserts during ProfileBarStateLoad(). If I put the code after the state loading, I still get an assert when trying to show my main window.
I tried to do the following (during CMainFrame::OnCreate()):
VERIFY(g_CmdManager->ProfileSetup( AfxGetApp()->m_pszProfileName, GetSafeHwnd()));
VERIFY( g_CmdManager->UpdateFromMenu( AfxGetApp()->m_pszProfileName, IDR_MAINFRAME ));
VERIFY( g_CmdManager->UpdateFromMenu( AfxGetApp()->m_pszProfileName, IDR_PROJECT ));
VERIFY( g_CmdManager->UpdateFromToolBar( AfxGetApp()->m_pszProfileName, IDR_FILETOOLBAR ));
VERIFY( g_CmdManager->UpdateFromToolBar( AfxGetApp()->m_pszProfileName, IDR_VIEWTOOLBAR ));
VERIFY( g_CmdManager->UpdateFromToolBar( AfxGetApp()->m_pszProfileName, IDR_TOOLSTOOLBAR ));
VERIFY( g_CmdManager->UpdateFromToolBar( AfxGetApp()->m_pszProfileName, IDR_HELPTOOLBAR ));
VERIFY( CreateMenuBar());
EnableDocking( CBRS_ALIGN_ANY );
VERIFY( CreateFileToolBar());
VERIFY( CreateViewToolBar());
VERIFY( CreateToolsToolBar());
VERIFY( CreateHelpToolBar());
VERIFY( CreateStatusBar());
VERIFY(CExtControlBar::FrameInjectAutoHideAreas( this ));
#if (!defined __EXT_MFC_NO_CUSTOMIZE)
VERIFY( CExtCustomizeSite::MenuInfoAdd( this,
_T("Default"),
IDR_MAINFRAME,
true,
false,
RUNTIME_CLASS( CMainFrame )));
VERIFY( CExtCustomizeSite::MenuInfoAdd( this,
_T("Project"),
IDR_PROJECT,
false,
false,
RUNTIME_CLASS( CProjectFrame ),
RUNTIME_CLASS( CProjectView ),
RUNTIME_CLASS( CProjectDoc )));
VERIFY( CExtCustomizeSite::MenuInfoLoadAccelTable( _T("Default"), IDR_MAINFRAME ));
VERIFY( CExtCustomizeSite::MenuInfoLoadAccelTable( _T("Project"), IDR_PROJECT ));
DWORD dwCustomizeOptions = __ECSF_BARS | __ECSF_COMMANDS | __ECSF_USER_BARS | __ECSF_PARMS;
VERIFY( CExtCustomizeSite::EnableCustomization( this, dwCustomizeOptions) );
CExtCustomizeSite::CategoryUpdate( IDR_MAINFRAME );
CExtCustomizeSite::CategoryUpdate( IDR_PROJECT );
CExtCustomizeSite::CategoryMakeAllCmdsUnique();
CExtCustomizeSite::CategoryAppendAllCommands();
CExtCustomizeSite::CategoryAppendNewMenu();
CExtCustomizeSite::CustomizeStateLoad( AfxGetApp()->m_pszRegistryKey,
AfxGetApp()->m_pszProfileName,
AfxGetApp()->m_pszProfileName );
if (bResetMenus)
{
CExtCustomizeSite::CCmdMenuInfo *pMenuInfo =
CExtCustomizeSite::MenuInfoGetByName( _T("Default" ) );// menu name
CExtCustomizeCmdTreeNode *pNodeInitial;
CExtCustomizeCmdTreeNode *pNodeCustomized;
pNodeInitial = pMenuInfo->GetNode( true );
pNodeCustomized = pMenuInfo->GetNode( false );
(*pNodeCustomized) = (*pNodeInitial);
//reset Project menu
pMenuInfo = CExtCustomizeSite::MenuInfoGetByName( _T("Project" ) );// menu name
pNodeInitial = pMenuInfo->GetNode( true );
pNodeCustomized = pMenuInfo->GetNode( false );
(*pNodeCustomized) = (*pNodeInitial);
}
#endif // (!defined __EXT_MFC_NO_CUSTOMIZE)
if ( !CExtControlBar::ProfileBarStateLoad( this,
AfxGetApp()->m_pszRegistryKey,
AfxGetApp()->m_pszProfileName,
AfxGetApp()->m_pszProfileName,
&m_dataFrameWP ))
{
ResetWorkspace();
}
VERIFY( g_CmdManager->SerializeState( AfxGetApp()->m_pszProfileName,
AfxGetApp()->m_pszRegistryKey,
AfxGetApp()->m_pszProfileName,
FALSE ));
|
|
Technical Support
|
Dec 18, 2003 - 7:13 AM
|
Dear Kishore, Your source code looks OK. We need additional information (i.e. the file name and line number) on the assertion with loading the bar state.
|
|
Kishore Gagrani
|
Dec 9, 2003 - 6:47 AM
|
I have an application that has customization enabled, and I was wondering how changes to my menus get propagated to the users of my app. I have a 1.0 version of my app that has customization, and in my 1.1 version I want change my menu resources (add some for a new feature, and remove some for a feature that changed). When I run the app, my newly added menu items don’t appear, which I assume is being caused by the customization feature reading in the old menu from the registry. I also get a bunch of asserts when I run in debug mode because the commands being read from the registry no longer exist in the app for the removed menu items. Is there any way I can get around these issues when I ship my new version, apart from clearing the user’s registry entries? Some Visual Studio plug-ins seem to clear the registry and I despise having to recreate all my menus and toolbars again.
|
|
Daniel Tiedy
|
Dec 8, 2003 - 3:41 PM
|
I reviewed adding an Edit control to a toolbar, and I understand how it all works and got my own control working great. I need to add a scrollbar to a toolbar as a button now. This scrollbar is used for scrubbing through an animation in a view. This seems to be quite different than the CExtBarTextFieldButton button for the CEdit in only created when the user clicks the button and I would think that the scrollbar would always be created. Do you have any examples that might be close to what I am trying to do?
|
|
Technical Support
|
Dec 9, 2003 - 9:55 AM
|
Dear Daniel,
When in the customization mode, any command item can be dropped on any toolbar or menu. For this purpose, Prof-UIS supports text/combo fields directly. Of course, you can insert the scrollbar control to the CExtBarButton object and make it always visible, but it sends WM_HSCROLL/ WM_VSCROLL messages only to the toolbar it currently belongs to. This makes your task a bit complicated.
To provide you with a ready-to-use solution, we need your opinion. Would be a completely repainted slider-like or scrollbar-like toolbar button appropriate for you? If yes, we could code it and send it to you.
|
|
Daniel Tiedy
|
Dec 9, 2003 - 11:17 AM
|
Yes a repainted scrollbar-like toolbar button would be great if the behavior works the same as if the scrollbar always existed. Thank you so much for your help. Your product is great and I suspect our users will enjoy the new UI features.
|
|
Technical Support
|
Dec 11, 2003 - 2:11 AM
|
Dear Daniel,
The scroll-button is under construction now. We will send you e-mail a few days later.
|
|
Daniel Tiedy
|
Dec 4, 2003 - 2:54 PM
|
I have an CExtCmdItem which is set to StateSetTextField. I assumed I could set the text of the edit field from within a OnUpdateCmdUI using the SetText method. This doesn’t seem to be the correct method for setting the CEdit’s text from within a OnUpdate. Any help would be great.
|
|
LAURA GUGLIELMETTI
|
Jan 10, 2012 - 7:30 AM
|
From a ribbon button OnCommand management I nodified the variable associated to the text. However the text field is not updated until I move mouse away from the button. How can I force text to be redrawn ?
|
|
Technical Support
|
Jan 12, 2012 - 3:04 AM
|
The CExtCustomizeSite::RedrawCommandItems() API should be invoked to repaint ribbon items.
|
|
LAURA GUGLIELMETTI
|
Jan 10, 2012 - 6:25 AM
|
Hello, When I press a ribbon button, I modified the text associated to the control, but the text field is not updated until I move away from the button. Can you please tell me what do I have to call in order to get the text field automatically updated?
|
|
Technical Support
|
Jan 12, 2012 - 3:04 AM
|
The CExtCustomizeSite::RedrawCommandItems() API should be invoked to repaint ribbon items.
|
|
LAURA GUGLIELMETTI
|
Dec 23, 2011 - 7:20 AM
|
Dear Support-team, I have some questions regarding edit management inside Ribbon Page.
I’ve created one, but the height is too small, therefore the text is cut. Moreover I do not understand how to get/set the text inside the EDIT field from code. Thank you in advance for your kind support.
below you can find the part of code that I used to insert it inside the ribbon
CExtRibbonNodeGroup * pRibbonNode_SearchToolGrp = new CExtRibbonNodeToolGroup( ID_RIBBON_TOOL_1 ); pRibbonGroup->InsertNode( NULL, pRibbonNode_SearchToolGrp ); CExtRibbonNodeGroup * pRibbonNode_SearchToolBefore = new CExtRibbonNodeToolGroup( ID_RIBBON_TOOL_1 ); pRibbonNode_SearchToolGrp->InsertNode( NULL, pRibbonNode_SearchToolBefore );
CExtRibbonNode * pNodeFirstRecord = new CExtRibbonNodeToolButton( IDP_FIRST_PIECE); pNodeFirstRecord->CmdKeyTipSet( new CExtCustomizeCmdKeyTip( __EXT_MFC_SAFE_TCHAR( _T(’M’) ) ), false ); pNodeFirstRecord->RibbonILE_RuleArrayGet().RemoveAll(); VERIFY( pNodeFirstRecord->m_iconSmall.m_bmpNormal.LoadBMP_Resource( MAKEINTRESOURCE( IDB_FIRST) ) ); pNodeFirstRecord->m_iconSmall.m_bmpNormal.Make32(); pNodeFirstRecord->m_iconSmall.m_bmpNormal.AlphaColor( RGB(255,0,255), RGB(0,0,0), 0 ); pRibbonNode_SearchToolBefore->InsertNode(NULL,pNodeFirstRecord);
CExtRibbonNode * pNodePrevRecord = new CExtRibbonNodeToolButton( IDP_PREV_PIECE); pNodePrevRecord->CmdKeyTipSet( new CExtCustomizeCmdKeyTip( __EXT_MFC_SAFE_TCHAR( _T(’M’) ) ), false ); pNodePrevRecord->RibbonILE_RuleArrayGet().RemoveAll(); VERIFY( pNodePrevRecord->m_iconSmall.m_bmpNormal.LoadBMP_Resource( MAKEINTRESOURCE( IDB_PREV) ) ); pNodePrevRecord->m_iconSmall.m_bmpNormal.Make32(); pNodePrevRecord->m_iconSmall.m_bmpNormal.AlphaColor( RGB(255,0,255), RGB(0,0,0), 0 ); pRibbonNode_SearchToolBefore->InsertNode(NULL,pNodePrevRecord);
CExtRibbonNodeGroup * pRibbonNode_SearchTool2 = new CExtRibbonNodeToolGroup( ID_RIBBON_TOOL_1 ); pRibbonNode_SearchToolGrp->InsertNode( NULL, pRibbonNode_SearchTool2 );
// CExtRibbonNodeGroup * pRibbonNode_SearchToolGroup = new CExtRibbonNodeToolGroup( ID_RIBBON_TOOL_1 ); // pRibbonNode_SearchTool->InsertNode(NULL, pRibbonNode_SearchToolGroup);
CExtCustomizeCmdTreeNode * pNodeEditSearch = new CExtRibbonNode( IDE_PIECE ); pNodeEditSearch->CmdKeyTipSet( new CExtCustomizeCmdKeyTip( __EXT_MFC_SAFE_LPCTSTR( _T("FF") ) ), false ); pNodeEditSearch->ModifyFlags( __ECTN_TBB_TEXT_FIELD); INT nFontNameFieldWidth = g_PaintManager.GetPM()->UiScalingDo( 50, CExtPaintManager::__EUIST_X ); pNodeEditSearch->TextFieldWidthSet( nFontNameFieldWidth ); pRibbonNode_SearchTool2->InsertNode(NULL, pNodeEditSearch);
Best regards
|
|
Daniel Tiedy
|
Dec 5, 2003 - 11:51 AM
|
From within the OnUpdateCmdUI for my CExtBarTextFieldButton I obtained a pointer to the CExtBarTextFieldButton by using the pCmdUI->m_pOther and the pCmdUI->m_nIndex. From the CExtBarTextFieldButton I call SetFieldText and RedrawButton. This works great, but causes another problem. I can no longer access any menu items because when you click a menu item the OnUpdateCmdUI’s get invoked which causes this particular CExtBarTextFieldButton OnUpdateCmdUI to get envoked which calls SetFieldText which eventually calls CExtCustomizeSite::OnTextFieldInplaceTextSet which cancels any tracked popup menu. Am I going about this correctly?
|
|
Technical Support
|
Dec 9, 2003 - 9:09 AM
|
Dear Daniel,
The CCmdUI::SetText() method can only be used for setting a text string for the menu item. To manage text fields, customized applications should use overridden methods of the CExtCustomizeSite class. To provide any copy of the text field with text data, please override virtual void CExtCustomizeSite::OnTextFieldInplaceTextGet(
const CExtBarTextFieldButton * pTextFieldTBB,
const CExtCustomizeCmdTreeNode * pNode,
CExtSafeString & sTextFieldBuffer
);
To store the result of the edit operation, you should override virtual void CExtCustomizeSite::OnTextFieldInplaceTextSet(
CExtBarTextFieldButton * pTextFieldTBB,
CExtCustomizeCmdTreeNode * pNode,
CExtSafeString & sTextFieldBuffer,
__EXT_MFC_SAFE_LPCTSTR sTextNew
);
Finally, to verify the text input in the in-place active editor, you may also need to override virtual bool CExtCustomizeSite::OnTextFieldVerify(
CExtBarTextFieldButton * pTextFieldTBB,
CExtCustomizeCmdTreeNode * pNode,
__EXT_MFC_SAFE_LPCTSTR sTextOld,
__EXT_MFC_SAFE_LPCTSTR sTextNew
);
|
|
Cyril Chevalier
|
Nov 28, 2003 - 6:37 AM
|
Hi,
Is it possible to use the CExtWFF template with a CRichEditCtrl ? I’ve tried but the text in the control didn’t appear in black. It seems that the character format is white on white. I’ve tried to change the default format with SetDefaultCharFormat without success. When I use the CRichEditCtrl in the same context, the text displays in black.
Thank you for your help.
|
|
Dusan Gibarac
|
Mar 27, 2007 - 3:00 PM
|
I am novice. Where I can read something about CExtWFE, CExtWRB and similar classes/templates?
|
|
Technical Support
|
Mar 28, 2007 - 7:06 AM
|
You can find information about these templates in the documentation.
|
|
Technical Support
|
Dec 1, 2003 - 12:27 AM
|
Dear Cyril,
Undoubtedly you could apply CExtWFF to the rich edit control, but there is no point in this because it is already flicker free.
|
|
Neville Franks
|
Nov 27, 2003 - 5:31 PM
|
I have a problem where CWinApp::OnIdle() and hence my CMyApp::OnIdle() isn’t being called when the mouse is over a docked window, the statusbar, or any menubar or toolbar. If I unpin the docked window so that it can autohide then OnIdle() is called correctly. This is without it hiding. It is also called correctly when the mouse is over my View window.
I can’t see that this problem is peculiar to my code, however I haven’t tried overiding OnIdle() in any of the sample apps.
|
|
Technical Support
|
Dec 1, 2003 - 12:27 AM
|
Dear Neville,
We tried and analyzed the problem you reported by adding the following method to CWinApp derived classes in different Prof-UIS samples. In all cases this method works as it should. If you let us take a look at your source code, we will try to clarify the cause of the problem. virtual BOOL OnIdle( LONG lCount )
{
TRACE1( " --> OnIdle( %ld )\n", lCount );
return TRUE;
}
|
|
Neville Franks
|
Dec 10, 2003 - 2:47 PM
|
I tried this on the ProfStudio sample and it appears to work ok. My app has a view derived from CHtmlView. Maybe this is related to the problem. If I can provide any more information I will.
|
|
Technical Support
|
Dec 11, 2003 - 2:36 AM
|
Dear Neville,
We would suggest to trace your app’s messages with SPY++. Maybe a control inside your HTML view has an activated timer, which leads to the situation when the message queue is always not empty. If it is the point, CWinApp::OnIdle() should not be called.
|
|
Neville Franks
|
Nov 26, 2003 - 1:03 AM
|
Hi, I want to enable icons to be used for menu items for menus used via. TrackPopupMenu(). I understand that if a cmd id for a menu item matches a cmd id on the main toolbar, then its icon will be used. But how do I get icons displayed for other commands. ie. Commands that don’t have an associated toolbar button.
I tried creating a new a toolbar that is never displayed and setup a TOOLBAR resource, but the images aren’t displayed. Do I need to somehow specify that this Toolbar should be used instead of the IDR_MAINFRAME one for specific calls to TrackPopupMenu(). If so how? I don’t want to have to manually code setting icon’s for for each individual menu item.
Thanks. Neville
|
|
Technical Support
|
Nov 26, 2003 - 6:58 AM
|
Dear Neville,
Please verify you have done correctly the following two things:
1) You have invoked g_CmdManager->UpdateFromMenu( . . . , IDR_YOUR_POPUP_MENU ) 2) You have invoked g_CmdManager->UpdateFromToolBar ( . . . , IDR_YOUR_TOOLBAR_FOR_POPUP )
After that, you may create a dynamic instance of the CExtPopupMenuWnd class, invoke its LoadMenu( HWND, IDR_YOUR_POPUP_MENU ) and TrackPopupMenu() methods. The displayed popup menu must have icons corresponding to the buttons in the IDR_YOUR_TOOLBAR_FOR_POPUP toolbar resource.
|
|
Neville Franks
|
Nov 26, 2003 - 12:50 PM
|
Thanks. Adding g_CmdManager->UpdateFromToolBar ( . . . , IDR_YOUR_TOOLBAR_FOR_POPUP ) got things working.
However I didn’t add: g_CmdManager->UpdateFromMenu( . . . , IDR_YOUR_POPUP_MENU ). Do I realy nead to do this for dynamic menus?
Neville
|
|
Technical Support
|
Nov 27, 2003 - 12:44 AM
|
Dear Neville,
We suppose you invokes g_CmdManager->UpdateFromMenu() for the IDR_MAINFRAME resource (or this method is invoked automatically during initialization of the menu bar). In this case, you do not need to call g_CmdManager->UpdateFromMenu(...,IDR_YOUR_POPUP_MENU) if all commands in the IDR_YOUR_POPUP_MENU menu are duplicated in IDR_MAINFRAME . Otherwise, you should.
|
|
Daniel Tiedy
|
Nov 25, 2003 - 4:52 PM
|
Is there a way to use CExtPopupMenuWnd::UpdateFromMenu and have all menu states (Enabled/Disabled) stay as they were in the CMenu class when you call TrackPopupMenu. My software currently has an extensive mechanism set up for enabling and disabling menu items using the CMenu class. Before the menu is displayed I want to convert it to CExtPopupMenuWnd and add some more menu items to it. It all works great except it is expecting CmdUI’s for the commands and it is disabling the menu items. I guess what I am looking for is a way to force enable any command that was enabled in the original CMenu class or SUb Window of the CMenu class when it was passed into UpdateFromMenu.
|
|
Technical Support
|
Nov 26, 2003 - 6:57 AM
|
Dear Daniel,
By default the Prof-UIS popup menu uses MFC’s command updating mechanism. Any command items inserted to the Prof-UIS popup menu by invoking CExtPopupMenuWnd::LoadMenu() or CExtPopupMenuWnd::UpdateFromMenu() should have command descriptions registered in the command manager. These command items are auto-updated via MFC’s CCmdUI -based calls.
You can also insert command items to the Prof-UIS menu without the command manager by invoking CExtPopupMenuWnd::ItemInsertCommand() . It is possible to disable the command updating if you specify the TPMX_NO_CMD_UI flag in CExtPopupMenuWnd::TrackPopupMenu() .
The recursive algorithm of constructing CExtPopupMenuWnd from Win32’s HMENU handle "as is" is not included to the library, but it can be easily coded: 1) use GetMenuItemCount() before the loop that invokes GetMenuItemInfo() for each item and retrieve Win32’s MENUITEMINFO data structure 2) if the fType field of MENUITEMINFO has the MFT_SEPARATOR flag set on, you should insert a separator to the CExtPopupMenuWnd object 3) if the hSubMenu field of MENUITEMINFO is not NULL , you should insert the submenu and make a recursive call of this function 4) the wID field of MENUITEMINFO is a command identifier and you should use it in CExtPopupMenuWnd::ItemInsertCommand()
To setup the properties of a command item, you should get a reference to the CExtPopupMenuWnd::MENUITEMDATA object first. It can be performed by invoking the CExtPopupMenuWnd::ItemGetInfo() method. The nPos parameter of ItemGetInfo() is an index of the inserted command. MENUITEMDATA has two methods: Check(bool) and Radio(bool) .
|
|
Daniel Tiedy
|
Nov 25, 2003 - 4:34 PM
|
How would I approach adding my own derived CEdit class and CScrollBar controls to a toolbar. I see that there is a way with the CommandManager to use StateSetTextField, but can I have custom controls?
|
|
Technical Support
|
Nov 26, 2003 - 6:56 AM
|
Dear Daniel,
Thank you for a good question. The instance of the CExtCustomizeSite class is responsible for creating buttons in toolbars. You can override its OnCreateToolbarButton() method to create your own CExtBarButton -based objects (i.e. toolbar buttons) for any particular command in any toolbar. You may see how CMainFrame::OnCreateToolbarButton() is implemented in the DRAWCLI sample. You need this method to initialize custom text-field buttons or any other buttons in toolbars. Text-field buttons and combo-field buttons are instances of the CExtBarTextFieldButton class. You may code your own class derived from CExtBarTextFieldButton and override OnInplaceControlCreate() to create your specific CEdit inside a toolbar button.
Your task is not typical, but it can be solved with Prof-UIS. If you just need to verify text input in the toolbar’s edit or combo-edit button, you need to override CExtCustomizeSite::OnTextFieldVerify() .
|
|
Cyril Chevalier
|
Nov 21, 2003 - 10:04 AM
|
Hi,
Resizing a CExtEdit control seems to change the way the content of the edit box is drawed: the text is slightly shifted to the right and the bottom of the control. Some letters like g or p are partially cut when it happens. You can test this with your sample ProfUIS_Controls. I tried this on Win98, WinNT and Win2000.
I think the problem comes from the method CExtEdit::OnNcCalcSize. I have changed the line 214 from rc.DeflateRect(4,4) to rc.DeflateRect(1,1) and all works fine.
I don’t know if this behavior is normal or if I made a mistake somewhere when I use the control. Thank you for your help.
|
|
Technical Support
|
Nov 23, 2003 - 4:52 AM
|
Dear Cyril,
CExtEdit only allocates the smallest possible size for its non-client area and paints it. It does not paint the contents of the edit control. So, if there is not enough space for some letters in the edit’s client area, you should increase its height. This also applies to the standard CEdit .
|
|
Cyril Chevalier
|
Nov 24, 2003 - 10:39 AM
|
Hi,
I understand that the CExtEdit control only paint the non client area. But it also drives the size and the position of the non client area when resizing the original size of the control (ie. : the OnNcCalcSize method).
The first display of the control shows a ’normal’ CEdit display position, BUT when you resize the control the Non client area seems to grow up and the client area seems to shrink. Once again, you can see this on your samples. This happens only with CExtEdit, all other controls (like the combo box, for example) are ok. When you put a combo and an edit control side by side, you can see the difference.
Sorry for my bad english. If you want, I can send a mail with some screenshots to show you what I mean.
Thanks for your help and your great library.
|
|
Technical Support
|
Nov 24, 2003 - 10:54 AM
|
OK, we are waiting for your e-mail with the dialog project and screen shot(s) of the edit control. We will try to repeat the edit problem.
|
|
Cyril Chevalier
|
Nov 21, 2003 - 7:59 AM
|
Hi,
I have created a dialog based on CExtResizableDialog, that must self delete when closing (i.e using a ok or a cancel button). So I have overloaded the method PostNcDestroy :
void CMyDlg::PostNcDestroy(void) { CExtResizableDialog::OnNcDestroy(); delete this; }
And then, from the OnOK or OnCancel, I call PostNcDestroy (or DestroyWindow).
But now I have an assertion when I click on one of the button: it seems that the button sends a message to its parent that is already destroyed. Then, the call to CExtControlBar::DoCustomModeUpdateControlBars( this ) in CExtResizableDialog::WindowProc failed (line 123 of ExtResizableDialog.cpp).
I transformed this line in the following way:
if (IsWindow(GetSafeHwnd())){ CExtControlBar::DoCustomModeUpdateControlBars( this ); }
All works ok.
Is there another way to do what I want ? Or am i doing something wrong here ? Thanks for help.
|
|
Technical Support
|
Nov 23, 2003 - 4:51 AM
|
Dear Cyril,
Please do not use the PostNcDestroy() method in the dialog because it is not always invoked by the MFC framework, especially when the dialog is modal. You should use OnOK() and OnCancel() methods instead. These two methods are always invoked before the dialog is destroyed. To destroy dialog, please use the EndDialog() method. For example, if you have a dialog that may be used both as a modal and non-modal window, then the following code can be used:class CTestDlg : public CExtResizableDialog
{
bool m_bMeIsModal:1;
void _PreHandleDestruction();
void _PostHandleDestruction();
public:
CTestDlg( // standard constructor
CWnd* pParent = NULL
);
virtual int DoModal();
virtual BOOL OnInitDialog();
virtual void OnOK();
virtual void OnCancel();
. . .
};
CTestDlg::CTestDlg(CWnd* pParent /*=NULL*/)
: CExtResizableDialog(CTestDlg::IDD, pParent)
, m_bMeIsModal( false )
{
}
BOOL CTestDlg::OnInitDialog()
{
VERIFY( CExtResizableDialog::OnInitDialog() );
// use default profile
// (but you may setup a new profile
// for your dialog here)
g_CmdManager->ProfileWndAdd( NULL, m_hWnd );
CExtResizableDialog::AddAnchor( . . . );
CExtResizableDialog::EnableSaveRestore( . . . );
. . .
return TRUE;
}
int CTestDlg::DoModal()
{
m_bMeIsModal = true;
return CExtResizableDialog::DoModal();
}
void CTestDlg::_PreHandleDestruction()
{
g_CmdManager->ProfileWndRemove( m_hWnd );
}
void CTestDlg::_PostHandleDestruction()
{
if( ! m_bMeIsModal )
delete this;
}
void CTestDlg::OnOK()
{
_PreHandleDestruction();
CExtResizableDialog::OnOK();
_PostHandleDestruction();
}
void CTestDlg::OnCancel()
{
_PreHandleDestruction();
CExtResizableDialog::OnCancel();
_PostHandleDestruction();
}
|
|
Cyril Chevalier
|
Nov 24, 2003 - 6:56 AM
|
Hi,
Thank you for your quick answer. I forgot to say that my dialog box is always non modal. That’s why I use the PostNcDestroy solution as found in MSDN library for this case.
I tried your solution but, I still have the same problem. The program asserts in the debug version. What is weird is that when I launch a debug session with some breakpoints, all works fine.
I think there’s a problem with the window messages. It seems that the OnClick message of the ok or cancel button is processed after the window is actually deleted.
I can send you a more detailled example with source code if you like. Thank you for your help.
|
|
Technical Support
|
Nov 24, 2003 - 10:47 AM
|
Dear Cyril,
the problem is really weird. Dialog window can not receive messages after it was destroyed (including messages sent from its buttons). Yes, please let us take a look at your source code.
|
|
Cyril Chevalier
|
Nov 24, 2003 - 6:47 AM
|
Hi,
Thank you for your quick answer. I forgot to say that my dialog box is always non modal. That’s why I use the PostNcDestroy solution as found in MSDN library for this case.
I tried your solution but, I still have the same problem. The program asserts in the debug version. What is weird is that when I launch a debug session with some breakpoints, all works fine.
I think there’s a problem with the window messages. It seems that the OnClick message of the ok or cancel button is processed after the window is actually deleted.
I can send you a more detailled example with source code if you like. Thank you for your help.
|
|