3D PLM Enterprise Architecture |
User Interface - Dialogs |
CATDlgSpinnerEnters numeric values |
Quick Reference |
CATDialog | +---CATDlgControl | +---CATDlgSpinner
The spinner allows the end user to select a numerical value among a discrete list of values, ranging from a start value to an end value. The value can be incremented or decremented by clicking the arrows. The up arrow is dedicated to incrementing while the down arrow is for decrementing. You set the start and end values as floats, while you set the step number either as an int or as a float. The step value is the difference between start and end values, divided by the number of steps. The default values ranges from 1 to 10 with 10 steps. |
Use spinner whenever you propose to the end user to enter a numerical value selected from a discrete list.
[Top]
[Top]
The spinner is dedicated to executing a command when it is clicked.
[Top]
These four kinds of spinner can be constructed, according to their different styles. Styles can be concatenated using the "|" character.
Non editable spinner |
_pNEdSpinner = new CATDlgSpinner (iParent, iName); |
Editable spinner |
_pEdSpinner = new CATDlgSpinner (iParent, iName, CATDlgSpnEntry); |
Free increment spinner |
_pFreeSpinner = new CATDlgSpinner (iParent, iName, CATDlgSpnUserIncrement); |
Floating spinner |
_pFloatSpinner = new CATDlgSpinner (iParent, iName, CATDlgSpnDouble); |
Editable and floating spinner |
_pEdFloatSpinner = new CATDlgSpinner (iParent, iName, CATDlgSpnEntry|CATDlgSpnDouble); |
[Top]
You can retrieve the value range and step with GetRange
, and
them with SetRange
, except with floating and free increment
spinners:
float Start, End; int Step; _pSpinner->GetRange(Start, End, Step); ... Start = 0; End = 100; Step = 20; _pSpinner->SetRange(Start, End, Step); |
For floating spinners, use GetMinMaxStep
and SetMinMaxStep
instead:
float Start, End, Step; _pFloatSpinner ->GetMinMaxStep(Start, End, Step); ... Start = 0.0; End = 100.0; Step = 20.0; _pFloatSpinner ->SetMinMaxStep(Start, End, Step); |
[Top]
To help manage the value display in the spinner, you can use the following methods, except with floating and free increment spinners:
GetFormat
and SetFormat
:
get format |
char * Format; Format = _pSpinner->GetFormat(); // returns "%f" |
set format |
Format = "%d"; _pSpinner->SetFormat(Format); |
GetVisibleTextWidth
and SetVisibleTextWidth
:
get text width |
int NumberOfVisibleChar; NumberOfVisibleChar = _pSpinner->GetVisibleTextWidth(); |
set text width |
NumberOfVisibleChar = 20; _pSpinner->SetVisibleTextWidth(NumberOfVisibleChar); |
The visible text width is expressed in number of characters.
[Top]
You can manage the the current value with the methods GetCurrentValue
and SetCurrentValue
:
get value |
float Value; Value = _pSpinner->GetCurrentValue(); ... |
set value |
Value = 20.5; _pSpinner->SetCurrentValue(Value, Notify); |
The visible text width is expressed in number of characters. Set the
parameter Notify
to a non null value if you want the corresponding
notification to be sent. Otherwise set to 0, no notification is sent.
With floating spinners, you can use the methods GetValue
and SetValue
.
The value is expressed in MKS units:
get value |
double Value = _pFloatSpinner->GetValue(); ... |
set value |
Value = 156.12; _pFloatSpinner->SetValue(Value, Notify); |
Set the parameter Notify
to a non null value if you want the
corresponding notification to be sent. Otherwise set to 0, no notification is
sent.
With free increment spinners, you can use the methods GetCurrentText
and SetCurrentText
. The text is a CATUnicodeString instances:
get text |
CATUnicodeString Text = _pFreeSpinner->GetCurrentText(); ... |
set text |
Text = "NewText"; _pFreeSpinner->SetCurrentText(Text, Notify); |
Set the parameter Notify
to a non null value if you want the
corresponding notification to be sent. Otherwise set to 0, no notification is
sent.
[Top]
With free increment spinners, you can manage the sensitivity of each arrow
with the methods GetButtonUpSensitivity
and SetButtonUpSensitivity
for the up arrow, and using the methods GetButtonDownSensitivity
and SetButtonDownSensivity
for the down arrow. The state of an
arrow that is sensitive to the user action is CATDlgEnable
.
Otherwise this state is CATDlgDisable
. For example for the top
arrow:
get sensitivity |
if (_pSpinner->GetButtonUpSensitivity() == CATDlgEnable) ... ; |
disable |
_pSpinner->SetButtonUpSensitivity(CATDlgDisable); |
[Top]
Set a callback on a non editable spinner to be informed whenever the end user modifies the spinner value as follows:
AddAnalyseNotificationCB(
_pNEdSpinner, // spinner
_pNEdSpinner->
|
[Top]
The spinner title should be set by the resource file using a key built with the identifier you declare as the second parameter of the spinner constructor. This title is never displayed. If you want to comment the choice available from the spinner in your dialog, use a label.
[Top]
Version: 1 [Jan 2000] | Document created |
[Top] |
Copyright © 2000, Dassault Systèmes. All rights reserved.