Subject |
Author |
Date |
|
Nitesh Singh
|
Oct 11, 2006 - 1:00 AM
|
Hi...
I want to add a button on the toolbar of my propertygrid. And when that button is clicked then I want to open a dialog box. Can you please show me that by an example. Thank you.
ALso................ I have mentioned about the painting problem with my propertyGrid. I have sent you the sample project. Please rectify the problem.
|
|
Suhai Gyorgy
|
Oct 11, 2006 - 2:12 AM
|
I can’t try the code just now, but I’d do the followings:
Create a CExtPropertyGridCtrl-derived class and override OnPgcCreateBars method. I can imagine it like this: bool CMyPropertyGridCtrl::OnPgcCreateBars ()
{
CExtPropertyGridCtrl::OnPgcCreateBars();
CExtPropertyGridToolBar * pWnd =
STATIC_DOWNCAST(
CExtPropertyGridToolBar,
GetChildByRTC(RUNTIME_CLASS(CExtPropertyGridToolBar))
);
if( pWnd == NULL )
return;
UINT nCmdID = ID_MY_BTN;
LPCTSTR sToolBarBtnText = _T("Text of my button");
CExtCmdItem * p_cmd = g_CmdManager->CmdGetPtr(g_CmdManager->ProfileNameFromWnd(AfxGetMainWnd()->GetSafeHwnd()), nCmdID);
ASSERT( p_cmd != NULL );
p_cmd->m_sToolbarText = sToolBarBtnText;
HICON hIcon =(HICON)::LoadImage(AfxGetApp()->m_hInstance, MAKEINTRESOURCE( nCmdID ), IMAGE_ICON, 16, 16, 0);
if( hIcon != NULL )
{
VERIFY(g_CmdManager->CmdSetIcon(g_CmdManager->ProfileNameFromWnd(AfxGetMainWnd()->GetSafeHwnd()), nCmdID, hIcon, false));
} // if( hIcon != NULL )
pWnd->InsertButton( -1, nCmdID, NULL );
}
Of course if your button is already in a menu or toolbar and you called g_CmdManager->UpdateFromMenu or g_CmdManager->UpdateFromToolBar for that, you dont need to initialize that CExtCmdItem, just call InsertButton. Now the next thing you need to do is handle the button click. You can do this by overriding OnPgcProcessChildWindowCommand method in your CExtPropertyGridCtrl-derived class. This works much like OnCmdMsg: void CMyPropertyGridCtrl::OnPgcProcessChildWindowCommand(
CWnd * pWndChild,
UINT nID, int nCode,
void * pExtra,
AFX_CMDHANDLERINFO * pHandlerInfo
)
{
if( nID == ID_MY_BTN )
{
if ( nCode == CN_COMMAND )
{
CMyDialog dlg;
dlg.DoModal();
}
else if ( nCode == CN_UPDATE_COMMAND_UI )
{
CCmdUI * pCmdUI = (CCmdUI *)pExtra;
ASSERT( pCmdUI != NULL );
pCmdUI->Enable( TRUE );
}
return TRUE;
}
return CExtPropertyGridCtrl::OnPgcProcessChildWindowCommand(pWndChild, nID, nCode, pExtra, pHandlerInfo);
}
I think that should work.
|
|
Suhai Gyorgy
|
Oct 11, 2006 - 3:13 AM
|
Sorry there’s a little bug in my code. You have to register the command in the command manager by calling g_CmdManager->CmdSetup method instead of calling g_CmdManager->CmdGetPtr. if( pWnd == NULL )
return;
UINT nCmdID = ID_MY_BTN;
CExtCmdItem cmd;
cmd.m_nCmdId = nCmdID;
cmd.m_sToolbarText = _T("Text of my button");
VERIFY(g_CmdManager->CmdSetup(g_CmdManager->ProfileNameFromWnd(AfxGetMainWnd()->GetSafeHwnd()), nCmdID, true, NULL));
HICON hIcon =(HICON)::LoadImage(AfxGetApp()->m_hInstance, MAKEINTRESOURCE( nCmdID ), IMAGE_ICON, 16, 16, 0);
if( hIcon != NULL )
{
VERIFY(g_CmdManager->CmdSetIcon(g_CmdManager->ProfileNameFromWnd(AfxGetMainWnd()->GetSafeHwnd()), nCmdID, hIcon, false));
} // if( hIcon != NULL )
|
|
Nitesh Singh
|
Oct 11, 2006 - 3:44 AM
|
Can’t it be done without the help of g_CmdManager ;
actually I am not using g_CmdManager in my application to store the commnads information. I have implemented prop UIS only for the perpose of implementing property grids.
|
|
Nitesh Singh
|
Oct 11, 2006 - 4:46 AM
|
Hi Support...
Please give me a sample example. I am getting some problems and errors. thank you.
|
|
Suhai Gyorgy
|
Oct 12, 2006 - 4:20 AM
|
Unfortunately I can’t think of a way how you could do this without the use of command manager. Actually property grid uses the command manager anyway, you just can’t see that from the outside.
I tested the code that I provided earlier and sadly it’s really not working as it is there. So here’s a fix. I tested it with SimpleProperties1(SingleObject) sample downloadable from the beginning of the article Prof-UIS Property Grid.
In resource.h I added line: #define ID_MY_BTN 1002 In .rc file I added line: ID_MY_BTN ICON "res\\Dial.ico" and of course created a Dial.ico file in res folder of sample.
In SimplePropertiesDlg.h I added: class CMyPropertyGridCtrl : public CExtPropertyGridCtrl
{
virtual bool OnPgcCreateBars();
virtual BOOL OnCmdMsg(UINT nID, int nCode, void* pExtra, AFX_CMDHANDLERINFO* pHandlerInfo);
};
and changed dialog’s CExtPropertyGridCtrl m_PGC; variable to CMyPropertyGridCtrl m_PGC; In SimplePropertiesDlg.cpp file I added:: bool CMyPropertyGridCtrl::OnPgcCreateBars()
{
CExtPropertyGridCtrl::OnPgcCreateBars();
CExtPropertyGridToolBar * pWnd =
STATIC_DOWNCAST(
CExtPropertyGridToolBar,
GetChildByRTC(RUNTIME_CLASS(CExtPropertyGridToolBar))
);
if( pWnd == NULL )
return false;
UINT nCmdID = ID_MY_BTN;
CExtCmdItem cmd;
cmd.m_nCmdID = nCmdID;
//cmd.m_sToolbarText = _T("Text of my button");
VERIFY(g_CmdManager->CmdSetup(g_CmdManager->ProfileNameFromWnd(pWnd->GetSafeHwnd()), nCmdID, true, NULL));
HICON hIcon =(HICON)::LoadImage(AfxGetApp()->m_hInstance, MAKEINTRESOURCE( nCmdID ), IMAGE_ICON, 16, 16, 0);
if( hIcon != NULL )
{
VERIFY(g_CmdManager->CmdSetIcon(g_CmdManager->ProfileNameFromWnd(pWnd->GetSafeHwnd()), nCmdID, hIcon, false));
}
pWnd->InsertButton();
pWnd->InsertButton( -1, nCmdID );
return true;
}
BOOL CMyPropertyGridCtrl::OnCmdMsg(UINT nID, int nCode, void* pExtra, AFX_CMDHANDLERINFO* pHandlerInfo)
{
if( nID == ID_MY_BTN )
{
if ( nCode == CN_COMMAND )
{
AfxMessageBox(_T("Test"));
}
else if ( nCode == CN_UPDATE_COMMAND_UI )
{
CCmdUI * pCmdUI = (CCmdUI *)pExtra;
ASSERT( pCmdUI != NULL );
pCmdUI->Enable( TRUE );
}
return TRUE;
}
return CExtPropertyGridCtrl::OnCmdMsg(nID, nCode, pExtra, pHandlerInfo);
}
So main differences from the first solution: - button click event has to be handled in OnCmdMsg method - ProfileNameFromWnd method has to have the toolbar’s HWND as parameter.
|
|
Nitesh Singh
|
Oct 12, 2006 - 6:52 AM
|
thanks for the help... I am getting button now....
But I want to show TOOLTIPS. I tried like this... ....... UINT nCmdID = ID_MY_BTN; CExtCmdItem cmd; cmd.m_nCmdID = nCmdID;
cmd.m_sTipTool = _T("tooltip for the button"); /// Line added
VERIFY(g_CmdManager->CmdSetup(g_CmdManager->ProfileNameFromWnd(pWnd->GetSafeHwnd()), nCmdID, true, NULL)); .....
But its not working...
.................... Can you please tell me the right term.. Thank you
|
|
Suhai Gyorgy
|
Oct 12, 2006 - 7:37 AM
|
Again, mistake in my code. To set tip write this: cmd.m_sTipTool = _T("Tip of my button");
VERIFY(g_CmdManager->CmdSetup(g_CmdManager->ProfileNameFromWnd(pWnd->GetSafeHwnd()), cmd, true, NULL));
Difference: second parameter of CmdSetup has to be cmd instead of nCmdID.
|
|
Nitesh Singh
|
Oct 12, 2006 - 11:10 PM
|
thanks Suhai.... its working fine now...
|
|
jb lee
|
Oct 11, 2006 - 12:44 AM
|
Hi, Hou do I add a submenu into the existing menu? For example, Between File and Edit menu, I wanna add my custom menu named "ABC" which has some menu items. I made "ABC" menu using resource editor. In MFC, it’a piece of cake. But, I read some writings in this forum that MFC methods not woks.
One more thing, Can I replace an existing menu item with resurce editor generated menu?
TIA.
jb.
|
|
Technical Support
|
Oct 11, 2006 - 10:20 AM
|
|
|
Brett Cook
|
Oct 10, 2006 - 9:51 PM
|
Dear Support,
I have a CExtResizableDialog that I put into a CExtControlBar to allow for docking. The dialog shows up and I am able to dock it, however clicking on any of the controls only acts as if I clicked on the title bar of the control bar. I have followed the example in ProfStudio for the help search dialog as closely as possible.
What must I do to get the controls to respond?
Thanks Brett
|
|
Technical Support
|
Oct 11, 2006 - 10:25 AM
|
We may guess that you have the Disabled property turned on for the dialog template. So, just check this property first.
|
|
Brett Cook
|
Oct 11, 2006 - 10:53 AM
|
Wow, you guys are good. Thanks =).
|
|
Krustys Donuts
|
Oct 10, 2006 - 8:41 AM
|
Hi,
I’m using the following code in my CExtGridWnd-derived class to implement an "invert selection" feature:
long rows = RowCountGet();
long cols = ColumnCountGet();
if( !rows || !cols)
return;
// loop over all rows and add index to set if selected
set<long> selected;
for( long i=0; i<rows; i++) {
if( SelectionGetForCell( 0, i))
selected.insert( i);
}
// clear selections
OnContextDeselectAll();
// now get all selections minus the ones that were previously selected
for( long i=0; i<rows; i++) {
if( selected.find( i) == selected.end()) {
BOOL ret = SelectionSet( CRect( 0, i, cols-1, i), false);
ASSERT( ret);
}
}
Right now, it always selects the last row in the grid, rather than all of the ones set in the loop. If I’m reading the documentation correctly, bReplaceOldAreas should be false to preserve all existing selections, and bReplaceLastArea should be false so that the next selection is appended. I did a simple test by adding 5 lines to my grid, and then calling the following code:
SelectionSet( CRect(0,0,cols-1,1), false);
SelectionSet( CRect(0,3,cols-1,4), false);
This code also just selects the last region, and erases the previous one... I could have sworn this worked in a very early version of Prof-UIS.
|
|
Technical Support
|
Oct 11, 2006 - 12:38 PM
|
We have debugged the CExtGridBaseWnd::SelectionSet() method invocation with the bReplaceOldAreas parameter set to false and the rest parameters having default values. The grid window was configured to subtract selection areas. In this case the CExtGridBaseWnd::SelectionSet() method works like the CExtGridBaseWnd::SelectionInsertAt() method. We can take a look at your project to find out what’s wrong.
|
|
Suhai Gyorgy
|
Oct 10, 2006 - 9:29 AM
|
If your grid has the __EGBS_SUBTRACT_SEL_AREAS style, a simple SelectionInsertAt(-1, CRect(0,0,ColumnCountGet(), RowCountGet())); call solves your whole "invert selection" problem. But if you, for any reason, don’t want that style set, you might want to try calling the SelectionInsertAt method instead of SelectionSet method.
|
|
Krustys Donuts
|
Oct 10, 2006 - 11:36 AM
|
Thanks, the style bit worked! However, I’d still like tech. support to comment on my previous code. It seems like there’s a bug in the framework, but I could be wrong.
|
|
Krustys Donuts
|
Oct 10, 2006 - 9:50 AM
|
Interesting idea! I’ll take a look at that, thanks.
|
|
Suhai Gyorgy
|
Oct 10, 2006 - 6:37 AM
|
Dear Support,
I have to make a window very similar to your FormEditor sample. But I have to do it on a dialog and I have to add a property grid to it as well. Regarding these I have some questions:
- What are the Class names that I have to set for the custom controls on my dialog for the property grid and toolbox window? - I was testing your FormEditor sample, I put a groupbox on the form and after making it quite large, I started making it smaller again. The area of the form where the large groupbox had been before is not painted correctly, not even after window refresh. Is that a bug?
Thank you, Chris
|
|
Suhai Gyorgy
|
Oct 10, 2006 - 7:01 AM
|
One more thing: maybe instead of creating the property grid and toolbox window as custom controls, I could put them in control bars and have them docked. But as I’m reading through your FAQ and articles I have a feeling that control bars can’t be docked inside a dialog. Actually this is very understandable, but I was just thinking I’d rather ask it. So is it possible to dock control bars inside a dialog? If not, what would we the best approach to solve this problem?
|
|
Technical Support
|
Oct 11, 2006 - 11:44 AM
|
You should use the ProfUIS-PropertyGridCtrl window class name for the CExtPropertyGridCtrl control in the dialog and ProfUIS-ToolBoxWnd for CExtToolBoxWnd . Here is the fix for the FormEditor sample: FormEditorView-FIX.
Both Prof-UIS and MFC’s control bars can be redockable only if they are created in the frame window and enabled for redocking. But it is possible to create a CFrameWnd window using the CWnd::Create() method as a child of the CDialog window.
|
|
Chun Pong Lau
|
Oct 10, 2006 - 4:29 AM
|
Dear support,
Can I make a CExtDynamicControlBar unresizable?
Thanks in advance, Alan
|
|
Chun Pong Lau
|
Oct 10, 2006 - 10:16 AM
|
Dear Suhai,
I’ve followed the instructions and thank you, it is true that the control bar is unresizeable. However, there are still two problems to me.
1) the cursor still turns to resizable cursor when it touches the control bars’ borders. Can I keep the cursor unchanged?
2) the border is still a thick one. Can I eliminate the these borders?
Thanks, Alan
|
|
Suhai Gyorgy
|
Oct 10, 2006 - 11:11 AM
|
1) Unfortunately I dont have the code in front of me right now, but if I remember right, I saw a method called _RowCanResizing or similar right around definition of _RowResizingStart method in CExtControlBar.h file. You can try overriding that as well and return false in it. But it is merely a guess.
2) Sorry, I dont have any idea about that one.
|
|
Suhai Gyorgy
|
Oct 10, 2006 - 4:53 AM
|
|
|
Chun Pong Lau
|
Oct 10, 2006 - 2:07 AM
|
Dear support team,
I would like to use your awesome ribbon page to add some UI item there, like some buttons and a textfield, but it seems there are many rules to change the layout. For example, when the space is not enough, it will turn to a collapsed mode and it will expand to use all the space in the ribbon page, it is nice sometimes but it is not in my usage now. Can I get rid of these rules or how can I customize it?
By the way, how should I know when a button or a text field is pressed or entered in the ribbon page?
Thanks, Alan
|
|
Technical Support
|
Oct 11, 2006 - 12:29 PM
|
The ribbon bar and ribbon page windows are derived from the menu bar, which is deribed from the toolbar. So you can handle button clicks in the same way as you handle toolbar/menu commands. Please note that CExtRibbonPage is derived from the CExtCustomizeSite class. This allows you to use text/combo fields (see this feature tour page) which are more feature rich than regular controls and we recommend you user them. You can handle them by overriding virtual methods of the the CExtCustomizeSite class. The CMainFrame class in the StyleEditor customizable sample is derived from the CExtCustomizeSite class and demonstrates how to work with customizable text/combo fields. You can do the same in your class which is derived from CExtRibbonPage /CExtRibbonBar .
|
|
Chun Pong Lau
|
Oct 9, 2006 - 5:15 PM
|
Dear support team,
When I disable context menu by overriding CExtDynamicControlBar::OnInitDbsMenu() by:
bool CMyExtDynamicControlBar::OnInitDbsMenu(CExtPopupMenuWnd * pPopup, HWND hWndTrack, CObject * pHelperSrc, LPARAM lParamHelper){ return false; // disabled right click context menu }
It is true that the context menu does not pop up anymore, but it will cause some annoying flickerings, is there any method to eliminate this?
Thanks, Alan
|
|
Suhai Gyorgy
|
Oct 10, 2006 - 3:07 AM
|
|
|
Chun Pong Lau
|
Oct 16, 2006 - 12:46 PM
|
It works very well. Thank you.
Alan
|
|
Suhai Gyorgy
|
Oct 9, 2006 - 4:16 AM
|
Dear Support,
I have a CExtResizableDialog-derived class which I use for inside a control bar to show some pie-charts on it. Drawing the pie-charts happens when WM_PAINT message is received in WindowProc method. I use some data to find out how many and what way the pie-charts should be drawn. But when the data is empty, I don’t want to show any pie-charts at all.
My problem is that after some charts are already drawn and then I get an empty data, I somehow should clear my dialog to not show anything at all. If I used CWnd, I would just draw a white (COLOR_WINDOW) rect over the whole client area of the window, but when using CExtResizableDialog, this approach would not work, as the background depends on the currently used paint manager. Calling UpdateWindow does nothing, calling Invalidate causes infinite loop.
After all my question is: Is there any method of your paint manager that I could call to redraw the dialog’s background?
Thank you: Chris
|
|
Technical Support
|
Oct 9, 2006 - 7:06 AM
|
There are two options for solving this problem. The first is to use the OnPaint message handler in your dialog class (please note that CClientDC should be used instead of CPaintDC ). The second option is to override the WM_PAINT message in the WindowProc virtual method and paint the background yourself. Here is how it may be done: if( message == WM_PAINT )
{
ASSERT_VALID( this );
CPaintDC dc( this );
if( PmBridge_GetPM()->GetCb2DbTransparentMode(this) )
{
CExtPaintManager::stat_ExcludeChildAreas(
dc,
GetSafeHwnd(),
CExtPaintManager::stat_DefExcludeChildAreaCallback
);
PmBridge_GetPM()->PaintDockerBkgnd( true, dc, this );
}
PmBridge_GetPM()->OnPaintSessionComplete( this );
...
...
...
}
|
|
Suhai Gyorgy
|
Oct 9, 2006 - 7:20 AM
|
In the meanwhile I’ve done a little investigation myself, and tried to solve the problem like this: If I have no data, I call the following: if (GetParent() != NULL) PmBridge_GetPM()->PaintControlBarClientArea(*pDC, wndRect, GetParent());
Is this acceptable solution?
One more question: What’s the difference between using OnPaint message handler and overriding WM_PAINT message in WindowProc?
|
|
Technical Support
|
Oct 9, 2006 - 12:04 PM
|
Actually the PaintControlBarClientArea method does the same thing for the dialog, but it is designed for some additional tasks. There is no big difference between the WM_PAINT message and OnPaint handler. The OnPaint method is called through the message map when the WM_PAINT message is received and you can override this behavior in the WindowProc virtual message as it is done in the CExtWS template (see the WindowProc method).
|
|
Chun Pong Lau
|
Oct 9, 2006 - 12:10 AM
|
Hello support team,
Can I add a button inside a CExtRibbonPage or CExtRibbonBar?
Thanks,
Alan
|
|
Technical Support
|
Oct 9, 2006 - 7:11 AM
|
You should modify the tree data structure that contains CExtCustomizeCmdTreeNode and CExtRibbonNode objects describing buttons and assign it to the ribbon bar or ribbon page using the CExtRibbonBar::SetButtons() or CExtRibbonPage::SetButtons() method. This will make the ribbon bar/page recreate its buttons.
|
|
Eli Kaczer
|
Jan 23, 2007 - 5:52 PM
|
Can you please post an example of how to do this, or email me a sample app that shows a button along with the regular nodes (RibbonPage sample) in the RibbonPage.
|
|
Technical Support
|
Jan 24, 2007 - 12:08 PM
|
|
|
Chun Pong Lau
|
Oct 8, 2006 - 2:47 AM
|
Dear support team,
Is it possible to hide the caption and the border of the "layout group" in Ribbon bar and Ribbon page, and leave the items inside visible?
Thanks in advance, Alan
|
|
Technical Support
|
Oct 9, 2006 - 8:02 AM
|
It is possible to make the ribbon group captions having a zero height but this is not compatible with skinable Office 2007 themes where the ribbon group skin items without captions are not supported.
|
|
Chun Pong Lau
|
Oct 7, 2006 - 5:00 AM
|
Dear support team,
May I know when the documentation of CExtRibbonBar, CExtRibbonPage, CExtRibbonNodeGroup, etc, will be released? They are beautifully made but it’s a bit difficult to release all their potential even though 2 good examples are given.
Regards, Alan
|
|
Technical Support
|
Oct 7, 2006 - 12:37 PM
|
The updated documentation as well as new features will be released aproximatelly at the end of November.
|
|
Chun Pong Lau
|
Oct 6, 2006 - 10:56 AM
|
Hello dear support team,
Thanks for your CExtDynamicControlBar, which is very useful and beautiful. Here are something I would like to do with it in advance.
1) Can I add an icon, 16 x 16 or 32 x 32 to the left side of the gripper (caption) of the CExtDynamicControlBar?
2) Can I change the text style of the caption text, e.g. bold, font-family, text-size, etc?
Thank you in advance, Alan
|
|
Technical Support
|
Oct 7, 2006 - 12:47 PM
|
The size and look of the resizable control bar’s caption are determined by the paint manager. To change the font, you should repaint the caption by overriding the CExtControlBar::DoPaintNC() virtual method.
It is possible to embed an icon into the caption of the control bar but this task is tricky. Each button in the bar’s caption is an instance of the CExtBarNcAreaButton class or a class derived from it. The buttons can be both on the left and on the right side of the caption. You can code a button which ignores mouse clicks and draws an icon. The CMyResizableControlBarInFixedMode class in the FixedSizePanels application may be used as an example (see part of its code which relates to custom buttons in bar’s caption). The CMyResizableControlBarInFixedMode::OnNcAreaButtonsReinitialize() virtual method initializes two custom buttons implemented in the CNcBackForvardNavihationBtn class. These buttons are located on the left side of the caption exactly where you want the icon.
|
|
Gevork Odabashyan
|
Oct 6, 2006 - 4:05 AM
|
Hellow
Please do the following steps in attached sample: 1. Open new dynamic bar ("Create dynamic bar\Bar 1"). Keep in mind it’s floating size. 2. Switch UI profile from Profile 1 to Profile 2 ("Switch Profile\To Profile 2"). 3. Switch UI profile from Profile 2 to Profile 1 ("Switch Profile\To Profile 1"). Check the size of dynamic bar. It’s restored wrong.
|
|
Gevork Odabashyan
|
Oct 6, 2006 - 4:06 AM
|
|
|
Technical Support
|
Oct 6, 2006 - 9:36 AM
|
We received the project and working on the issue now. Thank you.
|
|
Gevork Odabashyan
|
Oct 10, 2006 - 2:44 AM
|
Could you correct this problem as soon as possible? It’s very critical for us now.
|
|
Technical Support
|
Oct 12, 2006 - 11:54 AM
|
We fixed the bug so you can download and use the update from our ftp site. PS We sent you an e-mail but it returned back:
Undeliverable Mail
|
|
Gevork Odabashyan
|
Oct 16, 2006 - 8:36 AM
|
Hellow
I’ve found two problems after this update. The first is that CExtEdit doesn’t respond on keyboard input. The second is that you need to click CExtButton twice to make an action. To illustrate the problems, click Test\Dialog in test sample. The sample foss-test3.rar was sent to support@prof-uis.com.
|
|
Technical Support
|
Oct 17, 2006 - 10:26 AM
|
Thank you for reporting the bug. To fix it, please update this version of the CExtPopupMenuWnd::_EndSequence() overloaded method (../Prof-UIS/Src/ExtPopupMenuWnd.cpp): void CExtPopupMenuWnd::_EndSequence(
UINT nCmdID, // = 0
HWND hWndDeliver // = NULL
)
{
__PROF_UIS_MANAGE_STATE;
ASSERT_VALID( this );
HWND hWndOwn = GetSafeHwnd();
ASSERT( hWndOwn != NULL );
if( (! _IsFadeOutAnimation() )
&& m_ctrlShadow.GetSafeHwnd() != NULL
)
m_ctrlShadow.DestroyWindow();
#ifdef _DEBUG
if( hWndDeliver != NULL )
{
ASSERT( ::IsWindow(hWndDeliver) );
}
#endif
ASSERT( m_hWndCmdReceiver != NULL );
ASSERT( ::IsWindow(m_hWndCmdReceiver) );
CExtPopupMenuSite & _site = GetSite();
UINT * lpnResultCmdID = _site.GetTargetCmdIdPtr();
if( lpnResultCmdID != NULL )
*lpnResultCmdID = nCmdID;
DWORD dwTrackFlags = TrackFlagsGet();
CExtCmdItem * pCmdItem = NULL;
if( nCmdID > 0 && ((dwTrackFlags&TPMX_NO_WM_COMMAND)==0) )
{
pCmdItem =
g_CmdManager->CmdGetPtr(
g_CmdManager->ProfileNameFromWnd( m_hWndCmdReceiver ),
nCmdID
);
}
CExtPopupMenuWnd * pTopPopup = _site.GetInstance();
ASSERT_VALID( pTopPopup );
HWND hWndTopPopup = pTopPopup->GetSafeHwnd();
ASSERT(
hWndTopPopup != NULL
&& ::IsWindow( hWndTopPopup )
);
if( hWndDeliver == NULL )
hWndDeliver = m_hWndCmdReceiver;
CWnd * pTopLevelParent = GetTopLevelParent();
HWND hWndTopLevelParent = pTopLevelParent->GetSafeHwnd();
CRect rcBkUpdate( 0, 0, 0, 0 );
bool bFadeOut = _IsFadeOutAnimation();
if( ! bFadeOut )
{
CExtPopupMenuWnd * pPopup = this;
for( ; pPopup != NULL; pPopup = pPopup->m_pWndParentMenu )
{
ASSERT_VALID( pPopup );
ASSERT( pPopup->GetSafeHwnd() != NULL );
ASSERT( ::IsWindow( pPopup->GetSafeHwnd() ) );
CRect rcPopup;
pPopup->GetWindowRect( &rcPopup );
if( rcBkUpdate.IsRectEmpty() )
rcBkUpdate = rcPopup;
else
{
CRect rcPrev( rcBkUpdate );
rcBkUpdate.UnionRect( &rcPrev, &rcPopup );
}
CExtPopupMenuTipWnd & _tipWnd = pPopup->GetTip();
if( _tipWnd.GetSafeHwnd() != NULL
&& ::IsWindow( _tipWnd.GetSafeHwnd() )
&& _tipWnd.IsWindowVisible()
)
{
CRect rcToolTip;
_tipWnd.GetWindowRect( &rcToolTip );
CRect rcPrev( rcBkUpdate );
rcBkUpdate.UnionRect( &rcPrev, &rcToolTip );
}
pPopup->ShowWindow( SW_HIDE );
}
if( ! g_PaintManager.m_bIsWin2000orLater )
CExtPaintManager::stat_PassPaintMessages();
if( !rcBkUpdate.IsRectEmpty()
&& hWndTopLevelParent != NULL
&& ::IsWindow(hWndTopLevelParent)
)
{
::ScreenToClient(
hWndTopLevelParent, (LPPOINT)&rcBkUpdate);
::ScreenToClient(
hWndTopLevelParent, ((LPPOINT)&rcBkUpdate)+1
);
}
}
if( m_hWndNotifyMenuClosed != NULL
&& ::IsWindow( m_hWndNotifyMenuClosed )
)
::SendMessage(
m_hWndNotifyMenuClosed,
g_nMsgNotifyMenuClosed,
WPARAM(nCmdID),
LPARAM( this )
);
if( ! bFadeOut )
{
if( ::IsWindow( hWndTopPopup ) )
::PostMessage( hWndTopPopup, WM_CLOSE, 0, 0 );
CExtToolControlBar::_CloseCustomMenusAll();
if( CExtToolControlBar::g_bMenuTracking )
CExtToolControlBar::_CloseTrackingMenus();
}
if( ! ::IsWindow( hWndOwn ) )
return;
if( ::IsWindow(hWndDeliver)
&& (! _FindCustomizeMode() )
)
{
if( pCmdItem != NULL )
{
if( (dwTrackFlags&TPMX_NO_WM_COMMAND)==0 )
{
if( ! bFadeOut )
_site.DoneInstance();
VERIFY( pCmdItem->Deliver(hWndDeliver) );
}
}
else
{
if( bFadeOut
&& m_nCurIndex >= 0
&& ItemGetInfo( m_nCurIndex ).IsPopup()
)
{
CExtPopupMenuWnd * pPopup = ItemGetInfo( m_nCurIndex ).GetPopup();
if( pPopup->GetSafeHwnd() != NULL )
{
INT nSaved = pPopup->m_nFadeOutAnimationStepCount;
if( nCmdID == 0 )
pPopup->m_nFadeOutAnimationStepCount = -1;
pPopup->_EndSequence( nCmdID, hWndDeliver );
pPopup->m_nFadeOutAnimationStepCount = nSaved;
return;
}
}
if( (dwTrackFlags&TPMX_NO_WM_COMMAND) == 0
&& nCmdID != 0
)
::PostMessage(
hWndDeliver,
WM_COMMAND,
WPARAM(nCmdID),
0L
);
}
g_SoundPlayer->PlaySound(
CExtSoundPlayer::__ON_MENU_CMD_CLICKED
);
}
if( bFadeOut )
DestroyWindow();
else
_site.DoneInstance();
}
|
|
Gevork Odabashyan
|
Oct 13, 2006 - 9:11 AM
|
I have downloaded the update. It seems all works fine. Thanks for support!
|
|
Technical Support
|
Oct 11, 2006 - 10:41 AM
|
We are still working on this problem and hope to release this fix in two days.
|
|
Chun Pong Lau
|
Oct 5, 2006 - 10:06 AM
|
Dear support team,
Can I dock a ribbon bar, CExtRibbonBar like the way I dock it in CExtDynamicControlBar?
For example, can it be docked in the bottom by a similar method like CExtDynamicControlBar::DockControlBarInnerOuter(..) or inside another control bar like CExtDynamicControlBar::DockControlBarLTRB(..)?
Thanks in advance, Alan
|
|
Technical Support
|
Oct 6, 2006 - 5:23 AM
|
The CExtRibbonBar window is not enabled for redocking via drag-and-drop. Although you can dock it programmatically against the top/bottom side of its parent window, we do not recommend you change ribbon bar’s default top-oriented location because you will lose one of its most important features: integration with the caption area.
|
|
Chun Pong Lau
|
Oct 8, 2006 - 8:19 PM
|
Can you please show me some ideas on how to dock it programmatically?
Regards, Alan
|
|
Technical Support
|
Oct 9, 2006 - 7:59 AM
|
The CExtControlBar::Create() method, which is available both in CExtRibbonBar and in CExtRibbonPage has a parameter dwStyle, which specifies a set of styles. You should replace CBRS_TOP with CBRS_BOTTOM in it. The generic MFC control bar styles can also be accessed and modified using the CControlBar::GetBarStyle() and CControlBar::SetBarStyle() methods. Additionally you should disable the caption integration feature of the ribbon bar by overriding the CExtRibbonPage::RibbonLayout_IsFrameIntegrationEnabled() virtual method and returning false in it. This is essential because in your case the ribbon bar is docked at the bottom of its parent so the ribbon bar should not be integrated with the parent window’s caption at the top.
|
|
Suhai Gyorgy
|
Oct 5, 2006 - 8:32 AM
|
Dear Support,
I have reproduced a - I think - bug in your ProfStudio sample. Please, insert the following line in the OnCmdMsg method of the MainFrame class: BOOL CMainFrame::OnCmdMsg(UINT nID, int nCode, void* pExtra, AFX_CMDHANDLERINFO* pHandlerInfo)
{
if( nCode == CN_COMMAND )
{
#if (!defined __EXT_PROFUIS_STATIC_LINK || defined __EXT_PROFUIS_STATIC_LINK_WITH_RESOURCES)
#ifndef __EXT_MFC_NO_MDI_WINDOWS_LIST_DIALOG
if( nID == ID_WINDOWS_LIST )
{
ShowControlBar(&m_wndSolutionExplorerBar, false, false); // this line added
CExtMdiWindowsListDlg dlg( this );
dlg.DoModal();
return TRUE;
}
#endif // #ifndef __EXT_MFC_NO_MDI_WINDOWS_LIST_DIALOG
#endif // #if (!defined __EXT_PROFUIS_STATIC_LINK || defined __EXT_PROFUIS_STATIC_LINK_WITH_RESOURCES)
}
...
}
Rebuild solution with Static Unicode Release configuration and run application. Grab the three control bars "Class View", "Resource View" and "Solution Explorer" tabbed together, and pull them out of docked state so that they are in a floating MiniFrameWnd. Then close this little window (a needed flag is not set, so all 3 control bars will disappear at once), and from the view menu show again "Solution Explorer" only. So now this control bar is not really in floating state, but rather tabbed together with 2 other hidden control bars. If now I fire the command "Windows..." under "Window" menu ( the one with identifier ID_WINDOWS_LIST ), the "Solution Explorer" control bar should disappear right away, as soon as the ShowControlBar(&m_wndSolutionExplorerBar, false, false); line is called. But the control bar only disappears after I close the appearing CExtMdiWindowsListDlg. To be more specific, the control bar disappears, but the empty MiniFrameWnd can be still seen as long as the CExtMdiWindowsListDlg can be seen. Is this issue fixed in v2.60? If not, could you provide a fix I can insert in my v2.55? Thank you for your help: Chris
|
|
Technical Support
|
Oct 6, 2006 - 5:25 AM
|
Complex groups of floating control bars have delayed behavior in several cases. The case described in your message requires an additional message loop to let the floating palette update its state: . . .
ShowControlBar(&m_wndSolutionExplorerBar, false, false);
CExtPopupMenuWnd::PassMsgLoop( true );
. . .
|
|
Suhai Gyorgy
|
Oct 6, 2006 - 6:10 AM
|
Great, it works nice, thank you!
|
|
Offer Har
|
Oct 5, 2006 - 7:41 AM
|
Dear Support.
Does the Prof-UIS package contains a combo-box control with check-boxed in the dropped list?
Thanks,
Offer.
|
|
Technical Support
|
Oct 6, 2006 - 9:38 AM
|
No, there is no such a control in Prof-UIS. But you can find it here. Just change the base class from CComboBox to CExtComboBox .
|
|
Chun Pong Lau
|
Oct 5, 2006 - 6:54 AM
|
Dear support team,
Is it possible to change the height of a ribbon bar in CExtRibbonBar?
Thanks in advance, Alan
|
|
Chun Pong Lau
|
Oct 6, 2006 - 10:50 AM
|
Yes. This is what I need. Thank you very much!
Alan
|
|
Technical Support
|
Oct 5, 2006 - 9:43 AM
|
You can override the CExtRibbonPage::RibbonLayout_GetGroupHeight() virtual method to change the height of the ribbon group. You can override the CExtRibbonBar::RibbonLayout_GetTabLineHeight() virtual method to change the height of the tab line.
|
|
Chun Pong Lau
|
Oct 5, 2006 - 11:27 AM
|
Thanks for your response but after I added the code in my example as below (which use only 1 CExtRibbonBar) but it have no effect on changing its height.
class CMyExtRibbonBar : public CExtRibbonBar{ INT CMyExtRibbonBar::RibbonLayout_GetTabLineHeight() const { ASSERT_VALID( this ); INT nRetVal = PmBridge_GetPM() ->Ribbon_GetTabLineHeight( this ); nRetVal = 10; // modified return nRetVal; } };
The nRetVal changes from 24 to 10 in my case but it have no effect at all.
What I mean is the size of whole ribbon bar with lightblue gradient color in my UI. Can I change its size in height? Thanks.
Regards, Alan
|
|
Technical Support
|
Oct 6, 2006 - 5:29 AM
|
Please try to add the following method to the CMyRibbonBar class in the RibbonBar sample to see what you need: class CMyRibbonBar : public CExtRibbonBar
{
virtual INT RibbonLayout_GetGroupHeight(
CExtRibbonButtonGroup * pGroupTBB
) const
{
pGroupTBB;
return 300;
}
. . .
|
|
glenn kronick
|
Oct 4, 2006 - 3:52 PM
|
I’m getting an assert in cmdtarg.cpp when trying to click on the menu bar. I think this might be a resource issue. Any ideas?
|
|
Suhai Gyorgy
|
Oct 5, 2006 - 1:54 AM
|
If you link Prof-UIS statically to your application, you need to include Prof-UIS resources as well. You can do that by adding the following lines to your application’s .rc2 file: #if ( !(defined _AFXDLL && !defined __STATPROFUIS_WITH_DLLMFC__) )
#include <Resources/Resource.rc>
#endif
To find out more, read the article How to link statically with Prof-UIS?I hope that helps.
|
|
Gevork Odabashyan
|
Oct 4, 2006 - 11:01 AM
|
Hellow
Imagine we have a dynamic control bar in floating state. When we call CExtDynamicBarSite::BarFreeAll(), destructor of control bar is called at first and then destructor of the dockBar is called. As you know, the code of MFC’s CDockBar is as follows:
CDockBar::~CDockBar() { for (int i = 0; i < m_arrBars.GetSize(); i++) { CControlBar* pBar = GetDockedControlBar(i); if (pBar != NULL && pBar->m_pDockBar == this) pBar->m_pDockBar = NULL; } }
So we use bad pointers in this case. I think it’s a bug. Test sample doesn’t crash at this point, but my application does it from time to time with access violation.
If you need to illustrate calls order, please do these steps in attatched sample: 1. Set breakpoints in ~CExtControlBar() and ~CDockBar(). 2. Open new dynamic bar ("Create dynamic bar\Bar 1") 3. Switch UI profile to Profile 2 ("Switch Profile\To Profile 2"). This will cause the CExtDynamicBarSite::BarFreeAll() call. The sapmple dynamic_bar_sample2.rar was sent to support@prof-uis.com
|
|
Technical Support
|
Oct 5, 2006 - 7:20 AM
|
Thank you for reporting the bug. Please update the source code for the CExtDynamicBarSite::_BarFreeImpl() method in the ExtControlBar.cpp file to fix the bug: void CExtDynamicBarSite::_BarFreeImpl(
CExtDynamicControlBar * pBar,
bool bForceFloatMode,
bool bForceNoOptimizeMode
)
{
ASSERT( this != NULL );
ASSERT_VALID( pBar );
UINT nCmdID = (UINT)pBar->GetDlgCtrlID();
bool bPersistentBar = pBar->IsPersistentBar();
if( pBar->m_pDockSite != NULL && pBar->m_pDockBar != NULL )
{
ASSERT_VALID( pBar->m_pDockSite );
ASSERT_VALID( pBar->m_pDockBar );
HWND hWndChild = pBar->OnQueryChildHWND();
if( hWndChild != NULL && ::IsWindow( hWndChild ) )
{
HWND hWndContainer = ::GetParent( hWndChild );
if( hWndContainer != pBar->m_hWnd )
{
CWnd * pWndPermanent =
CWnd::FromHandlePermanent( hWndContainer );
if( pWndPermanent != NULL )
{
CExtDynamicBarSite::eDetectedUiType_t eDUIT =
GetDetectedUiType();
if( eDUIT == __EDUIT_MDI_ORDINARY
|| eDUIT == __EDUIT_MDI_WITH_TABS
)
{ // if MDI environment
CExtDynamicMDIChildWnd * pWndMdiChild =
DYNAMIC_DOWNCAST(
CExtDynamicMDIChildWnd,
pWndPermanent
);
if( pWndMdiChild != NULL )
{
pWndMdiChild->DestroyWindow();
} // if( pWndMdiChild != NULL )
} // if MDI environment
#if (!defined __EXT_MFC_NO_TAB_PAGECONTAINER_CTRL)
else if( eDUIT == __EDUIT_SDI_TAB_PAGE_CONTAINER )
{ // if SDI tab page container environment
CExtTabPageContainerWnd * pWndTabPageContainer =
DYNAMIC_DOWNCAST(
CExtTabPageContainerWnd,
pWndPermanent
);
if( pWndTabPageContainer != NULL )
{
int nPageCount =
pWndTabPageContainer->PageGetCount();
for( int nPageIdx = 0; nPageIdx < nPageCount; nPageIdx++ )
{
HWND hWnd =
pWndTabPageContainer->PageHwndGetSafe(
nPageIdx
);
if( hWnd == hWndChild )
{
pWndTabPageContainer->
PageRemove( nPageIdx, 1, true );
break;
} // if( hWnd == hWndChild )
} // for( int nPageIdx = 0; nPageIdx < nPageCount; nPageIdx++ )
} // if( pWndTabPageContainer != NULL )
} // if SDI tab page container environment
#endif // (!defined __EXT_MFC_NO_TAB_PAGECONTAINER_CTRL)
} // if( pWndPermanent != NULL )
} // if( hWndContainer != pBar->m_hWnd )
} // if( hWndChild != NULL && ::IsWindow( hWndChild ) )
} // if( pBar->m_pDockSite != NULL && pBar->m_pDockBar != NULL )
if( pBar->m_pDockBar == NULL
|| bForceFloatMode
)
{
CWnd * pWnd = NULL;
if( ! m_mapBars.Lookup( pBar, pWnd ) )
return;
m_mapBars.RemoveKey( pBar );
if( pBar->m_pDockBar != NULL )
{
CMiniDockFrameWnd * pMiniFrame = NULL;
CWnd * pWnd = pBar->GetParentFrame();
if( pWnd != NULL )
{
pMiniFrame =
DYNAMIC_DOWNCAST(
CMiniDockFrameWnd,
pBar->GetDockingFrame()
);
}
int nPos = pBar->m_pDockBar->FindBar( pBar );
if( nPos > 0 )
pBar->m_pDockBar->m_arrBars.RemoveAt( nPos );
CFrameWnd * pDockSite = DockSiteGet();
if( pDockSite->GetSafeHwnd() != NULL )
pDockSite->RemoveControlBar( pBar );
pBar->m_pDockSite = NULL;
pBar->m_pDockBar = NULL;
if( pMiniFrame != NULL )
pMiniFrame->DestroyWindow();
else
pBar->DestroyWindow();
} // if( pBar->m_pDockBar != NULL )
return;
}
ASSERT_VALID( pBar->m_pDockBar );
CFrameWnd * pDockSite = DockSiteGet();
if( pDockSite->GetSafeHwnd() == NULL )
return;
ASSERT_VALID( pDockSite );
ASSERT( pBar->m_pDockSite == pDockSite );
ASSERT(
pDockSite->GetSafeHwnd() != NULL
&& ::IsWindow( pDockSite->GetSafeHwnd() )
);
CWnd * pWnd = NULL;
if( ! m_mapBars.Lookup( pBar, pWnd ) )
return;
CMiniDockFrameWnd * pMiniFrame = NULL;
if( pBar->IsFloating() )
{
pMiniFrame =
DYNAMIC_DOWNCAST(
CMiniDockFrameWnd,
pBar->GetDockingFrame()
);
ASSERT_VALID( pMiniFrame );
} // if( pBar->IsFloating() )
else
{
ASSERT( ! pBar->m_pDockBar->m_bFloating );
#if (!defined __EXT_MFC_NO_TAB_CONTROLBARS)
if( pBar->AutoHideModeGet() )
{
ASSERT_KINDOF( CExtDockBar, pBar->m_pDockBar );
CExtDynAutoHideArea * pWndAutoHideArea =
((CExtDockBar*)pBar->m_pDockBar)->_GetAutoHideArea();
ASSERT_VALID( pWndAutoHideArea );
CExtDynAutoHideSlider * pWndSlider =
pWndAutoHideArea->GetAutoHideSlider();
ASSERT_VALID( pWndSlider );
if( (pWndSlider->GetStyle()&WS_VISIBLE) != 0 )
pWndSlider->SendMessage( WM_CANCELMODE );
pWndAutoHideArea->RemoveControlBar( pBar, true );
} // if( pBar->AutoHideModeGet() )
#endif // (!defined __EXT_MFC_NO_TAB_CONTROLBARS)
if( pBar->m_pDockBar->IsKindOf(RUNTIME_CLASS(CExtDockBar)) )
{
#if (!defined __EXT_MFC_NO_TAB_CONTROLBARS)
if( pBar->m_pDockBar->IsKindOf(RUNTIME_CLASS(CExtDockDynTabBar)) )
{
CExtDynTabControlBar * pTabbedBar =
STATIC_DOWNCAST(
CExtDynTabControlBar,
pBar->m_pDockBar->GetParent()
);
LONG nIdx = pTabbedBar->FindControlBar( pBar );
if( nIdx >= 0 )
{
LONG nSel = pTabbedBar->GetSwitcherSelection();
if( nIdx != nSel )
pTabbedBar->SetSwitcherSelection( nIdx );
pTabbedBar->RemoveSelFromSwitcher();
} // if( nIdx >= 0 )
} // if( pBar->m_pDockBar->IsKindOf(RUNTIME_CLASS(CExtDockDynTabBar)) )
#endif // (!defined __EXT_MFC_NO_TAB_CONTROLBARS)
VERIFY(
((CExtDockBar *)pBar->m_pDockBar)->
RemoveControlBar( pBar, -1, 0, false )
);
}
else
{
VERIFY( pBar->m_pDockBar->RemoveControlBar(pBar) );
}
} // else from if( pBar->IsFloating() )
pDockSite->RemoveControlBar( pBar );
pBar->m_pDockSite = NULL;
INT nPosInDockBar = pBar->m_pDockBar->FindBar( pBar );
if( nPosInDockBar >= 0 )
{
pBar->m_pDockBar->m_arrBars.RemoveAt( nPosInDockBar );
if( nPosInDockBar > 1
&& pBar->m_pDockBar->m_arrBars[ nPosInDockBar - 1 ] == m_pDockSite
)
pBar->m_pDockBar->m_arrBars.RemoveAt( nPosInDockBar - 1 );
}
pBar->m_pDockBar = NULL;
m_mapBars.RemoveKey( pBar );
if( ! bPersistentBar )
OnDbsFreeBarCommandID( nCmdID );
if( pMiniFrame != NULL )
pMiniFrame->DestroyWindow();
else
pBar->DestroyWindow();
if( ! bForceNoOptimizeMode )
CExtDockBar::_OptimizeCircles( pDockSite );
}
|