Integer numeric widget
PtWidget → PtBasic → PtContainer → PtCompound → PtNumeric → PtNumericInteger
For more information, see the diagram of the widget hierarchy.
<photon/PtNumericInteger.h>
The PtNumericInteger class lets you specify integer values between given minimum and maximum values.
A PtScrollbar widget is included to let you increase or decrease the value by a set amount. You can use the resources defined by PtNumeric to add prefix and suffix strings, and use comma separators (e.g. 1,000).
If you want the value to be displayed as a hexadecimal value, set Pt_NUMERIC_HEXADECIMAL in Pt_ARG_NUMERIC_FLAGS.
Resource | C type | Pt type | Default |
---|---|---|---|
Pt_ARG_NUMERIC_INCREMENT | int | Scalar | 1 |
Pt_ARG_NUMERIC_MAX | int | Scalar | INT_MAX |
Pt_ARG_NUMERIC_MIN | int | Scalar | INT_MIN |
Pt_ARG_NUMERIC_VALUE | int | Scalar | 0 |
Pt_CB_NUMERIC_CHANGED | PtCallback_t * | Link | NULL |
C type | Pt type | Default |
---|---|---|
int | Scalar | 1 |
The amount by which to increase or decrease the value when the up/down buttons are pressed.
C type | Pt type | Default |
---|---|---|
int | Scalar | INT_MAX |
The maximum value for the widget.
C type | Pt type | Default |
---|---|---|
int | Scalar | INT_MIN |
The minimum value for the widget.
C type | Pt type | Default |
---|---|---|
int | Scalar | 0 |
The current value of the widget.
C type | Pt type | Default |
---|---|---|
PtCallback_t * | Link | NULL |
A list of PtCallback_t structures that define the callbacks invoked when the widget's value changes.
If the widget has the Pt_CALLBACKS_ACTIVE bit set in its Pt_ARG_FLAGS resource, these callbacks are also invoked when your application changes the Pt_ARG_NUMERIC_VALUE with a call to PtSetResource() or PtSetResources(), or if the Pt_ARG_NUMERIC_VALUE is changed indirectly by a change to Pt_ARG_NUMERIC_MIN or Pt_ARG_NUMERIC_MAX.
Each callback is passed a PtCallbackInfo_t structure that contains at least the following members:
These callbacks should return Pt_CONTINUE.
Unless the resources are already defined in PtNumericInteger, the PtNumericInteger class uses the resources of its exported subordinate child, PtScrollbar.
The PtNumericInteger class “inherits” all the resources of its exported subordinate child. Where PtNumericInteger and its exported subordinate child both define resources having the same name, the resource defined in PtNumericInteger takes precedence.
If the widget modifies an inherited resource, the “Default override” column indicates the new value. This modification affects any subclasses of the widget.
If cbinfo->reason_subtype is Pt_NUMERIC_ACTIVATE, the callback was invoked because you changed the value and pressed Enter while in PtNumericInteger's text field.