The grid provides a possibility to customize all edit in place operations. The best way is to use the CEditInPlace interface
//This example shows how to apply values to the data object when a cell loses //the focus//1. Lets define the custom edit in place interfaceclass CCustomEditInPlace : public Dapfor::GUI::CEditInPlace
{
public:
//Pass 'true' to the base class. In this case this interface is automatically destroyed in the destructor of the CGrid
CCustomEditInPlace() : Dapfor::GUI::CEditInPlace(true)
{
}
//Overrides the CEditInPlace's methodvirtualbool CanApply(Dapfor::GUI::CEditInPlace::StopReason reason) const{
switch(reason)
{
//Set a new value to the data object when the next operations occurcaseDapfor::GUI::CEditInPlace::LostFocus:
caseDapfor::GUI::CEditInPlace::KeyUp:
caseDapfor::GUI::CEditInPlace::KeyDown:
caseDapfor::GUI::CEditInPlace::KeyLeft:
caseDapfor::GUI::CEditInPlace::KeyRight:
caseDapfor::GUI::CEditInPlace::KeyTab:
caseDapfor::GUI::CEditInPlace::KeyShiftTab:
caseDapfor::GUI::CEditInPlace::KeyCtrlTab:
returntrue;
default:
//Otherwise, the default implementation will apply a new value in case of the next events://(KeyReturn, ComboSelEndOk, MouseLBDblClick and UserStop)return CEditInPlace::CanApply(reason);
}
}
};
//2. To set a new implementation use the following://Set a new implementation of the edit in place interface//The grid destroys this object in its own destructor
m_Grid.SetEditInPlace(new CCustomEditInPlace());