|
|
|
|
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 |
|
Offer Har
|
Mar 1, 2008 - 5:19 AM
|
Dear Support,
I have a cell with a check box text and button. I would like that when the check-box is unchecked, the text will appear read-only and the button will be disabled.
Can this be done? If yes, can you please explain, if not, can this feature be added to next releases?
Thanks, Ron.
|
|
Technical Support
|
Mar 17, 2008 - 5:09 AM
|
We have just checked our implementation of the check box and came to a conclusion that you should not apply the __EGCS_READ_ONLY style if you want to leave the check box enabled and clickable. Instead, apply the __EGCS_NO_INPLACE_CONTROL cell style in the CMyGridCell::OnSetCheck() method , set the cell’s text color to COLOR_3DSHADOW and make the button disabled.
You can control if a cell button is enabled or disabled by overriding CExtGridCell::OnQueryButtonInfo() virtual bool OnQueryButtonInfo(
INT nButtonType,
bool * p_bEnabled,
bool * p_bPressed = NULL,
bool * p_bStayPressed = NULL,
UINT * p_nTimerElapseValue = NULL
) const;
|
|
Offer Har
|
Mar 12, 2008 - 6:57 PM
|
Wouldn’t this make the check-box disabled as well? I want the check-box to remain enabled even when it is un-checked.
|
|
Technical Support
|
Mar 4, 2008 - 2:37 AM
|
You should handle the event fired when the check state of a grid cell is changed by the user. You can use a derived cell class whose the OnSetCheck() virtual method is overridden. Here is a sample code: void CMyGridCell::OnSetCheck(
INT nCheck,
CExtGridWnd & wndGrid,
LONG nColNo,
LONG nRowNo,
INT nColType,
INT nRowType,
const RECT & rcCellExtra,
const RECT & rcCell
)
{
ASSERT_VALID( this );
ASSERT_VALID( (&wndGrid) );
DWORD dwCellStyle = GetStyle();
if( (dwCellStyle&__EGCS_CHK_MASK) == 0 )
return;
CBaseGridCell::OnSetCheck(
nCheck,
wndGrid,
nColNo,
nRowNo,
nColType,
nRowType,
rcCellExtra,
rcCell
);
// place your code here
} The nCheck parameter specifies whether the check box is checked ( nCheck==1 ), unchecked ( nCheck==0 ) or undetermined ( nCheck==2 ). Please note you can also override the CExtGridWnd::OnGridCellSetCheck() virtual method in the grid class. Inside your overridden method just analyze the nCheck parameter and make the cell read-only (and add the button) when it equal to 0. Otherwiese remove the button and read-only style.
|
|