Professional UI Solutions
Site Map   /  Register


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.

Forums » Prof-UIS Tech Support » data grid with CExtGridCellNumber cells Collapse All
Subject Author Date
Claudiu Tanasescu Apr 14, 2010 - 2:37 AM

I created a grid and I have filled with CExtGridCellNumber type cells.

I have some questions about...

1) How to change the type of numerical data of this type of cell (ex. int, double) before placing a value in the cell?

2) How to obtain data directly to the type, for example if we have a CExtGridCellNumber with integer data, is possible obtain directly the integer value of the cell? Or you can only get as text and then convert it?

3) If the cell is of type CExtGridCellNumber, for example with double data, when someone type characters, how alert the user that only actual data type are accepted, is there a function that checks for incoming data type?

4) Is there a function that checks if a numerical value is within certain limits?

5) The grid have iterators of cells? To use it to extract data from the grid to another container ...

Technical Support Apr 16, 2010 - 4:54 AM

The CExtGridCellNumber grid cell is based on the CExtGridCellVariant grid cell. The CExtGridCellNumber grid cell is derived from the CExtGridCellEx basic grid cell class and from the VARIANT data structure containing data of any type the OLE variant can support. The CExtGridCellNumber grid cell expects the VARIANT::vt property has some numeric data type (VT_I4, VT_UI4, VT_R4, VT_I8). The CExtGridCellVariant::_VariantAssign() methods allow you to initialize the variant grid cell with any type of data.

You can verify input in the in-place active editor control of any grid cell both in the grid cell class and in the grid control class. The CExtGridCell::OnInplaceControlTextInputVerify() and CExtGridWnd::OnGridCellInplaceControlTextInputVerify() virtual methods are invoked both during text typing and before the in-pace editor window closing. You can completely control the text input and implement the numeric value limits.

If you need to extract data of particular cell type, then you should downcast the CExtGridCell * pointer returned by the CExtGridWnd::GridCellGet() method to particular cell type and invoke its methods. But the CExtGridCell::GetVariant() and CExtGridCell::TextGet() methods work with all the grid cells and you can get cell data as text string or as VARIANT data structure. The CExtGridWnd::GridCellGet() allows you to get any grid cell’s pointer. The CExtGridBaseWnd::SelectionGetFirst(), CExtGridBaseWnd::SelectionGetLast(), CExtGridBaseWnd::SelectionGetNext() and CExtGridBaseWnd::SelectionGetForCellNextPrev() methods allow you to search the selected grid cells. The CExtGridBaseWnd::SelectionRangeGet() method returns the CExtGR2D object describing the selected region in the grid control. The CExtGR2D class supports various iterations, region combining operations and region hit testing.