|
|
|
|
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 |
|
Peter Meier
|
May 2, 2008 - 6:42 AM
|
Hi all I am looking for the following features on grid cells: - Limiting the minimum and maximum values of number or spin cells
- Modifying the fractional part of number/spin cells with the spin control
- Masking input and output text, i.e. "99.99.99 E" (like coordinates) Is any of these features already available --> did I miss something?
If not, are such features planned?
Or can I program this on my own with subclassing? Regards - Bioter
|
|
Peter Meier
|
May 8, 2008 - 1:48 PM
|
Thank you for that.I managed to get 1) working. I also used the OnInplaceControlTextInputVerify in order to limit values entered manually. For 2) and 3) I guess that I will need more info. Is there a way to influence the display of the text while the inplace editor is active? I made my CellUpDown class displaying numbers like "22.00", but while editing with the keyboard, it always shows "22", without the trailing zeroes. I initialize the cell like this:
pCell->SetNumDigits(iPlaces);
pCell->SetAutoNumDigits(false);true);
Further, for allowing the Up/Down buttons to modify the correct part of the number (that parts containing the caret), I would need the following:
- have the inplace editor stay open when an Up/Down button is pressed
- retrieve the caret position
- replace the text of the open inplace editor
Is all this possible somehow? (if not I will simply forget it)
pCell->SetAllowTrailingZeroes( Regards - Peter
|
|
Technical Support
|
May 11, 2008 - 11:29 AM
|
1. The number cell string representation depends on the locale settings and can differ in different OSes. Therefore in the cell inplace editor the value always have the standardized format. But if you want to have the text in the inplace editor exactly the same as you see when the cell editor is not active just override the OnQueryTextForInplaceControl virtual method in the following way: void CYourGridCellNumber::OnQueryTextForInplaceControl(
CExtSafeString & strCopy
) const
{
ASSERT_VALID( this );
if( IsInvisible()
|| IsUndefined()
|| IsEmpty()
)
{
strCopy = _T("");
return;
}
TextGet( strCopy, this );
// change the decimal separator (point) with the value,
// specified in the locale information
CExtSafeString sDecimalSep;
CExtGridCellNumberBase::OnQueryDecimalSeparator( sDecimalSep );
strCopy.Replace( _T("."), sDecimalSep );
strCopy.Replace( _T(","), sDecimalSep );
} 2. Unfortunately you cannot simultaneously scroll the cell value with the Up/Down buttons and have the inplace editor active. This is by design.
|
|
Technical Support
|
May 5, 2008 - 6:52 AM
|
There is no direct way to do what you looking for, but it is not difficult to achieve this manually.
1. Here is the link to the forum thread where it is discussed.
2. By default, the spin button changes the integer part of the cell’s value. But you can change this behavior by overriding these two methods: OnValueIncrement() and OnValueDecrement() . Please take a look at how these methods are implemented in different cell classes.
3. You can override the CExtGridCell::TextGet() method and implement the desired text formatting yourself.
|
|