Subject |
Author |
Date |
|
Simon DESEE
|
Aug 7, 2006 - 8:04 AM
|
Dear all,
How can I separate different rows of my grid (like category on property window, but on a grid) ?
Thanks for your help.
|
|
Technical Support
|
Aug 7, 2006 - 9:45 AM
|
Thank you for the interesting question. There are two ways to separate row ranges (and/or columns) from each other. Both report grid and property grid windows use rows which have one cell per row. The property category rows and report grid rows cover the entire column range. Although the CExtGridWnd class does not support cell join feature, it is possible to override the CExtGridWnd::OnGbwAdjustRects() virtual method and change the cell rectangles on-the-fly. This approach can be used in scope of one grid row: you can make the first cell having a large width and covering all the columns and you can make all other cells having zero width. You can reserve some space before and after each row and re-paint it if needed. For instance, the report grid control supports a data preview under each row. This feature is implemented using the built-in ability of the CExtGridWnd generic window to reserve space before/after each row/column. The report grid reserves space after each row and allows you to re-paint it. You can reserve space before some rows to have several row ranges in your grid window, separated from each other. To use this approach, the grid window should support rows with different heights, i.e. __EGBS_FIXED_SIZE_ROWS style should not be specified when invoking the SiwModifyStyle() method. Create a header column and initialize CExtGridCellHeader objects in it. These cells allow you to keep row heights. You can hide this header column by making it of zero size (using CExtGridWnd::OuterColumnWidthSet() ). The header cells should be initialized when you insert data rows. You should use the CExtGridCell::ExtentSet() method for each header cell on the left to specify the row height. The CExtGridCell::ExtraSpaceSet() method allows you to specify extra space in pixels above or below the row for each header cell on the left. This will allow you to specify some extra space before each first row in each range of rows. As a result, you will see your row ranges visually separated from each other.
|
|
Simon DESEE
|
Aug 7, 2006 - 8:02 AM
|
Dear Sir,
When I use the CExtPaintManagerOffice2007_R2_LunaBlue theme, the top right corner of the mainframe is not paint properly (?).
My mainframe is a CExtNCW < CMDIFrameWnd > derived class.
Is this normal or not ?
Thanks
|
|
Technical Support
|
Aug 7, 2006 - 9:32 AM
|
Would you send us a screenshot demonstrating what’s painted incorrectly?
|
|
David Skok
|
Aug 7, 2006 - 7:04 AM
|
Greetings!
A while ago I asked about how to keep track of the location of sorted items in grids and you pointed me to OnDataProviderSwapSeries. I had been using my own method and decided to switch to using OnDataProviderSwapSeries but there seems to be a problem. The sort does not match what is displayed. Furthermore the values of nRowColNo1, nRowColNo2 passed to OnDataProviderSwapSeries can be outside of the range of ...CountGet(); I have verified the problem sorting rows and don’t know if the problem exists sorting columns.
Am I correct in assuming that ...CountGet() returns the amount of interior Row/Columns and does not count the outside? The documentation does not specify.
void _ZoneGrid::OnDataProviderSwapSeries( bool bColumns, // true = sorting/swapping columns, false - rows LONG nRowColNo1, LONG nRowColNo2, LONG nSwapCounter ) { CExtGridWnd::OnDataProviderSwapSeries( bColumns, nRowColNo1, nRowColNo2, nSwapCounter );
int Save; int *axis = ( bColumns ) ? ColumnXlate : RowXlate; int Endpoint = ( bColumns ) ? ColumnCountGet() : RowCountGet();
if( nRowColNo1 >= Endpoint || nRowColNo2 >= Endpoint ) return;
Save = axis[nRowColNo2]; axis[nRowColNo2] = axis[nRowColNo1]; axis[nRowColNo1] = Save; }
|
|
Technical Support
|
Aug 7, 2006 - 9:31 AM
|
The row/column indices in the grid data provider differ from those in the grid window but it is not difficult to establish a conversion between them. Here is how it can be done with row indices. In the grid window, row numbers are zero-based and all rows in the data area, in the header at top and in the header at bottom are enumerated independently: Header row 0 at top
Header row 1 at top
Header row 2 at top
Data row 0
Data row 1
Data row 2
Data row 3
Data row 4
Data row 5
Header row 0 at bottom
Header row 1 at bottom
Header row 2 at bottom
You can get any row count using the CExtGridWnd ’s API: LONG nOuterRowCountAtTheTop = wndGrid.OuterRowCountTopGet();
LONG nInnerDataRowCount = wndGrid.RowCountGet();
LONG nOuterRowCountAtTheBottom = wndGrid.OuterRowCountBottomGet(); In the data provider, data rows are stored in a two dimensional memory data structure, which has the following layout: Real index 0 --> Header row 0 at top
Real index 1 --> Header row 1 at top
Real index 2 --> Header row 2 at top
Real index 3 --> Header row 0 at bottom
Real index 4 --> Header row 1 at bottom
Real index 5 --> Header row 2 at bottom
Real index 6 --> Data row 0
Real index 7 --> Data row 1
Real index 8 --> Data row 2
Real index 9 --> Data row 3
Real index 10 --> Data row 4
Real index 11 --> Data row 5 During row sorting only the grid’s data rows get swapped to reach the desired sort order. The data provider notifications use data provider’s internal row indices described above. So, if you want to convert row numbers passed in the nRowColNo1 and nRowColNo2 parameters of the OnDataProviderSwapSeries() virtual method, then you should subtract the summary number of header rows: LONG nOuterRowCountAtTheTop = wndGrid.OuterRowCountTopGet();
LONG nOuterRowCountAtTheBottom = wndGrid.OuterRowCountBottomGet();
LONG nTotalCountOfHeaderRows = nOuterRowCountAtTheTop + nOuterRowCountAtTheBottom;
LONG nZeroBasedDataRowIndexInGrid1 = nRowColNo1 - nTotalCountOfHeaderRows;
LONG nZeroBasedDataRowIndexInGrid2 = nRowColNo2 - nTotalCountOfHeaderRows;
#if (defined _DEBUG)
LONG nInnerDataRowCount = wndGrid.RowCountGet();
ASSERT( 0 <= nZeroBasedDataRowIndexInGrid1 && nZeroBasedDataRowIndexInGrid1 < nInnerDataRowCount );
ASSERT( 0 <= nZeroBasedDataRowIndexInGrid2 && nZeroBasedDataRowIndexInGrid2 < nInnerDataRowCount );
#endif (defined _DEBUG) You should use the nZeroBasedDataRowIndexInGrid1 and nZeroBasedDataRowIndexInGrid2 variables in your row position tracking code instead of the nRowColNo1 and nRowColNo2 variables. The same technique can be used for column indices.
|
|
Offer Har
|
Aug 5, 2006 - 4:34 PM
|
Hi,
Whenever i press a menu or hover any command, i get these two messages in the output window: First-chance exception at 0x7c81eb33 in CCC.exe: 0x000006BA: The RPC server is unavailable. The thread ’Win32 Thread’ (0x10f0) has exited with code 0 (0x0).
I know that the thread is the one for the menu delays, but why do i get this RPC exception every time?
Thanks.
|
|
Technical Support
|
Aug 7, 2006 - 9:10 AM
|
We think that the problem has to do with the PlaySound() method. First, please read the FAQ How to customize or disable sounds used in pop-up menus?. Then, try debugging your application on another computer and let us know whether the problem persists. Anyway, you can disable the sound system as this is described in the FAQ.
|
|
Offer Har
|
Aug 7, 2006 - 9:16 AM
|
Thanks,
That removed those messages...
|
|
Christophe Guibert
|
Aug 5, 2006 - 10:02 AM
|
Hello,
While using the CExtReportGridWnd in my application, I think I found a bug that can also simply be produced with your ReportGrid sample.
1. Launch the ReportGrid sample (compiled in static unicode debug) 2. Drag / drop the "Name" column header in the "group by" box 3. Scroll down the window and expand the last item (named "LL mountain frame - silver 52") 4. Select the four last subitems (leaving one), and destroy them with the Delete key 5. Select the last remaining subitem, and destroy it. 6. ASSERT failure in the CExtTreeGridCellNode::FromHTREEITEM method (and crash in the release mode).
This appens only in the last group.
I also encounter the same behavior (same bug ?) when unregistering all the rows of a CExtReportGridWnd instance where rows have been grouped.
Would you mind providing a fix, please ? (However, I am not stuck since I can temporarily disable the "group by" feature).
Good luck in the debug, and thanks in advance.
Best Regards,
Christophe Guibert
|
|
Technical Support
|
Aug 7, 2006 - 9:05 AM
|
Thank you for reporting the bug. You can fix it by updating the source code for the CExtReportGridWnd::ReportItemUnRegisterSelection() method: bool CExtReportGridWnd::ReportItemUnRegisterSelection(
bool bRedraw
)
{
ASSERT_VALID( this );
if( SelectionIsEmpty()
|| RowCountGet() == 0
|| ColumnCountGet() == 0
)
return false;
HTREEITEM htiNewFocus = NULL;
if( ! ReportItemModifySelectionForUnRegistering( false, &htiNewFocus ) )
return false;
m_nHelerLockOnSwUpdateScrollBars ++;
m_nHelerLockEnsureVisibleColumn ++;
m_nHelerLockEnsureVisibleRow ++;
CTypedPtrList < CPtrList, CExtReportGridItem * > _listToRemove;
LONG nRowNo = SelectionGetFirstRowInColumn( 0 );
for( ; nRowNo >= 0; )
{
HTREEITEM hTreeItem = ItemGetByVisibleRowIndex( nRowNo );
ASSERT( hTreeItem != NULL );
CExtReportGridItem * pRGI = ReportItemFromTreeItem( hTreeItem );
ASSERT_VALID( pRGI );
_listToRemove.AddHead( pRGI );
if( ItemGetChildCount( hTreeItem ) == 0 )
nRowNo = SelectionGetNextRowInColumn( 0, nRowNo );
else
{
hTreeItem = ItemGetNext( hTreeItem, false, true, false );
if( hTreeItem == NULL )
break;
nRowNo = ItemGetVisibleIndexOf( hTreeItem );
ASSERT( nRowNo > 0 );
nRowNo = SelectionGetNextRowInColumn( 0, nRowNo - 1 );
}
}
SelectionUnset( false, false );
LONG nRowEnsureVisible = -1L;
if( htiNewFocus != NULL )
{
nRowEnsureVisible = ItemGetVisibleIndexOf( htiNewFocus );
ASSERT( nRowEnsureVisible >= 0 );
}
POSITION pos = _listToRemove.GetHeadPosition();
for( ; pos != NULL; )
{
CExtReportGridItem * pRGI = _listToRemove.GetNext( pos );
_ReportItemUnRegisterImpl( pRGI, false, false );
}
m_nHelerLockOnSwUpdateScrollBars --;
m_nHelerLockEnsureVisibleColumn --;
m_nHelerLockEnsureVisibleRow --;
if( htiNewFocus != NULL )
{
LONG nNewRowCount = RowCountGet();
if( nNewRowCount > 0 )
{
if( nRowEnsureVisible < nNewRowCount )
{
nRowEnsureVisible = ItemGetVisibleIndexOf( htiNewFocus );
ASSERT( nRowEnsureVisible >= 0 );
ItemFocusSet( htiNewFocus, false );
}
else
{
nRowEnsureVisible = nNewRowCount - 1L;
htiNewFocus = ItemGetByVisibleRowIndex( nRowEnsureVisible );
ASSERT( htiNewFocus != NULL );
ItemFocusSet( htiNewFocus, false );
}
}
else
nRowEnsureVisible = -1L;
}
else if( RowCountGet() > 0 )
{
nRowEnsureVisible = 0;
FocusSet( CPoint( FocusGet().x, nRowEnsureVisible ), false, false, true, false );
}
if( bRedraw && GetSafeHwnd() != NULL )
{
OnSwUpdateScrollBars();
if( nRowEnsureVisible >= 0L )
EnsureVisibleRow( nRowEnsureVisible, true );
else
OnSwDoRedraw();
}
return true;
}
|
|
Christophe Guibert
|
Aug 8, 2006 - 4:03 AM
|
Hello,
Thank you for the fix. It solves both problems, in the ReportGrid sample and in my application.
Best Regards,
Christophe Guibert
|
|
Offer Har
|
Aug 5, 2006 - 8:13 AM
|
Hi,
I have a popup menu. when the menu is activated, the commands in it are saved, and the next time the application loads, it crashes while looking for these commands. How can this be fixed? What is the task of this class? where can i find comprehensive documentation of what it does?
Thanks.
|
|
Technical Support
|
Aug 7, 2006 - 9:00 AM
|
Prof-UIS menus and toolbars are based on CExtCmdItem command description objects stored in the CExtCmdProfile command profile inside the CExtCmdManager command manager (accessed with the g_CmdManager global smart pointer variable). This design allows Prof-UIS menus to use command icons specified in toolbar resources automatically. This design also allows you to track the command invocation statistics and implement expandable menus. First of all, please ensure you have updated the command manager from all the menu/toolbar resources used in your application. Then make sure the your initialization/shutdown code is implemented correctly (exactly like in the CMainFrame::OnCreate() /CMainFrame::DestroyWindow() methods of our simplest samples: SDI, MDI, SDIDOCVIEW and <span class="newgreen">MDIDOCVIEW</a>. You can learn more about the command manager and GUI persistence in the article Getting Started with Prof-UIS.
|
|
Offer Har
|
Aug 4, 2006 - 8:27 PM
|
Hi.
I have several docking bars that i would like their state to be saved, but some others that are not supposed to be saved - they are some property dialogs of objects that are not there the next time I run the application. When I call the CExtControlBar::ProfileBarStateSave function I don’t see how I can say to it not to save a specific docked bar, nor can I find the function at the dock level to tell it not to be saved. The problem is that when I re-run the application it crashes at start-up because it tries to load and show these unwanted docked bars.
How do i do that?
Thanks.
|
|
Offer Har
|
Aug 5, 2006 - 8:11 AM
|
I bypassed this problem by destroying my bars before closing the application. If you have a better solution, i’ll be happy to hear about it...
|
|
Technical Support
|
Aug 7, 2006 - 6:42 AM
|
The positions of control bars are very dependable on each other. The algorithm for restoring the UI state cannot skip particular control bars. Your solution is correct. Alternatively, you could replace your non-persistent bars with other windows like splitters in view windows or independent floating mini frame windows.
|
|
Seth Strong
|
Aug 2, 2006 - 1:27 PM
|
Where’s the documentation for using custom .xml or .bin skins?
|
|
Technical Support
|
Aug 3, 2006 - 9:56 AM
|
The XML is currently used internally by our development team. We plan to make documentation on .xml skins later (this fall). As for the BIN format, it is based on MFC archives and we are not sure if this requires the complete documentation. It seems a technical article or a faq should be enough to implement a binary skin.
|
|
Offer Har
|
Aug 2, 2006 - 10:30 AM
|
Dead Sir/Madame,
I am trying to implement the following task: 1. Have a toolbars which size can be changed from 16x16 to 24x24 by the user 2. The menu will always show the 16x16 bitmaps 3. The toolbars are 24 bit color depth
I cannot find a simple solution and/or sample for that kind of behavior
I would appreciate a small tutorial or sample that does just that. I saw a lot of requests for that behavior in this forum.
Thanks in advance
|
|
Technical Support
|
Aug 2, 2006 - 12:53 PM
|
Here are the steps you need to follow. Create both 16x16 and 24x24 toolbar resources. The 16x16 toolbar resource should have the same command identifiers as in your menu resource(s) (you can use them during development using class wizard for adding command handler/command updating methods). The 24x24 toolbar resource should have some other button identifiers (different form those in the 16x16 toolbar resource). Now each command has two identifiers: ID_SOME_COMMAND_SMALL used in the 16x16 toolbar and menu and ID_SOME_COMMAND_BIG used in the 24x24 toolbar resource. You should develop the draft version of your toolbars using 16 or 256 color images because Visual Studio toolbar resource editor does not provide the 16/24/32-bit color image editor. Finally, you can replace toolbar bitmaps with those of higher color. As we said, you should use the small version of command identifiers during development. The toolbar window should use the large toolbar resource version, i.e. you should use resource identifier of 24x24 toolbar resource identifier when invoking CExtToolControlBar::LoadToolBar() . The command manager should be updated from both toolbar resources. If you add command handler/command updating methods for the ID_SOME_COMMAND_SMALL command to some class, then this class will have the following message map entries: ON_COMMAND( ID_SOME_COMMAND_SMALL, OnSomeSmall )
ON_UPDATE_COMMAND_UI( ID_SOME_COMMAND_SMALL, OnUpdateSomeSmall ) You should add the following two lines to the same message map manually: ON_COMMAND( ID_SOME_COMMAND_BIG, OnSomeSmall )
ON_UPDATE_COMMAND_UI( ID_SOME_COMMAND_BIG, OnUpdateSomeSmall ) As a result, both ID_SOME_COMMAND_SMALL command in menu and ID_SOME_COMMAND_BIG command in toolbar will work like one command. If you encounter any problems with this, you can send us your test project so we can help you.
|
|
Offer Har
|
Aug 2, 2006 - 2:58 PM
|
Hi,
Looks like I’m getting there, but there are still several problems with the proposed approach - How do i change the toolbar from small to large icons at run-time? The user can select if he want’s large or small icons in the toolbar in the customize dialog.
Also, do you have a customize dialog for toolbars in the library? is there any tutorial on how to use it?
Thanks for the prompt response.
|
|
Technical Support
|
Aug 3, 2006 - 11:20 AM
|
The proposed approach deals with a non-customizable UI design only, when you can use CExtToolControlBar::SetButtons() and specify an array of 16x16 or 24x24 command identifiers at run time. This approach is not applicable to customizable applications where toolbars and menus are based on command tree nodes implemented in the CExtCustomizeCmdTreeNode class. The large icons are simply double scaled normal icons and this approach is exactly the same as in all the modern Microsoft applications including Office and latest Visual Studio versions. There is no built-in support for two icons per command and the customization subsystem cannot edit both icons in the customize mode. Although it is possible to implement two icons per command in a toolbar for any customizable application, we would not recommend you hack the standard design. You can code your own toolbar buttons in a CExtBarButton -derived class and override the CExtBarButton::GetIconPtr() virtual method which will return icons of a custom size.
|
|
Thomas Maurer
|
Aug 2, 2006 - 8:11 AM
|
Hello
In my tabbed MDI application I want to be able to open new documents without making them the active window. If this behaviour is desired I use
nCmdShow = SW_SHOWMAXIMIZED|SW_SHOWNOACTIVATE;
in my CChildFrame::ActivateFrame method.
Under W2K this works fine but under Windows XP the windows are not maximized anymore = the frame of the document can be seen.
Do you know what is wrong? Does this have anything to do with Prof-Uis or is that a general difference of the OS?
Thanks in advance
Thomas
|
|
Technical Support
|
Aug 2, 2006 - 12:35 PM
|
The standard MDI interface in Windows XP has some bugs. We are aware al least of two problems in addition to the one reported in your message: 1) When switching between MDI child windows that are maximized, the new active window incorrectly becomes restored for a short time. This is fixed by Prof-UIS internal code. 2) The MDI child frames without WS_BORDER and WS_CAPTION standard window styles are not managed correctly. These windows do not affect MDI cascade/tile horizontally/tile vertically/arrange icon commands. This is not fixed by Prof-UIS internal code. If you apply the CExtNCW template class to any CChildFrame class in our MDI sample and choose 2007 or skin themes, then you will see this bug. We plan to recode the MDI client window from scratch to provide the same functionality as you can see in Windows 2000.
|
|
Seth Strong
|
Aug 1, 2006 - 2:02 PM
|
I have this dialog in a resizable bar. The resource is a simple form. But in the resizable bar, you see the border of the dialog and a title bar. How do I set some styles so the dialog in a resizable bor has no apparent borders or a title?
Seth
|
|
Technical Support
|
Aug 2, 2006 - 8:20 AM
|
The CExtNCW template does not analyze the WS_CHILD style, so it can be applied to popup dialogs only. Therefore CExtNCW cannot be used for child dialogs so far.
|
|
Seth Strong
|
Aug 2, 2006 - 8:52 AM
|
More specifically do you have a non-resizable dialog that is ordinary except for using Prof-UIS styles?
|
|
Technical Support
|
Aug 3, 2006 - 10:06 AM
|
The CExtResizableDialog class is designed for dialogs of all the types. You can make your dialog non-resizable by setting the Border style in the resource editor to Dialog Frame. Do not forget to invoke ShowSizeGrip( FALSE ) in OnInitDialog() to hide the resizing gripper.
|
|
Seth Strong
|
Aug 3, 2006 - 2:54 PM
|
|
|
Seth Strong
|
Aug 3, 2006 - 10:04 AM
|
I found the answer in the Help documentation. And I got this to work right by not templating and directly subclassing CExtResizableDialog.
|
|
Seth Strong
|
Aug 2, 2006 - 8:49 AM
|
So what do you suggest as the best simple dialog replacement?
|
|
Yasar Gul
|
Aug 1, 2006 - 10:40 AM
|
Hello, I am trying to utilize CExtPropertyGridCtrl in a dialog, i think i have done everything refering to CompoundProperties sample. Everthing works fine, except one thing : the scrollbar and combo boxes are gray in color... In my application i am using g_PaintManager.InstallPaintManager( new CExtPaintManagerXP ); If i change it to g_PaintManager.InstallPaintManager( new CExtPaintManagerOffice2007_R2_Obsidian ); there happens a very slight change, not exactly the same as the CExtPaintManagerOffice2007_R2_Obsidian choice like in your samples. My other controlbar displays the changes correctly... Can you find a reason for me? Thank you very much in advance. Erki
|
|
Technical Support
|
Aug 2, 2006 - 8:24 AM
|
Would you send some screenshots so we can see what is wrong exactly? At the moment we can only guess that the problem is with Windows XP themes. It seems you have not activated themes in your application. To do this, just add the manifest resource to your project. The FAQ How to enable XP visual themes for my application? may be helpful with this.
|
|
Erki Kiroglu
|
Aug 3, 2006 - 2:36 AM
|
Thank you very much, the problem has been solved by implementing the manifest file. Keep up the good work. Erki
|
|
David Skok
|
Aug 1, 2006 - 6:42 AM
|
Is it possible to implement the shift (for consecutive multiple select) and control (for selective multiple select) keys with the mouse in CExtGridCtrl and CExtReportGridWnd?
Thanks
|
|
Technical Support
|
Aug 1, 2006 - 11:22 AM
|
The selection in question is supported both in CExtGridWnd and in CExtReportGridWnd . This is demonstrated in the SimpleGrids and ReportGrid samples. The SiwModifyStyle() method takes __EGBS_SFB_*** flags that specify single row/column/cell selection and __EGBS_SFM_*** flags that specify multiple row/column/cell selection. Any __EGBS_SFM_*** selection is rectangular (multiple rows/columns/cells). The __EGBS_MULTI_AREA_SELECTION style means the selection can contain more than one rectangular region. The __EGBS_SUBTRACT_SEL_AREAS style indicates that for example, if two selected areas are overlapped, the overlapped area is unselected.
|
|
Stephan Finkler
|
Jul 31, 2006 - 8:48 AM
|
Hi, I’ve got an app with the customization subsystem. In the app there is dialog with a toolbar on it.
If I change set a check on "Large icons in toolbars" in customize dlg the icons in the toolbar looks bigger but the toolbar still got the same size.
How can I fit the toolbar?
Thanks for any help. Michael
|
|
Technical Support
|
Jul 31, 2006 - 10:41 AM
|
You can achieve this by invoking the CWnd::RepositionBars() method of your dialog as you do this in dialog’s OnInitDialog() and OnSize() methods. Alternatively, if you want to make your toolbar on the dialog keeping the original size of icons, you can use the CExtToolControlBar -derived class and overload the CExtToolControlBar::IsLargeIcons() virtual method.
|
|
Christopher Favreau
|
Jul 28, 2006 - 2:22 PM
|
I started a MDI using the Prof-UIS wizard in Visual Studio 6 Now I want to add the UI selector toolbar. Then I added the CExtThemeSwitcherToolControlBar m_wndToolBarUiLook; Then I edited CMainFrame::OnCreate and the toolbar shows up and is dockable. What steps to I take to get the context menu filled out properly so I can redisplay the toolbar if it has been hidden previously.
Also, I don’t think your search function works very well. So this information could be on site already I just couldn’t find it.
Thank you in advance for your time, Seth
|
|
Suhai Gyorgy
|
Jul 29, 2006 - 3:33 AM
|
Check out the thread "context menu for a list of control bars". It’s te 3rd below yours. That thread might have the answer to your question:
--- Quote ---
A control bar is not displayed in context menus only if Prof-UIS cannot find the display name of this control bar. This is true for control bars of all types. The display name can be one of the following:
1) The window text of the control bar specified when it is created with CExtControlBar::Create().
2) The text of the menu item which has the same command identifier as the control bar’s dialog control identifier specified when it is created with CExtControlBar::Create(). Typically this menu item is used for showing/hiding the control bar.
--- end Quote ---
Regards: Chris
|
|
Seth Strong
|
Jul 31, 2006 - 9:19 AM
|
Here, I’ll add the related code from OnCreate(). I figure whatever I need to do, it’s likely to be done there. This is wizard generated except for the addition of the UI Selector.
// The UI Selector is m_wndToolBarUiLook of type CExtThemeSwitcherToolControlBar if( (! m_wndToolBarUiLook.Create( NULL, this, ID_VIEW_UI_LOOK_BAR ) ) || (! m_wndToolBarUiLook.ThemeSwitcherInit() ) ) { TRACE0("Failed to create m_wndToolBarUiLook toolbar\n"); return -1; // fail to create } . . . m_wndToolBarUiLook.EnableDocking( CBRS_ALIGN_ANY );
// DockControlBar( &m_wndToolBarUiLook );
// I’m not really sure if I should add something here or not static UINT statBasicCommands[] = { ID_FILE_NEW, ID_FILE_OPEN, ID_FILE_SAVE, ID_APP_EXIT, ID_APP_ABOUT, ID_FILE_PRINT, ID_FILE_PRINT_SETUP, ID_EDIT_COPY, ID_EDIT_CUT, ID_EDIT_PASTE, ID_EDIT_UNDO, ID_VIEW_TOOLBAR, // ID_VIEW_UI_LOOK_BAR, ID_VIEW_RESIZABLEBAR_EMPTY, ID_VIEW_RESIZABLEBAR_TREE, ID_VIEW_RESIZABLEBAR_EDIT, ID_VIEW_RESIZABLEBAR_CP, ID_VIEW_RESIZABLEBAR_DLG, ID_WINDOW_TILE_HORZ, 0 // end of commands list }; // statBasicCommands array
|
|
Seth Strong
|
Jul 31, 2006 - 9:10 AM
|
The context menu displays a greyed out option "UI Selector". Why is it grey?
|
|
Technical Support
|
Jul 31, 2006 - 10:42 AM
|
Please make sure your CMainFrame::PreTranslateMessage() method starts with the following code: BOOL CMainFrame::PreTranslateMessage( MSG * pMsg)
{
if( m_wndToolBarUiLook.PreTranslateMessage( pMsg ) )
return TRUE;
|
|
Seth Strong
|
Jul 31, 2006 - 11:50 AM
|
I found the missing piece.
To add the UI Selector, I made it a member of CMainFrame. I initialized it in OnCreate() and EnabledDocking() for it. Then (this part I left out) I map in the messages with ON_COMMAND_EX(SELECTOR, OnBarCheck) and ON_UPDATE_COMMAND_UI(UI_SELECTOR_ID,OnUpdateControlBarMenu).
Thanks, Seth
|
|
LEANDRO GUZMAN
|
Jul 28, 2006 - 9:43 AM
|
I there, I have the following problem: I’ve developed a dialog aplication that uses CExtDateTimeWnd and CExtDurationWnd controls in the main dialog. The aplication works just fine in debug and release modes. Now the problem. yesterday, I was changing my pc for another one, and when i try to execute the code in the new pc (in debug mode!) I receive the next error message:
Debug assertion Failed! File: winctrl5.cpp line: 189
(obviously I perform a clean/rebuild all)
I’ve tracked down the problem and it happens in the main dialog’s construction, in the moment when the control member variable CExtDurationWnd m_wnd_xx; is created, in the line: (ExtDurationWnd.cpp) m_dtDate = COleDateTime::GetCurrentTime();
My OS data windows Xp SP2 visual c++ 6.0 sp6 settings: EspaA±ol internacional - Chile
thanks in advanced.
|
|
LEANDRO GUZMAN
|
Jul 28, 2006 - 2:49 PM
|
Hi there, the call stack is the next one:
CDateTimeCtrl::GetTime(COleDateTime & {...}) line 189 + 31 bytes CExtDateTimeWnd::CExtDateTimeWnd() line 2632 + 9 bytes CSA2OP_CTDlg::CSA2OP_CTDlg(CWnd * 0x00000000 {CWnd hWnd=???}) line 108 + 1192 bytes CSA2OP_CTApp::InitInstance() line 146 + 13 bytes AfxWinMain(HINSTANCE__ * 0x00400000, HINSTANCE__ * 0x00000000, char * 0x00141f00, int 1) line 39 + 11 bytes WinMain(HINSTANCE__ * 0x00400000, HINSTANCE__ * 0x00000000, char * 0x00141f00, int 1) line 30 WinMainCRTStartup() line 330 + 54 bytes KERNEL32! 7c816d4f()
thanks
|
|
Technical Support
|
Jul 31, 2006 - 8:54 AM
|
Here is the constructor of the CExtDateTimeWnd class: CExtDateTimeWnd::CExtDateTimeWnd()
: CExtDurationWnd()
, m_bBlankYear( false )
, m_bBlankMonth( false )
, m_bBlankDay( false )
, m_bBlankHour( false )
, m_bBlankMinute( false )
, m_bBlankSecond( false )
, m_bBlankDesignator( false )
, m_bAutoSelectNext( false )
{
m_eMode = CExtDateTimeWnd::all;
m_eTimeFormat = CExtDateTimeWnd::automatic;
m_dtDate = COleDateTime::GetCurrentTime();
SetStatus( CExtDurationWnd::null );
} As you can see it does not use CDateTimeCtrl at all, so the problem has nothing to do with CExtDateTimeWnd . We can guess that you may incorrectly create the CExtDateTimeWnd control. In the dialog resource editor you put the Date Time Picker standard control on the form. But actually the CExtDateTimeWnd control is not based on the CDateTimeCtrl control, it is a control coded from the scratch, so the Custom Control type should be used instead. Please take a look at the IDD_PAGE_DATE_TIME_DURATION form in the ProfUIS_Controls sample. There you can see the IDC_DATETIME custom control which is used for creating the CExtDateTimeWnd control.
|
|
Technical Support
|
Jul 28, 2006 - 10:48 AM
|
Line 189 in WINCTRL5.CPP corresponds to the CDateTimeCtrl::GetTime() method. But actually neither CExtDateTimeWnd nor CExtDurationWnd use CDateTimeCtrl . Would you send us a call stack so we can see the calling sequence?
|
|
Suhai Gyorgy
|
Jul 27, 2006 - 9:14 AM
|
Is there any special reason why Ctrl+C, Ctrl+V wouldn’t work in the Inplace EditCtrl in the CExtGridWnd?
I have a CMainFrame class; inside of it, there is a static SplitterWnd and on the two sides of the SplitterWnd, I have 2 CFormViews and on one of these FormViews I have my CExtGridWnd.
Do you by any chance have an idea what could cause the problem? Unfortunately I couldn’t reproduce the problem in a small sample. I know I could write my own EditCtrl class, override the appropiate methods and subclass original EditCtrl. But in all of your samples it works without subclassing, so I’d prefer some other solution for my problem.
Thank you: Chris
|
|
Technical Support
|
Jul 27, 2006 - 10:52 AM
|
We guess there may be some accelerator table pre-translation problem in your app, which causes the key combinations not work properly. Please try to remove all these key combinations from the accelerator table resource.
|
|
Suhai Gyorgy
|
Jul 28, 2006 - 3:59 AM
|
Yes, removing those key combinations from our accelerator table solved the problem. But we really do need those, since the items represented in the grid has to be put on the clipboard in our application.
When an application is using clipboard, it’s not a good practice to use accelerators other than the ones throughoutly used in Windows for clipboard operations. But as I’ve been reading through Prof-UIS and MFC PreTranslateMessage codes, it seems to me that this is kind of an MFC bug.... Actually I had the same problem with CTreeCtrl and CListCtrl, I had to subclass in-place EditCtrl-s to handle these key events. Another proof of bad coding considerations with MFC itself. Well, anyway, I’m going to go for subclassing then.
Thank you: Chris
|
|
Suhai Gyorgy
|
Jul 28, 2006 - 8:43 AM
|
Last few hours I’ve been struggling with trying to find an appropiate place to subclass the in-place editcontrol created inside the grid.
My first guess was to call SubclassWindow method in the overriden OnGbwBeginEdit method. Help says: "Called to activate an in-place editor for the specified cell. The method returns true if the editor window has been successfully created." so I was assuming that default implementation creates editor and returns. Well, reading through code I had to realize, CExtGridBaseWnd::OnGbwBeginEdit only returns after all editing is done and inplace editor is destroyed.
Second guess: Override CExtGridWnd::OnGridCellInplaceControlCreate, but help was pretty clear on that: default implementation does nothing, only returns NULL.
Third and closest guess: For my editable cells I created a class derived from CExtGridCellString and override OnInplaceControlCreate method. Default implementation really does create the editor and returns its HWND. BUT.... when I called SubclassWindow after calling default implementation of OnInplaceControlCreate and passing the returned HWND in SubclassWindow (in case it’s not NULL ,of course), I got an assertion:
ASSERT(FromHandlePermanent(hWndNew) == NULL); // must not already be in permanent map
So my main question: What is the right way to subclass the editor created for the grid?
Best regards: Chris
|
|
Technical Support
|
Jul 28, 2006 - 11:13 AM
|
If you want to use a custom inplace edit control instead of ours, you need to override the CExtGridCell::OnInplaceControlCreate() virtual method, which is is used for creating the edit control. Your edit class should be derived from CExtGridInplaceEdit. So basically you need to copy the body of the CExtGridCell::OnInplaceControlCreate method into your overridden method and replace CExtGridInplaceEdit with CYourGridInplaceEdit (your class). Please note, there is a virtual method OnInplaceControlWindowProc in the CExtGridCell class. It is spying on the window procedure of the in-place editor and returns true if a Windows message has been handled by the cell object. So you can override this method to handle any message from the in-place edit control. This means that probably you may not have to create your own inplace edit control.
|
|
Suhai Gyorgy
|
Jul 29, 2006 - 3:55 AM
|
Ok, so if I understand right, there’s no way I could subclass... :(
The reason I wanted to choose this approach is that I also have a CTreeCtrl which has the same problem, so I already created a CEdit-derived class for fixing this. I could also override OnInplaceControlPreTranslateMessage and handle the messages there, but then I would have the same code twice: once in this OnInplaceControlPreTranslateMessage and once in my CEdit-derived class. I’m not really fond of this idea, since: Who will remember in some years that I had this code twice? So if anytime I realize I have to fix something in it, I probably will just fix it in one of the codes and forget about the other.
You are writing: "So basically you need to copy the body of the CExtGridCell::OnInplaceControlCreate method into your overridden method and replace CExtGridInplaceEdit with CYourGridInplaceEdit (your class)." This also has it’s dangers: What if you change the body of the CExtGridCell::OnInplaceControlCreate method in any of your future versions? At every Prof-UIS upgrading I should check if it changed or not and if so, copy the changes to my code as well.
But since I don’t see any other solution right now, I guess I’ll go for this second approach: use the edit class I already created, derive it from CExtGridInplaceEdit, override CExtGridCell::OnInplaceControlCreate method and create my own editor in it. Probably I won’t have problems subclassing the inplace editor of the CTreeCtrl to a CExtGridInplaceEdit-derived class.
Have a good weekend! Chris
|
|
Technical Support
|
Jul 29, 2006 - 11:05 AM
|
Yes, to create an CExtGridInplaceEdit -derived seems to be the best solution. We do not plan to change it abd CExtGridCell::OnInplaceControlCreate() so you will have no problem in future with this.
|
|
Suhai Gyorgy
|
Jul 31, 2006 - 5:05 AM
|
I couldn’t make it work this way, after all. The main reason is that I wanted to use this same CExtGridInplaceEdit-derived class in my CTreeCtrl and subclass that inplace editor to this same class. For that I would need a default constructor for this CExtGridInplaceEdit-derived class, which I don’t think I can make.
So I have overriden the OnInplaceControlPreTranslateMessage method and handled everything there. It works good now.
One more question: The context menu appearing when I right-click inside the inplace editor... does that show OS/user specific language? I mean if the user of our application uses for example Hungarian Windows, will he/she see those strings (Copy/Paste/Cut/Select all, etc.) in Hungarian, or you fill that context menu with Prof-UIS resources?
Thank you: Chris
|
|
Technical Support
|
Jul 31, 2006 - 10:50 AM
|
You can create a template class with the PreTranslateMessage method, that can be applied to the edit class for the tree and for the grid. This may help you to solve the problem of dubbing the source code. As for the context menus, we did not find any way to retreive all the menu items including the extended part, so we build the menu manually. It is done in the CExtEditBase::OnContextMenu method. All you can do is to disable Prof-UIS menus. Just set the m_bHandleCtxMenus property to false .
|
|
Suhai Gyorgy
|
Jul 31, 2006 - 12:35 PM
|
Thank you for the information. I’ll try template class.
Best regards: Chris
|
|
Jose Andres
|
Jul 26, 2006 - 7:53 PM
|
I wonder how the framework selects which control bars get inserted in the pop-up menu by default. When I right-click on the empty area of the toolbar menu, I get a popup menu of control bars. In one application, I have all the control bars showed up, this is what I wanted. In another application, only toolbars showed up, the menu bar and resizable dialog bar didn’t show up. I have checked many times, there doesn’t seem to be any difference between the two applications as far as the way I use control bars is concerned. What could be the problem? I am aware of the FAQ on how to customize popup menu, but I don’t want to customize it, the default behavior should be just what I wanted.
|
|
Technical Support
|
Jul 27, 2006 - 8:34 AM
|
A control bar is not displayed in context menus only if Prof-UIS cannot find the display name of this control bar. This is true for control bars of all types. The display name can be one of the following: 1) The window text of the control bar specified when it is created with CExtControlBar::Create(). 2) The text of the menu item which has the same command identifier as the control bar’s dialog control identifier specified when it is created with CExtControlBar::Create() . Typically this menu item is used for showing/hiding the control bar. So please check this for your menu bar and dialog bar. Besides all control bars should have unique identifiers otherwise you will be unable to show/hide some of them and restore their states. Finally, it is possible to hide any control bar in context menus if you set the CExtControlBar::m_bAppearInDockSiteControlBarPopupMenu property to false .
|
|
John Kiernan
|
Jul 26, 2006 - 4:34 PM
|
Are there any examples of GridCtrl’s in dialog box that you could point me too?
|
|
John Kiernan
|
Jul 26, 2006 - 4:53 PM
|
To be clear (I shouldn’t post so late in the day):
I’d like to use a ExtGridCtrlWnd in a Dialog box. Is there any sample code that does something like this?
|
|
Suhai Gyorgy
|
Jul 27, 2006 - 1:25 AM
|
Hi!
Check out the CPageGrid class in Prof-UIS_Controls Sample. That class is derived from CPageBase, which in turn is derived from CExtResizableDialog, the main Dialog class of Prof-UIS. This page of the sample shows the usage of all the possible CExtGridCell types. In the resource look for the dialog IDD_PAGE_GRID. The dialog is fully occupied by a custom control of class ProfUIS-ScrollItemWindow. Probably the rest can be figured out reading the sample code.
Regards: Chris.
|
|
John Kiernan
|
Jul 27, 2006 - 7:39 AM
|
Great! Thank you. That’s what I was looking for!
John
|
|
Technical Support
|
Jul 27, 2006 - 8:16 AM
|
Additionally here is a small project that shows how to use the grid in a dialog. It may be helpful with this.
|
|
John Kiernan
|
Jul 27, 2006 - 12:19 PM
|
That is actually a little more helpful and easier to understand. Thank you!
John
|
|
Bob Sabiston
|
Jul 26, 2006 - 12:02 PM
|
Hi: Is it possible to place a toolbar inside a status bar? Your examples show how to place controls inside status bars but I’m not aware of any where a toolbar is placed inside one.
Thanks
|
|
Technical Support
|
Jul 27, 2006 - 10:40 AM
|
We updated the StatusPanes sample. It now also demonstrates how to add a toolbar to the status bar. Would you download the updated Prof-UIS from our FTP site? 
|