|
|
|
|
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 |
|
Suhai Gyorgy
|
Feb 7, 2007 - 7:30 AM
|
I need to get hold of the PropertyValue which corresponds to a cell inside CExtPropertyGrid. I’d need it from inside an OnButtonPressed overriden method. I made this code and I also tested it some, but I’d like to know if it is a safe code. void CMyCellInPropGrid::OnButtonPressed(
CExtGridWnd & wndGrid,
INT nButtonType,
const RECT & rcCellExtra,
const RECT & rcCell,
LONG nVisibleColNo,
LONG nVisibleRowNo,
LONG nColNo,
LONG nRowNo,
INT nColType,
INT nRowType
)
{
CExtGridCellString::OnButtonPressed(...);
if ( nButtonType == __EBTT_ELLIPSIS ) {
CExtPropertyGridWnd *pPropGrid = reinterpret_cast<CExtPropertyGridWnd *>(&wndGrid);
HTREEITEM hItem = pPropGrid->ItemGetByVisibleRowIndex(nRowNo);
CMyPropValue *pValue = (CMyPropValue *)pPropGrid->PropertyItemFromTreeItem(hItem);
// here would come other code using pValue
}
}
Of course I only use CMyCellInPropGrid from inside CMyPropValue’s constructor: CMyCellInPropGrid *pCell = STATIC_DOWNCAST( CMyCellInPropGrid , ValueDefaultGetByRTC( RUNTIME_CLASS( CMyCellInPropGrid ) ) ); Thank you, Chris.
|
|
Technical Support
|
Feb 7, 2007 - 8:47 AM
|
The source code is absolutely correct. All the method invocations will always return the correct result (i.e. you should never get NULL pointers nor NULL values of HTREEITEM handles).
|
|