Professional UI Solutions
Site Map   /  Register
 
 

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.

Forums » Elegant Grid Tech Support » CExtGridCellUpDown with doubles Collapse All
Subject Author Date
s p Jan 15, 2008 - 8:22 AM

Hello!
How can I use CExtGridCellUpDown in a property grid, so that it works with double-s not int-s?
SP

Technical Support Jan 18, 2008 - 8:36 AM

It is not completely clear what you mean by "double-s" and "int-s". If you need a CExtGridCellUpDown which uses double values instead of integers, it is easy to do.

Actually CExtGridCellUpDown extends CExtGridCellNumber. The latter is based on VARIANT and allows you to use the following VARIANT types to store a numeric value:

- VT_I1                                                                              
- VT_I2
- VT_UI1
- VT_UI2
- VT_I4
- VT_UI4
- VT_I8
- VT_UI8
- VT_R4
- VT_R8
- VT_INT
- VT_UINT
- VT_BOOL
- VT_ERROR
- VT_DATE
- VT_CY
- VT_DECIMAL
As you can see, you can use any of these types including doubles (VT_R8).

Here is a code snippet which assigns a double value to a cell:
CExtGridCellUpDown * pCellUpDown =
 STATIC_DOWNCAST(
  CExtGridCellUpDown,
  m_wndGrid.GridCellGet(
   0,
   1L,
   0,
   0,
   RUNTIME_CLASS(CExtGridCellUpDown)
   )
 );
pCellUpDown ->_VariantAssign( DOUBLE(0.000000123456789) );
Note that, by default, increasing/decreasing operations change the cell value by 1 (one) and, if you need to change this behavior, you should override the following virtual methods:
CExtGridCellVariant::OnValueDecrement(
            LPVARIANT pvarValue
            )

CExtGridCellVariant::OnValueIncrement(
            LPVARIANT pvarValue
            )