|
|
|
|
Forum
Please
Log In
to post a new message or reply to an existing one. If you are not registered, please
register.
NOTE: Some forums may be read-only if you are not currently subscribed to
our technical support services.
Subject |
Author |
Date |
|
ven rag
|
Nov 9, 2006 - 12:48 AM
|
Hi, I have Check box in each Row of a particular Column.Suppose I have 25 rows in the Grid and I have SetCheck about 15 rows. I have to uncheck all the 15 Check Box .I have used the for loop.But I think this won’t be a good idea as it takes time to uncheck the check boxes. I want a easier way so that when I double Click the Grid all the Check Box as to unchecked in the particular Column. for(int i=0;i<RowCountGet();i++) { HTREEITEM hTreeItemck = ItemGetByVisibleRowIndex(i); CExtReportGridItem * pRGIck = ReportItemFromTreeItem( hTreeItemck ); CExtReportGridColumn * pRGCck =ReportColumnGet( _T("Select"), _T("Other Fields")); ASSERT_VALID( pRGCck ); CExtGridCell * pCellck = ReportItemGetCell( pRGCck, pRGIck ); ((CExtGridCellCheckBox*)pCellck)->SetCheck(false); }
Thank you
|
|
Michael Clapp
|
Mar 28, 2007 - 1:15 PM
|
I’m using an OnExtMenuPrepare message handler to update a CExtPopupMenuWnd:
CExtPopupMenuWnd::MsgPrepareMenuData_t * pData = reinterpret_cast< CExtPopupMenuWnd::MsgPrepareMenuData_t * > (wParam); ASSERT( pData != NULL );
CExtPopupMenuWnd * pPopup = pData->m_pPopup; ASSERT( pPopup != NULL );
pPopup->ItemInsert(..) pPopup->ItemInsert(..) pPopup->ItemInsert(..)
The menu is appearing fine, however I’m having trouble getting a checkmark to appear with these items. I’ve tried ItemInsertCommand as well as but the checked parameter doesn’t seem to be working.
|
|
Technical Support
|
Mar 29, 2007 - 12:05 PM
|
Each menu/toolbar item controls its status (enabled/disabled, checked/unchecked) via MFC command updating mechanism. So you can make the menu item checked by providing an update handler for the command ID (simply add the ON_UPDATE_COMMAND_UI handler for this command): afx_msg void OnUpdateYourCommand(CCmdUI* pCmdUI);
...
ON_UPDATE_COMMAND_UI(ID_YOUR_COMMAND, OnUpdateYourCommand)
...
void CMainFrame::OnUpdateYourCommand( CCmdUI * pCmdUI )
{
pCmdUI->SetCheck( m_bChecked ? 1 : 0 );
}
|
|
Technical Support
|
Mar 29, 2007 - 11:52 AM
|
The menu items inserted using the CExtPopupMenuWnd::ItemInsert() method will have the enabled/checked/radio state updated using the MFC’s command updating mechanism. The menu items inserted using the CExtPopupMenuWnd::ItemInsertCommand() method will have state based on the method parameters and you should use this method. We have added invocation of this method to the end of the CPagePopupMenus::OnExtMenuPrepare() method in the ProfUIS_Controls sample application: LRESULT CPagePopupMenus::OnExtMenuPrepare(WPARAM wParam, LPARAM lParam)
{
. . .
pPopup->ItemInsertCommand( UINT(987), -1, _T("Hello world!"), NULL, NULL, false, 1 ); // THIS LINE WAS ADDED
return TRUE;
} And we saw the checked menu item with the "Hello world!" text in the context menu displayed over the Popup Menus page.
|
|
Technical Support
|
Nov 9, 2006 - 1:09 PM
|
It seems removing the following lines (before the for{...} loop) should solve the problem: CExtReportGridColumn * pRGCck =ReportColumnGet( _T("Select"), _T("Other Fields"));
ASSERT_VALID( pRGCck );
|
|
ven rag
|
Nov 14, 2006 - 5:34 AM
|
I have changed the Code as you have said CExtReportGridColumn * pRGCck =ReportColumnGet( _T("Select"), _T("Other Fields")); ASSERT_VALID( pRGCck ); for(int i=0;i<RowCountGet();i++) { HTREEITEM hTreeItemck = ItemGetByVisibleRowIndex(i); CExtReportGridItem * pRGIck = ReportItemFromTreeItem( hTreeItemck ); CExtGridCell * pCellck = ReportItemGetCell( pRGCck, pRGIck ); ((CExtGridCellCheckBox*)pCellck)->SetCheck(false); }
After the Double Click the SetCheck check boxes are removed.But Again if I SetCheck and Uncheck by Double Clicking for the Secon time in the Grid, Checked are not removed.After that if I click anywhere on the Grid the Checked boxes are removed.I think after unchecking the grid is not refreshed. Can u give me the Sample Code
|
|
Technical Support
|
Nov 16, 2006 - 3:17 AM
|
The code ((CExtGridCellCheckBox*)pCellck)->SetCheck(false) removes check marks regardless of any conditions. You should specify true or false in method parameters depending on some condition in your application.
|
|