3D PLM Enterprise Architecture

User Interface - Dialogs

CATDlgSpinner

Enters numeric values
Quick Reference

CATDialog
  |
  +---CATDlgControl
        |
        +---CATDlgSpinner

The Spinner
CATDlgSpinner.jpg (1383 bytes) 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.


Styles
Name Description
default The spinner field cannot be edited.
CATDlgSpnEntry The spinner field can be edited. If the user keys in a value out of the spinner range, this value is not accepted and the previous valid value is used instead.
CATDlgSpnUserIncrement Prevents from automatically incrementing or decrementing the displayed value when the user selects the arrows. You need to provide you own methods instead, for example to increment or decrement with a parameter different from the step.
CATDlgSpnDouble The entered number must be a double precision floating number.

[Top]


Events
Notification Method Sent when
CATDlgSpinnerModifyNotification GetSpinnerModifyNotification Whenever the current value is modified, whatever the means used to modify it, such as arrows or field edition..
Available with CATDlgSpnUserIncrement only:
CATDlgSpinnerBtnUpNotification GetSpinnerBtnDownNotification Whenever the down (decrement) arrow  is clicked.
CATDlgSpinnerBtnDownNotification GetSpinnerBtnUpNotification Whenever the up (increment) arrow  is clicked.

[Top]


Programmer's Guide

The spinner is dedicated to executing a command when it is clicked.

[Top]

Constructing a Spinner

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]

Managing the Value Range

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]

Managing the Value Display

To help manage the value display in the spinner, you can use the following methods, except with floating and free increment spinners:

[Top]

Managing the Selection

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]

Managing the Arrow Sensitivity

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]

Setting a Callback on a Spinner

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->GetSpinnerModifyNotification(),   // notification
  (CATCommand)&Spinner::MethodToExecute,          // method to execute 
  CATCommandClientData iUsefulData);              // useful data for this method 

[Top]

Setting a Title to a Spinner

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]


History

Version: 1 [Jan 2000] Document created
[Top]

Copyright © 2000, Dassault Systèmes. All rights reserved.