OnValueChanging

CNi

Function Group
OnValueChanging() Functions    Prev page: OnValueChangedNext page: Numeric Edit Events    
Function Declared in:
NiNumEditEvents.h

'Declaration' icon -- Shortcut to top of page. Declaration

void OnValueChanging(
    VARIANT FAR* NewValue,
    VARIANT FAR* AttemptedValue,
    VARIANT FAR* PreviousValue,
    BOOL OutOfRange);

'Description' icon -- Shortcut to top of page. Description

Generated when the value of the numeric edit control is about to change. That is, the value of the control has been entered but not set.

Note: Modify thenewValue parameter within your event handler to change the value that is set in the numeric edit control.

Shortcut to top of page. Parameters

VARIANT FAR* NewValue

Contains the new value for the control.

Note: If you alter the value of this parameter within your event code, the numeric edit control is set to this altered value.

VARIANT FAR* AttemptedValue

Contains the value that the user tried to set in the control.

Notes:

1. You should use this value to construct a CNiVariant to get to the variant's data.

2. This is often the same as the newValue parameter, and is most useful for custom range checking or validation.

VARIANT FAR* PreviousValue

Contains the previous value of the numeric edit control.

Note: This parameter should be used to construct a CNiVariant to get to the variant's data.

BOOL OutOfRange

Contains true if newValue is not within the range specified by the Minimum and Maximum properties of the numeric edit control.

'See Also' icon -- Shortcut to top of page. See Also

Shortcut to top of page. Example

void OnValueChanging (VARIANT FAR* NewValue, VARIANT FAR* AttemptedValue, VARIANT FAR* PreviousValue, BOOL OutOfRange) {
   double Tmp = CNiVariant(NewValue);
   // New value outside the range 0-100?
   if (Tmp < 0 || Tmp > 100) {
       // Set the value to 50
       *NewValue = CNiVariant(50);
   }
}