Subject |
Author |
Date |
|
Thomas Maurer
|
Oct 26, 2005 - 8:22 AM
|
Hello I would like to be notified when the user presses the Enter key in the text box of CExtComboBox (or in CExtComboEditCtrlHook respectively). How can I do that? Thank you Thomas
|
|
Technical Support
|
Oct 26, 2005 - 12:05 PM
|
First of all, please download the updated version of the CExtComboBox class, which is now derived from the new CExtComboBoxBase class. Create a CExtComboBox class and implement the CExtComboBoxBase::OnQueryInnerEditCtrl() virtual method in it. The method should be similar to the original one but return your own CExtComboEditCtrlHook -derived class instance. In your editor, implement the keyboard input handling like you need.
|
|
Thomas Maurer
|
Oct 27, 2005 - 4:45 AM
|
Thank you for the information. I took a quick look and I have the feeling that I would have to implement OnSubclassInnerEdit as well. Am I right? Thomas
|
|
Technical Support
|
Oct 27, 2005 - 1:02 PM
|
You’re absolutely right. Sorry, we forgot about this.
|
|
Dmitriy Dashevskiy
|
Oct 22, 2005 - 9:05 AM
|
I would like to save state of control bars in CChildFrame when it changes, so that when new child is created it will have same layout.
To do it I have to overwrite some functions.
in class derived from CExtControlBar
/*virtual*/ void _DraggingStop( bool bCancel ); //to catch changes in docking layout
/*virtual*/ void _RowResizingStop( bool bCancel ); //to catch resizing when docked by itself
/*virtual*/ void _RowRecalcingStop( bool bCancel ); //to catch resizing within CExtDynControlBars
in class derived from CExtBarNcAreaButtonAutoHide and used in OnNcAreaButtonsReinitialize when creating autohidden buttons for my controlbar and tabbedbar /*virtual*/ bool OnNcAreaClicked( CPoint point ); //to catch when bars are autohidden/restored by user
As I can see from the code Prof-UIS creates two "internal containers" when docking control bars: CExtDynTabControlBar and CExtDynControlBars With CExtDynTabControlBar it is easy: class derived from CExtDynTabControlBar and created on CExtControlBar::g_nMsgCreateTabbedBar message
/*virtual*/ void _DraggingStop( bool bCancel ); //to catch changes in docking layout when controlBars are in tab bar
/*virtual*/ void _RowResizingStop( bool bCancel ); //to catch resizing when controlBars are in tab bar
But there is no message when CExtDynControlBars are created dynamicaly. With such message it will be possible to overwrite needed functions in class derived from CExtDynControlBars and created on CExtControlBar::g_nMsgCreateDynBar message
/*virtual*/ void _RowResizingStop( bool bCancel ); //to catch resizing of dynamic bar
I’ve done some modifications in current version of the library and everything seems to work fine. If you think it is appropriate, could you please add folowing modifications to the library? Thank you in advance. 1. add variable to CExtControlBar
static const UINT g_nMsgCreateDynBar;
const UINT CExtControlBar::g_nMsgCreateDynBar =
::RegisterWindowMessage(
_T("CExtControlBar::g_nMsgCreateDynBar")
);
2. replace in CExtControlBar::_DraggingDoDeepHalfSplit
CExtDynControlBar* pDynBar = new CExtDynControlBar;
with
CExtDynControlBar* pDynBar = NULL;
m_pDockSite->SendMessage(
g_nMsgCreateDynBar,
WPARAM( &pDynBar )
);
#ifdef _DEBUG
if( pDynBar != NULL )
{
ASSERT_VALID( pDynBar );
ASSERT_KINDOF( CExtDynControlBar, pDynBar );
} // if( pDynBar != NULL )
#endif // _DEBUG
if( pDynBar == NULL )
pDynBar = new CExtDynControlBar;
3. replace in CExtDynamicBarHookSink::OnHookWndMsg
#if (!defined __EXT_MFC_NO_TAB_CONTROLBARS)
if( nMessage == CExtControlBar::g_nMsgCreateTabbedBar )
{
lResult = 0L;
CExtDynTabControlBar ** ppTabbedBar =
(CExtDynTabControlBar **)wParam;
ASSERT( ppTabbedBar != NULL );
(*ppTabbedBar) = pDBS->OnDbsCreateTabbedBarInstance();
ASSERT( (*ppTabbedBar) != NULL );
return true;
} // if( nMessage == CExtControlBar::g_nMsgCreateTabbedBar )
#endif // (!defined __EXT_MFC_NO_TAB_CONTROLBARS)
with
#if (!defined __EXT_MFC_NO_TAB_CONTROLBARS)
if( nMessage == CExtControlBar::g_nMsgCreateTabbedBar )
{
lResult = 0L;
CExtDynTabControlBar ** ppTabbedBar =
(CExtDynTabControlBar **)wParam;
ASSERT( ppTabbedBar != NULL );
(*ppTabbedBar) = pDBS->OnDbsCreateTabbedBarInstance();
ASSERT( (*ppTabbedBar) != NULL );
return true;
} // if( nMessage == CExtControlBar::g_nMsgCreateTabbedBar )
#endif // (!defined __EXT_MFC_NO_TAB_CONTROLBARS)
if( nMessage == CExtControlBar::g_nMsgCreateDynBar )
{
lResult = 0L;
CExtDynControlBar ** ppDynBar =
(CExtDynControlBar **)wParam;
ASSERT( ppDynBar != NULL );
(*ppDynBar) = pDBS->OnDbsCreateDynBarInstance();
ASSERT( (*ppDynBar) != NULL );
return true;
} // if( nMessage == CExtControlBar::g_nMsgCreateDynamicBar )
4. replace in CExtControlBar::InternalDockStateBar::StateSet
m_pHelperBar = new CExtDynControlBar;
with
m_pHelperBar = NULL;
pDockSite->SendMessage(
g_nMsgCreateDynBar,
WPARAM( &m_pHelperBar )
);
#ifdef _DEBUG
if( m_pHelperBar != NULL )
{
ASSERT_VALID( m_pHelperBar );
ASSERT_KINDOF( CExtDynControlBar, m_pHelperBar );
} // if( m_pHelperBar != NULL )
#endif // _DEBUG
if( m_pHelperBar == NULL )
m_pHelperBar = new CExtDynControlBar;
5. add to CExtDynamicBarSite class
virtual CExtDynControlBar * OnDbsCreateNewDynBarInstance() const;
CExtDynControlBar * CExtDynamicBarSite::OnDbsCreateNewDynBarInstance() const
{
ASSERT( this != NULL );
return new CExtDynControlBar;
}
|
|
Technical Support
|
Oct 25, 2005 - 6:24 AM
|
It’s not a good idea to save the control bars’ state when the position of some control bar changes. For example, the floating control bar is changing its position during drag-and-drop when the Visual Studio 2005 docking algorithm is used. The state of control bars is defined by a complex, tree-like data structure serialized into the archive. So, we do not recommend you save it each time when the user drag-and-drops some control bar. What you want to implement can be done in a much easier and elegant way: Handle the WM_CREATE message in a CMDIChildWnd -derived class, find any previously created MDI child frame instance of the same type, ask it to save the bar state and continue loading the bar state in the MDI child frame window being created. Your code may look like: int CYourChildFrame::OnCreate(
LPCREATESTRUCT lpCreateStruct
)
{
. . .
// configure everything needed and create all the bars
. . .
// find any other child frame of the same type
HWND hWndMdiClient = ::GetParent( m_hWnd );
HWND hWndMdiChildFrame = ::GetWindow( hWndMdiClient, GW_CHILD );
for( ; hWndMdiChildFrame != NULL;
hWndMdiChildFrame = ::GetWindow( hWndMdiChildFrame, GW_HWNDNEXT ) )
{
if( hWndMdiChildFrame == m_hWnd )
continue;
CWnd * pWnd = CWnd::FromHandlePermanent( hWndMdiChildFrame );
if( pWnd == NULL )
continue;
CYourChildFrame * pOtherFrame =
DYNAMIC_DOWNCAST( CYourChildFrame, CYourChildFrame );
if( pOtherFrame == NULL )
continue;
// ask other frame to save its bar state
pOtherFrame->DoSaveBarState();
break;
}
// continue loading bar state here
. . .
}
|
|
Dmitriy Dashevskiy
|
Oct 25, 2005 - 12:03 PM
|
Yes, saving state only when new window is created (old closed) is faster. But still it is necessary to know what window holds -modified- layout. Say, there are two child windows already created, then one is modified and third one is created. It is possible to get second (nonmodified) one when looking for similar window and save its state. Some flag to know that state has been modified is needed anyway. To get it right it is necessary to handle all possible modification events (resizing and redocking). As was said above it can’t be done externaly without supplying user defined CExtDynControlBar-based class.
|
|
Technical Support
|
Oct 26, 2005 - 7:49 AM
|
A change in the size or position of a resizable control bar window typically affects other control bars and may also affect toolbars. A change in the toolbar position may affect the size of one or more control bars when, for example, a single toolbar docked at the top becomes floating. The notification of a change in a bar of any kind leads to the same notifications to be fired for many other bars. So, we need to additionally think about how to make these notifications convenient and helpful.
|
|
Dmitriy Dashevskiy
|
Oct 22, 2005 - 8:53 AM
|
|
|
Technical Support
|
Oct 24, 2005 - 11:06 AM
|
Please handle the WM_ACTIVATE standard windows message in the main frame window. When the frame becomes inactive, save the array of the dialog control identifiers corresponding to the floating control bars and hide these control bars. When the frame becomes active, show all the saved control bars. The CFrameWnd::m_listControlBars property is the CPtrList , which stores pointers to all the CControlBar objects in the frame window. You need to traverse this list and downcast each of bars to CExtControlBar type. Invoke the GetParentFrame() for each of the CExtControlBar windows. If the parent frame is of the CMiniFrameWnd class, then the bar is floating. To show/hide the bar, use the CFrameWnd::ShowControlBar() method.
|
|
Dmitriy Dashevskiy
|
Oct 25, 2005 - 12:04 PM
|
Thank you or info. As you’ve said in another thread it is possible to disable floating completely. It will be even more appropriate for our application.
|
|
Dmitriy Dashevskiy
|
Oct 22, 2005 - 8:51 AM
|
If I use
m_wndBar.AutoHideModeSet(true, false, true, false);
in OnCreate then bar is created and is auto hidden. Everything seams fine.
But if application is closed (saving state with CExtControlBar::ProfileBarStateSave) and then started again (loading state in OnCreate using CExtControlBar::ProfileBarStateLoad) then autohidden bars are not shown. Same behaviour is with provided Prof-UIS samples (I’ve tried DI_InnerOuterBars).
If instead bars are created not autohidden are are hidden manualy (clicking on autohide button) before closing application then everything works fine.
So, what should be done to create autohidden control bars programmatically?
|
|
Technical Support
|
Oct 24, 2005 - 11:01 AM
|
You may lose the gui state only in case of MDI child windows which are destroyed automatically when the main frame window is closed. In this case, the DestroyWindow() virtual method of your MDI child windows is not invoked and, as a result, the state of the bars is not saved. If our guess is correct, just invoke the DestroyWindow() virtual method for the MDI child from the DestroyWindow() virtual method of the main frame window: BOOL CMainFrame::DestroyWindow()
{
HWND hWndMdiClient = ::GetDlgItem( m_hWnd, AFX_IDW_PANE_FIRST );
if( hWndMdiClient != NULL )
{
HWND hWnd = ::GetWindow( hWndMdiClient, GW_CHILD );
for( ; hWnd != NULL; hWnd = ::GetWindow( hWndMdiClient, GW_CHILD ) )
{
CWnd * pWnd = CWnd::FromHandlePermanent( hWnd );
if( pWnd != NULL )
pWnd->DestroyWindow();
else
::DestroyWindow( hWnd );
} // for( ; hWnd != NULL; hWnd = ::GetWindow( hWndMdiClient, GW_CHILD ) )
} // if( hWndMdiClient != NULL )
. . . If it’s not the case, please provide us with more details.
|
|
Dmitriy Dashevskiy
|
Oct 25, 2005 - 12:19 PM
|
Thanks, but lost state "happens" for CExtControlBars in CMainFrame not in CChildFrame. I was looking more into this and it gets really strange. If I add [PRE] m_wndResizableBar2.AutoHideModeSet(true, false, true, false); [/pre] in CMainFrame::OnCreate (before final RecalcLayout() ) in MDI_InnerOuterBars project then problem described above is present. But doing same thing in CMainFrame::OnCreate in MDI project [pre] m_wndResizableBar0.AutoHideModeSet(true, false, true, false); [/pre] works just fine. Could you please help figure out why.
To see the problem: 1. make mentioned modifications & compile; 2. clean the registry for corresponding application; 3. start program. Now bars docked for first time and everything is fine; 4. close application and start again. Autohidden bar dissapeared in MDI_InnerOuterBars project.
|
|
Technical Support
|
Oct 26, 2005 - 7:38 AM
|
We have found the source of the problem. The CExtControlBar::ProfileBarStateLoad() method makes all the control bars hidden and sets the frame window as their parent window. The CChildFrame::OnCreate() method in the MDI_InnerOuterBars sample should set initial positions of the control bars only if the CExtControlBar::ProfileBarStateLoad() failed to load the control bars’ state. Here is the updated source code for this method: int CChildFrame::OnCreate(LPCREATESTRUCT lpCreateStruct)
{
if (CMDIChildWnd::OnCreate(lpCreateStruct) == -1)
return -1;
ASSERT( m_hChildFrameIcon != NULL );
SetIcon( m_hChildFrameIcon, FALSE );
SetIcon( m_hChildFrameIcon, TRUE );
// create a view to occupy the client area of the frame
if (!m_wndView.Create(NULL, NULL, AFX_WS_DEFAULT_VIEW,
CRect(0, 0, 0, 0), this, AFX_IDW_PANE_FIRST, NULL))
{
TRACE0("Failed to create view window\n");
return -1;
}
if( !m_wndToolbar0.Create(
_T("Child Toolbar 0"),
this,
IDR_TOOLBAR_CHILD0
)
|| !m_wndToolbar0.LoadToolBar(IDR_TOOLBAR_CHILD0)
)
{
TRACE0("Failed to create m_wndToolbar0\n");
return -1; // fail to create
}
if( !m_wndToolbar1.Create(
_T("Child Toolbar 1"),
this,
IDR_TOOLBAR_CHILD1
)
|| !m_wndToolbar1.LoadToolBar(IDR_TOOLBAR_CHILD1)
)
{
TRACE0("Failed to create m_wndToolbar1\n");
return -1; // fail to create
}
if( !m_wndResizableBar0.Create(
_T("Resizable Bar 0"),
this,
ID_VIEW_CHILDFRAME_BAR_0
)
|| !m_wndListBox0.Create(
WS_CHILD|WS_VISIBLE|LBS_NOINTEGRALHEIGHT,
CRect( 0, 0, 0, 0 ),
&m_wndResizableBar0,
UINT( IDC_STATIC )
)
)
{
TRACE0("Failed to create m_wndResizableBar0\n");
return -1; // fail to create
}
m_wndListBox0.SetFont( CFont::FromHandle( (HFONT)::GetStockObject(DEFAULT_GUI_FONT) ) );
m_wndListBox0.AddString( _T("CChildFrame::m_wndListBox0") );
if( !m_wndResizableBar1.Create(
_T("Resizable Bar 1"),
this,
ID_VIEW_CHILDFRAME_BAR_1
)
|| !m_wndListBox1.Create(
WS_CHILD|WS_VISIBLE|LBS_NOINTEGRALHEIGHT,
CRect( 0, 0, 0, 0 ),
&m_wndResizableBar1,
UINT( IDC_STATIC )
)
)
{
TRACE0("Failed to create m_wndResizableBar1\n");
return -1; // fail to create
}
m_wndListBox1.SetFont( CFont::FromHandle( (HFONT)::GetStockObject(DEFAULT_GUI_FONT) ) );
m_wndListBox1.AddString( _T("CChildFrame::m_wndListBox1") );
if( !m_wndResizableBar2.Create(
_T("Resizable Bar 2"),
this,
ID_VIEW_CHILDFRAME_BAR_2
)
|| !m_wndListBox2.Create(
WS_CHILD|WS_VISIBLE|LBS_NOINTEGRALHEIGHT,
CRect( 0, 0, 0, 0 ),
&m_wndResizableBar2,
UINT( IDC_STATIC )
)
)
{
TRACE0("Failed to create m_wndResizableBar2\n");
return -1; // fail to create
}
m_wndListBox2.SetFont( CFont::FromHandle( (HFONT)::GetStockObject(DEFAULT_GUI_FONT) ) );
m_wndListBox2.AddString( _T("CChildFrame::m_wndListBox2") );
m_wndToolbar0.EnableDocking(CBRS_ALIGN_ANY);
m_wndToolbar1.EnableDocking(CBRS_ALIGN_ANY);
m_wndResizableBar0.EnableDocking(CBRS_ALIGN_ANY);
m_wndResizableBar1.EnableDocking(CBRS_ALIGN_ANY);
m_wndResizableBar2.EnableDocking(CBRS_ALIGN_ANY);
if( !CExtControlBar::FrameEnableDocking(this) )
{
ASSERT( FALSE );
return -1;
}
#if (!defined __EXT_MFC_NO_TAB_CONTROLBARS)
if( !CExtControlBar::FrameInjectAutoHideAreas(this) )
{
ASSERT( FALSE );
return -1;
}
#endif // (!defined __EXT_MFC_NO_TAB_CONTROLBARS)
DockControlBar(&m_wndToolbar0,AFX_IDW_DOCKBAR_TOP);
DockControlBar(&m_wndToolbar1,AFX_IDW_DOCKBAR_LEFT);
CWinApp * pApp = ::AfxGetApp();
ASSERT( pApp != NULL );
ASSERT( pApp->m_pszRegistryKey != NULL );
ASSERT( pApp->m_pszRegistryKey[0] != _T(’\0’) );
if( ! CExtControlBar::ProfileBarStateLoad(
this,
pApp->m_pszRegistryKey,
pApp->m_pszProfileName,
LPCTSTR( m_sProfileName )
)
)
{
m_wndResizableBar0.DockControlBar( AFX_IDW_DOCKBAR_TOP, 1 );
m_wndResizableBar0.DockControlBar( &m_wndResizableBar1, true );
m_wndResizableBar2.DockControlBar( AFX_IDW_DOCKBAR_BOTTOM, 1 );
#if (!defined __EXT_MFC_NO_TAB_CONTROLBARS)
m_wndResizableBar2.AutoHideModeSet( true, false, true, true );
#endif // (!defined __EXT_MFC_NO_TAB_CONTROLBARS)
}
return 0;
}
|
|
Dmitriy Dashevskiy
|
Oct 27, 2005 - 1:22 AM
|
Actually I was referring to bars crated in CMainFrame::OnCreate but there is same behaviour of bars in CChildFrame . Unfortunately your new CChildFrame::OnCreate does not change anything. I just downloaded the latest 250 to make sure that we are talking about the same code - still the same. When MDI_InnerOuterBars sample is started first time (with clean registry) - autohidden bar is shown. But in closed and restarted application bar is not shown.
|
|
Technical Support
|
Oct 27, 2005 - 1:47 PM
|
We also suspect some kind of difference in the source code. Please redownload version 2.50. We also sent you a compiled sample by e-mail.
|
|
Dmitriy Dashevskiy
|
Oct 31, 2005 - 12:58 AM
|
The latest version does resolve this issue. Thanks for taking care of it.
|
|
Andrew Harding
|
Oct 21, 2005 - 11:45 AM
|
|
|
Andrew Harding
|
Oct 21, 2005 - 11:54 AM
|
blah sorry my keyboard suffered from temporary insanity. I have a CExtWA<CExtADLG<CDialog>> and I’m trying to add a CNTRL+F accelerator key to it. It seems however that CExtWS::PreTranslateMessage() is eating up the messages so that my dialog’s PreTranslateMessage() is never called. How do I get around this problem? A snippit of my code is listed below:
typedef CExtWA<CExtADLG<CDialog>> CMyResizableDialogBase;class MyDialog : public CMyResizableDialogBase { ... }; MyDialog::OnInitDialog() {
m_hAccel = LoadAccelerators( AfxGetInstanceHandle(), MAKEINTRESOURCE( IDD_ACCEL ) ); }
BOOL MyDialog::PreTranslateMessage(MSG* pMsg)
{ if (WM_KEYFIRST <= pMsg->message &&
pMsg->message <= WM_KEYLAST)
{ if (m_hAccel &&
::TranslateAccelerator(m_hWnd, m_hAccel, pMsg)) return TRUE;
} return CMyResizableDialogBase::PreTranslateMessage(pMsg);
}
|
|
Technical Support
|
Oct 22, 2005 - 8:22 AM
|
The accelarators should work OK if it is the modal dialog box or main dialog window. Please let us know which kind of dialog is discussed in your message: pop-up modal, pop-up non-modal or a child form? In case of pop-up non-modal or child dialog, you need to analyze the focused window and perform the message pre-translation into your dialog from its parent window.
|
|
Andrew Harding
|
Oct 21, 2005 - 3:34 PM
|
I’ve been trying to create a smaller project to reproduce this problem but those attempts have been unsuccessful, I’m thinking it may have something to do with the plugin architecture that I’m using rather than Prof-UIS directly. My project consists of a plugin manager executable and a plugin DLL. The modeless dialog box that is experiencing the PreTranslateMessage difficulty is in my Plugin DLL. I’ll let you know if I find anything more out but for now it appears that the problem is more likely on my side than Prof-UIS.
|
|
Technical Support
|
Oct 22, 2005 - 8:19 AM
|
We may guess the problem occurs because you forgot to redirect keyboard input pretranslation from the main application into the dialog windows in you plugin DLLs. Additionally we should note that to make your application smaller you can exclude unwanted components from Prof-UIS and rebuild the library. Just uncomment appropriate __EXT_MFC_NO_??? preprocessor symbol definitions at the beginning of the Prof-UIS.h file.
|
|
Andrew Harding
|
Oct 24, 2005 - 2:03 PM
|
We’re using a popup modeless dialog box. I checked to be sure that we’re calling SendMessage() in the PreTranslateMessage() of the application to send the message to the dialog box in the DLL. We are passing the messages along, I set a breakpoint in the applications PreTranslateMessage() function where we send the message to the dialog box and that breakpoint gets hit but the breakpoint in our PreTranslateMessage function in the dialog box is not encountered.
|
|
Andrew Harding
|
Oct 24, 2005 - 2:45 PM
|
I found the problem. I forgot that MFC automatically created another app object for my DLL and I hadn’t implemented the PreTranslateMessage for that app object. Thanks for all your help.
|
|
JAVIER SUAREZ
|
Oct 21, 2005 - 8:04 AM
|
Anyway to make the CListCtrl use the paint manager so that it’s drawn with the right colors using the paint manager?
|
|
Technical Support
|
Oct 21, 2005 - 9:45 AM
|
Please let us know which part(s) of CListCtrl you need to redraw using the paint manager?
|
|
JAVIER SUAREZ
|
Oct 21, 2005 - 2:48 PM
|
We are using the CListCtrl with the Report View. From what I can see, the column headers need to be redrawn with the paint manager.
|
|
Technical Support
|
Oct 24, 2005 - 10:25 AM
|
Well, now we understand what you mean. Unfortunately there is no enchanced version of the CListCtrl class in Prof-UIS. But if you need a simple list, you could use a powerful Prof-UIS grid. As for the Report View feature, we plan to introduce it in the major release that comes after Prof-UIS 2.50.
|
|
Suhai Gyorgy
|
Oct 19, 2005 - 2:43 PM
|
In the Prof-UIS-Controls sample the Dialog inserted into CExtTabPageContainerWnd has the same background-color as a usual dialog. I’d like to find out how to make it a light-colored dialog, just as a CPropertyPage in a CPropertySheet (there the propertypage has the same color as the selected tab) Thank you: Chris.
|
|
Technical Support
|
Oct 20, 2005 - 7:53 AM
|
The CExtResizableDialog ’s background is painted in a way that it is consistent with the theme provided by the currently selected paint manager. If you don’t need this feature, just use the CDialog class instead of CExtResizableDialog .
|
|
Suhai Gyorgy
|
Oct 20, 2005 - 11:34 AM
|
You’ve also inserted normal CDialog in your Prof-UIS Control sample, but it’s still not the right color (too dark gray). Isn’t there a way to use different color on CDialog? Thank you: Chris.
|
|
Technical Support
|
Oct 21, 2005 - 8:24 AM
|
To use another color for the dialog background, just handle the WM_CTLCOLOR message. This is described in MSDN.
|
|
Andrew Harding
|
Oct 19, 2005 - 9:27 AM
|
just testing to see if my browser can post on these boards
|
|
Srinivasan Natarajan
|
Oct 19, 2005 - 2:50 AM
|
<TABLE class=frm_table style="MARGIN-TOP: 15px" cellSpacing=0 cellPadding=8 width="100%" border=0> <TBODY> <TR class=author_line> <TD class=author_line_td colSpan=2> <TABLE cellSpacing=0 cellPadding=0 width="100%"> <TBODY> <TR> <TD>Technical Support Subject: Re:Re:Re:Query Regarding CExtGridWnd <TD> <TD align=right> <NOBR> Sep 1, 2005 - 11:28 AM</NOBR> </TD></TR></TBODY></TABLE></TD></TR> <TR> <TD class=message colSpan=2>The next major release will be available within the next two weeks. The report grid control will be released in 3-4 weeks. </TD></TR></TBODY></TABLE>
In your earlier mail the report grid control is supposed get released in the last week of september. we would like to know the status. regards sundar
|
|
Technical Support
|
Oct 19, 2005 - 3:41 AM
|
As you know we do not ignore any question and always help our customers. We have had more support that expected this month so the schedule has slipped a little. So, we believe the first beta will be available at the beginning of November.
|
|
Bob Sabiston
|
Oct 18, 2005 - 4:51 PM
|
Hi: I’m using a CExtGridWnd and need to monitor the changes in selection of the contents of the window. I have provided an override for the OnGbwSelectionChanged function and check the selection status with SelectionGetFirstRowInColumn etc. When the selection changes, I go off and update other views in the application based on the selection. This all works well however I notice that whenever I sort the grid with a column sort, I get a number of OnGbwSelectionChanged calls while sorting. Is there a way to determine if the selection change was activated by a sort (and thus skip the expensive updating of the other views)? Thanks
|
|
Technical Support
|
Oct 19, 2005 - 3:53 AM
|
You could override the following virtual metho in a CExtGridWnd -derived class: virtual bool GridSortOrderSetup(
bool bSortColumns,
const CExtGridDataSortOrder & _gdsoUpdate,
bool bUpdateExistingSortOrder = false,
bool bInvertIntersectionSortOrder = true,
bool bRedraw = true
); This method is invoked to either set new sort rules or change the existing ones. In this method, invoke parent’s method with setting some flag to true before invocation and resetting it to false after it. The OnGbwSelectionChange() method should do nothing if the flag is set to true . Your GridSortOrderSetup() method should also finally analyze the selection.
|
|
Thomas Maurer
|
Oct 18, 2005 - 7:03 AM
|
Hello I have a MDI child that has two auto-hideable control bars in one tab container. I want them to have an icon when they are auto-hidden and on the tab when they are open. I saw this behaviour in the "ProfStudio" sample for "Running Documents" etc.. I tried to understand how the icon and the controlbar are connected and came to the conclusion that it must be the ID that is passed when calling the Create method. If the ID is connected to a command with a certain icon then this icon will be displayed. I did the same in my code and created the controlbar accordingly. I don’t get an icon though although the ID is visible in the menu and the toolbar with the correct icon. What am I doing wrong? Is it important that the controlbar is a child of an MDI child and not of the mainframe? Thanks in advance Thomas M.
|
|
Technical Support
|
Oct 18, 2005 - 8:46 AM
|
Yes, you are right, the icon should be associated with the ID (in the global command manager) that you pass in the Create() method. There are two methods with which you can assign the icon.
1) By using the g_CmdManager->CmdSetIcon method: CExtImageList ilBitmaps( IDB_BITMAPS, RGB(255,255,0), 4 );
VERIFY(
g_CmdManager->CmdSetIcon(
g_CmdManager->ProfileNameFromWnd( GetSafeHwnd() ),
IDC_RESIZABLE_BAR_1,
ilBitmaps.ExtractIcon(1),
false
)
); 2) Create a temporary toolbar, insert buttons with the corresponding IDs and bitmaps into it, and then invoke the code like below: VERIFY(
g_CmdManager->UpdateFromToolBar(
g_CmdManager->ProfileNameFromWnd( GetSafeHwnd() ),
IDR_TOOLBAR_WITH_BITMAPS
)
); Both these methods can be used within the CMainFrame::OnCreate() method.
|
|
Chris Jackson
|
Oct 18, 2005 - 4:17 AM
|
Is there an easy way to get the UpDown buttons always visible in a CExtGridCellVariant used in a property grid, rather than just when the cell is selected?
|
|
Technical Support
|
Oct 18, 2005 - 7:46 AM
|
Just apply the __EGWS_BSE_BUTTONS_PERSISTENT style to the CExtPropertyGridWnd . This will make all the cell buttons persistently visible. Here is a code snippet: CTypedPtrArray < CPtrArray, CExtPropertyGridWnd * > arrGrids;
m_PGC.OnPgcQueryGrids( arrGrids );
bool bCheck = m_checkGridLinesHorz.GetCheck() ? true : false;
INT nGridIdx = 0;
for( ; nGridIdx < arrGrids.GetSize(); nGridIdx ++ )
{
CExtPropertyGridWnd * pGrid = arrGrids[ nGridIdx ];
ASSERT_VALID( pGrid );
pGrid->BseModifyStyle(
__EGWS_BSE_BUTTONS_PERSISTENT,
__EGWS_BSE_MASK
);
}
|
|
Chris Jackson
|
Oct 18, 2005 - 9:17 AM
|
OK, that was simple. Thanks, probably should have spotted that ;-)
|
|
Wilhelm Falkner
|
Oct 18, 2005 - 2:16 AM
|
Hi, inside a CExtResizableDialog i want to place another CExtResizableDialog. In my outer dialog resource i place a CStatic, to know where to place the inner dialog. For the CStatic i also use AddAnchor, so the inner dialog is place at the right position. For the inner dialog I got an additional gripper. But I want the inner dialog resized atomatical when the outer dialog is resized. How can I do this ??
TIA, Willi
|
|
Technical Support
|
Oct 18, 2005 - 7:52 AM
|
To remove the resizing gripper, just call the ShowSizeGrip( FALSE ) method for the inner dialog. As for the anchoring the inner dialog, use the following code: AddAnchor( m_wndInnerDialog.GetSafeHwnd(), __RDA_LT, __RDA_RB );
|
|
Wilhelm Falkner
|
Oct 18, 2005 - 8:13 AM
|
Thanks, this solved my problem Willi
|
|
Simon DESEE
|
Oct 17, 2005 - 3:54 AM
|
Hello, How can I create a toolbar for my window commands (tile, arrange icons, ...) that will be shown (or enabled) only if child windows are present ? How can I customize my child windows caption with your CExtTabMDIWnd class (for the tab bar and the mainframe caption) ? Why isn’t the popup menu shown when I right-click on the tab bar ? Thanks for your explanation. Regards,
|
|
Technical Support
|
Oct 17, 2005 - 8:38 AM
|
We recommend you simply create a toolbar with MDI-related commands and show/hide it when the last MDI child window closes or the first one opens. So, please override the CFrameWnd::RecalcLayout() virtual method in your main frame window like as follows: void CMainFrame::RecalcLayout( BOOL bNotify )
{
HWND hWndMdiClient = ::GetDlgItem( m_hWnd, AFX_IDW_PANE_FIRST );
BOOL bShow = FALSE;
BOOL bVisible = m_wndMyMdiCommandsToolBar.IsVisible() ? TRUE : FALSE;
if( hWndMdiClient != NULL )
{
HWND hWndMdiChild = ::GetWindow( hWndMdiClient, GW_CHILD );
if( hWndMdiChild != NULL )
bShow = TRUE;
}
if( bShow != bVisible )
ShowControlBar( &m_wndMyMdiCommandsToolBar, bShow, TRUE );
CMDIFrameWnd::RecalcLayout( bNotify );
} You can customize the tab item text by overriding the CExtTabWnd::OnTabWndQueryItemText() virtual method in your CExtTabMdiWnd -derived class. This allows you to make the tab text different to the caption of the MDI child frame window and part of main frame’s caption. The CExtTMWI template class contains implementation of the OnTabWndQueryItemText() method for the MDI tab control. As you can see, the text of the tab item depends on whether your project is based on MFC’s document view architecture. So, to set the title, you can use either CDocument::SetTitle() or CFrame::SetTitle() depending on your project type. You also need to invoke the CFrameWnd::OnUpdateFrameTitle() virtual method to display the newly assigned title. By default, right clicking the MDI tab bar does not produce any menu but you can change this behavior as it is done in the ProfStudio sample. Please take a look at the CMainFrame::OnConstructPopupMenuCB() method in that sample. It handles the CExtControlBar::g_nMsgConstructPopupMenu registered windows message. The wParam parameter is a pointer to the CExtControlBar::POPUP_MENU_EVENT_DATA data structure. If the m_nHelperNotificationType property of this data structure is set to __PMED_MDITABS_CTX then the method constructs a context pop-up menu for the MDI tab window.
|
|
Thomas Maurer
|
Oct 13, 2005 - 11:03 AM
|
Hello I overrode OnTabWndSelectionChange to be notified when the tabbed MDI child changes. This works fine so far. How do I get a reference to my MDI child? I want to notify my MDI child that it is active somehow. In TAB_ITEM_INFO I do not find anything about the corresponding MDI child. While writing this it came to my mind that good old WM_MDIACTIVATE is what I need. But now that I started this message I would still like to know how do I get a reference to the MDI child? Maybe I will need the answer some other time. Thanks in advance Thomas
|
|
Technical Support
|
Oct 14, 2005 - 5:30 AM
|
Yes, you can use the WM_MDIACTIVATE window message: just handle it in the CChildFrame class derived from CMDIChildWnd .
|
|
Suhai Gyorgy
|
Oct 13, 2005 - 2:02 AM
|
Hi! In Prof-UIS we save and load all the toolbars and menubars settings (and others) to the registry. But when I change something (like adding a new command) in the menu or toolbar (not dynamically but in the application) at the next running of the program I usually get an abort or assertion failure. Right now I can fix the problem only if I remove the profile from the registry. Isn’t there any other way of fixing the problem? Thank you: Chris.
|
|
Technical Support
|
Oct 13, 2005 - 4:45 AM
|
This question is related to code design. The assertion occurs when the registry state does not describe exact state of the bars in the application. This is just an assertion in the debug version and nothing more. Maybe we need to replace ASSERT( FALSE ) in the catch section to something like TRACE("Warning! The Prof-UIS control bar state being loaded does not match the control bars created in the frame window!\n") . We would appreciate if you share your point of view on this issue with us.
|
|
Suhai Gyorgy
|
Oct 14, 2005 - 2:36 AM
|
In our opinion the best solution would be replacing "ASSERT( FALSE )" with a code that ignores all control bar settings in case of unmatch. TRACE is OK but the user of the application will not see it. We’d say rather lose all settings if the application can run fine without them. Regular users will not understand what causes the abort and might think of a much bigger problem.
|
|
Technical Support
|
Oct 14, 2005 - 5:35 AM
|
We have replaced ASSERT with TRACE . The OnCreate() method of your application now should have the following lines: if( ! CExtControlBar::ProfileBarStateLoad( . . . ) )
{
DockControlBar( &m_wndMenuBar );
DockControlBar( &m_wndToolBar );
. . .
m_wndResizableBar1.DockControlBar. . .( . . . );
m_wndResizableBar2.DockControlBar. . .( . . . );
m_wndResizableBar3.DockControlBar. . .( . . . );
. . .
} If the control bars’ state has not been loaded, your code has no reason to think about whether the bars’ state is present in the registry or it is invalid.
|
|
Darren Oliver
|
Oct 11, 2005 - 9:25 AM
|
Just wanted to know how much Prof-UIS is integrated into VS 2003? I’m trying to ascertain if I’ve installed Prof-UIS correctly. So far, I only see the Prof-UIS wizard for new projects. I do not see... 1) Dynamic Help integration 2) Prof-UIS integration into normal help Is this correct? Thanks ahead of time!
|
|
Technical Support
|
Oct 11, 2005 - 1:43 PM
|
So far, Prof-UIS help is integrated into the MSDN for VS 6.0 only. As for VS 2003, we are working on adding this feature to the Integration Wizard and this will be available soon.
|
|
Darren Oliver
|
Oct 11, 2005 - 9:20 AM
|
Am trying to add a popup context menu in VC++, when I right click on the menu in the Resource Viewer and select ’Add Event Handler...’, I get the error message:
Error in OnSelectMessageType: Cannot access directory or file ’c:\program files\foss sofware inc\include\extcmdmanager.h’ for writing
Prof-UIS is installed on ’D:\Program Files\Prof-UIS’. Is it really expecting to modify that file? Thanks ahead of time!
|
|
Technical Support
|
Oct 11, 2005 - 1:57 PM
|
Please provide us with more details of this problem. How many projects do you have in the solution? Whether the menu is in the resource of the startup project? Can this problem be reproduced in any of Prof-UIS samples?
|
|
Darren Oliver
|
Oct 12, 2005 - 2:33 PM
|
I think this is a self-induced silliness issue. The problem is replicated in the resource editor, where if I have a menu:
_POPUP_
<command>
<command>
<submenu> -> ...
<command>
What I did was right-click the "_POPUP_" or "<submenu>" item and issue the ’Add Event Handler...’ command and that’s when I get the funny error. Of course, when I selected the <command> items, which I should have, it worked as per normal.
|
|
Technical Support
|
Oct 13, 2005 - 4:35 AM
|
Thank you for the detailed description of the problem. We tried to reproduce it in context menu resources of the ProfStudio sample application with no success. So, we need your help to reproduce the problem either in your test application or in some of our samples. This will allow us to quickly find a solution to the problem solution or fix a bug if any.
|
|
Suhai Gyorgy
|
Oct 9, 2005 - 12:00 PM
|
Hi! I have a MainFrame as the main window of my application and want to modally open another window that have a menubar, a toolbar, a statusbar and a simple controlbar. I could do the menubar and the toolbar as you did in ProfUIS-Controls, but couldn’t make the rest work. May I ask for a small sample that shows how to put all the controlbars mentioned above on a dialog (probably a CExtResizableDialog) that is not my applications main window? Thank you very much: Chris
|
|
Technical Support
|
Oct 9, 2005 - 12:44 PM
|
There is one important limitation to using the CExtMenuControlBar class: there must be only the one menu bar instance in a scope of one command profile in the command manager. This means your modal window must be based on a separately allocated command profile with its unique name. In case of the modal dialog window, please try this: 1) Allocate a new command profile for this dialog window by calling g_CmdManager->ProfileSetup( _T("UniqueProfileName"), m_hWnd ) from the OnInitDialiog() virtual method of your dialog window class. 2) Remove this profile by invoking the g_CmdManager->ProfileDestroy( _T("UniqueProfileName"), true ) from the OnOK() and OnCancel() methods of your dialog window class. We think these two small code improvements will fix the issue. If not, then please let us know so we can create a small sample application for you.
|
|
Wilhelm Falkner
|
Oct 18, 2005 - 2:24 AM
|
Using a second command profile works fine, but CExtCustomizeSite::CustomizeStateLoad and CExtCustomizeSite::CustomizeStateSave do not work; toolbars are destroyed. What do I wrong ?? TIA Willi
|
|
Technical Support
|
Oct 18, 2005 - 10:16 AM
|
Previously we discussed a dialog-based application in this thread. But the customize site is (and should be) used with frame-based applications. So, we need more details about your application. Please describe the entire layout of your application and when/where the problem occurs.
|
|
Wilhelm Falkner
|
Oct 18, 2005 - 10:41 AM
|
You are right, this topic is about dialog based applications, but I think, the problem is the same in MDI applications. Some months ago, I have had a problem in a MDI application with a framewindow with own toolbars and menues. You solved the problem (I send you the source code), but you also needed to create an new version to solve the problem. The trick was to create an own profile. All seems to work ok. Some days ago i saw, that the state of menu, toolbars in this frame window was not (re-)stored. I thought, CExtCustomizeSite::CustomizeStateSave in this framewindow during DestroyWindow should solve this, so I inserted these lines. But after this calls, the toolsbars do not have any functions more at the next open of this framewindow. To get them working, I have to delete saved state in the windowsregistry. TIA Willi
|
|
Technical Support
|
Oct 19, 2005 - 2:48 AM
|
If the problem persists, you can send us your source code so we can help you.
|
|
Suhai Gyorgy
|
Oct 10, 2005 - 2:31 AM
|
Well, I’m having problems with putting the statusbar and especially the CExtControlBar on my dialog... And those problems are not solved by the code improvements mentioned above. Even though, thank you for this info about setting up a different profile, I’m sure it solved some problems that didn’t even come up yet:) I would still like to ask for that small sample about putting statusbar and controlbar on my dialog. Thank you again: Chris
|
|
Technical Support
|
Oct 10, 2005 - 8:07 AM
|
To use the status bar in the dialog window is extremely simple. Please take a look at this project. We just generated a simple dialog-based application, added CTestDlg::m_wndStatusBar property and created it in the CTestDlg::OnInitDialog() method. To stick the status bar to the bottom of the dialog window, we invoke the CWnd::RepositionBars() method in the OnInitDialog() and OnSize() methods. You can replace the CDialog class with CExtResizableDialog and the CStatusBar class with CExtStatusControlBar . The result will be the same. Of course, after creating the status bar in your dialog, you need to initialize its panes. As for the CExtControlBar class, it cannot be used in dialogs. You can only use the classes derived from it: CExtToolControlBar and CExtMenuControlBar .
|
|
Suhai Gyorgy
|
Oct 10, 2005 - 9:11 AM
|
Thank you, it works now. What caused the problem was that I put a custom-control where the statusbar was meant to be, just as I had to do with the toolbar and menubar. Another thing though: I got a resizing-triangle in the bottom-right corner of my statusbar... How can I remove that? Anyway, how did it get there? I don’t have anything like that in the other statusbar in my MainFrame window. Does it have anything to do with the CBRS_GRIPPER style? Thank you again: Chris.
|
|
Technical Support
|
Oct 10, 2005 - 9:43 AM
|
Simply override the CExtStatusControlBar::OnQueryGripperEnabledState() virtual method and return false in it:
virtual bool OnQueryGripperEnabledState() const
{
ASSERT_VALID( this );
return false;
}
|
|
Suhai Gyorgy
|
Oct 11, 2005 - 3:38 AM
|
I’ve done as you suggested... Now I can’t see the resizing-triangle in the corner, but I can still resize my statusbar as if it was still there! How could I completely disable resizing the statusbar but enable resizing my dialog? Thank you: Chris.
|
|
Technical Support
|
Oct 11, 2005 - 8:36 AM
|
Please use a CExtStatusControlBar -derived class (or CStatusBar -derived) and implement the WM_NCHITTEST standard Windows message handler in it like as follows: // declaration
afx_msg UINT OnNcHitTest(CPoint point);
// message map entry
ON_WM_NCHITTEST()
// implementation
UINT CYourStatusBar::OnNcHitTest(CPoint point)
{
UINT nHitTest = CExtStatusControlBar::OnNcHitTest(CPoint point);
if( nHT == HTBOTTOMLEFT || nHT == HTBOTTOMRIGHT )
nHT = HTCLIENT;
return nHitTest;
}
|
|
Suhai Gyorgy
|
Oct 11, 2005 - 9:10 AM
|
Well, there were some mistakes in your code, but I could figure it out:)) Now I can’t resize my StatusBar (which is good) but I can’t resize my CExtResizableDialog either, although I would need that:( Any further ideas?;)
|
|
Technical Support
|
Oct 11, 2005 - 9:41 AM
|
Please make sure that you turned on the Resizing style in the Border combo box.
|
|
Suhai Gyorgy
|
Oct 12, 2005 - 1:57 AM
|
That was kind of novice mistake of me, sorry:) Chris
|
|
John Huang
|
Oct 7, 2005 - 9:26 AM
|
In excel, it has one style - it can outline one cell or more. so hover or select can’t affect the display of this cell or one full row content. or the background color of this cell/line will be changed, which is not my expectation.
can I have this style in grid ?
TX.
|
|
Technical Support
|
Oct 7, 2005 - 10:19 AM
|
We would like to ask you to send us a screenshot of the cell border in question.
|