|
|
|
|
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 |
|
tera tera
|
Oct 14, 2008 - 7:22 PM
|
Hello. 
I want to make the movement of the focus impossibility to a specific cell.
Please teach a method.
|
|
Technical Support
|
Oct 21, 2008 - 12:58 PM
|
We changed the source code of the CMyMlGrid::FocusSet() virtual method in your project: CPoint CMyMlGrid::FocusSet(
const POINT & ptNewFocus,
bool bEnsureVisibleColumn, // = true
bool bEnsureVisibleRow, // = true
bool bResetSelectionToFocus, // = true
bool bRedraw, // = true
bool * p_bCanceled // = NULL
)
{
ASSERT_VALID( this );
CPoint ptNewFocus2;
ptNewFocus2 = ptNewFocus;
if( ptNewFocus2.y >= 5 )
ptNewFocus2.y = 4;
return CExtGridWnd::FocusSet( ptNewFocus2, bEnsureVisibleColumn, bEnsureVisibleRow, bResetSelectionToFocus, bRedraw, p_bCanceled );
} We also added a _SelectionAreaConvert() virtual method into the CMyMlGrid class. Here is the in-class method declaration: CRect & _SelectionAreaConvert( CRect & rcArea ) const;
Here is the method implementation:
CRect & CMyMlGrid::_SelectionAreaConvert( CRect & rcArea ) const
{
ASSERT_VALID( this );
if( rcArea.top >= 5 )
rcArea.top = 4;
if( rcArea.bottom >= 5 )
rcArea.bottom = 4;
return rcArea;
} Now it seems the grid window works as you want it to.
|
|
Technical Support
|
Oct 15, 2008 - 11:36 AM
|
You should override the CExtGridBaseWnd::FocusSet() virtual method in your CExtGridWnd () -derived class.
CPoint CYourGridWnd::FocusSet(
const POINT & ptNewFocus,
bool bEnsureVisibleColumn, // = true
bool bEnsureVisibleRow, // = true
bool bResetSelectionToFocus, // = true
bool bRedraw, // = true
bool * p_bCanceled // = NULL
)
{
ASSERT_VALID( this );
CPoint ptOldFocus( FocusGet() );
bool bAllowFocusSetting = . . . // compute whether focus can be set to the grid cell at the ptNewFocus location
if( ! bAllowFocusSetting )
return ptOldFocus;
return
PARENT_CLASS_OF_CYourGridWnd_CLASS::FocusSet(
ptNewFocus,
bEnsureVisibleColumn,
bEnsureVisibleRow,
bResetSelectionToFocus,
bRedraw,
p_bCanceled
);
} This virtual method implementation makes particular grid cells unable to receive focus if bAllowFocusSetting is computed as false . Please note you also need to implement your keyboard processing for jumping over the grid cells that cannot receive focus.
|
|
tera tera
|
Oct 17, 2008 - 10:01 PM
|
|
|
tera tera
|
Oct 17, 2008 - 10:17 PM
|
There is the problem else
The movement restrictions of the cell come to be performed when I change __ESIS_STH_NONE in __ESIS_STH_ITEM.
However, there is a problem.
I move a cell to the removable place.
When I push Key and do it, a cell moves to the sixth line. 
|
|