|
//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 interface class CCustomEditInPlace : public Dapfor::GUI::CEditInPlace { public: //Pass 'true' to the base class. In this case this interface will be automatically destroyed in the destructor of the CGrid CCustomEditInPlace() : Dapfor::GUI::CEditInPlace(true) { } //Overrides the CEditInPlace's method virtual bool CanApply(Dapfor::GUI::CEditInPlace::StopReason reason) const { switch(reason) { //Set a new value to the data object when the next operations occur case Dapfor::GUI::CEditInPlace::LostFocus: case Dapfor::GUI::CEditInPlace::KeyUp: case Dapfor::GUI::CEditInPlace::KeyDown: case Dapfor::GUI::CEditInPlace::KeyLeft: case Dapfor::GUI::CEditInPlace::KeyRight: case Dapfor::GUI::CEditInPlace::KeyTab: case Dapfor::GUI::CEditInPlace::KeyShiftTab: case Dapfor::GUI::CEditInPlace::KeyCtrlTab: return true; 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 next: //Set a new implementation of the edit in place interface //The grid will destroy this object in its own destructor m_Grid.SetEditInPlace(new CCustomEditInPlace());
| Copyright Dapfor 2007-2009 | Generated on Sat Jan 30 15:01:23 2010 for MFCGrid by 1.5.5 |