EZwgl (4.32 Spin Button)

## 4.32 Spin Button

A spin button is a composite widget, it consists of an entry and a scroll button. A spin button is used to cycle through a series of string type inputs. The value is controled by a spin function of type

      char *(func)(int old_idx, int new_idx, void *clientData);

When the left mouse button is pressed over the arrow button, the spin function `func` will be called to compute the next choice. The value will then be displayed in the entry widget. Here is an example.

    static char *months[]={"January", "Febrary", "March", "April", "May",
                           "June", "July", "August", "September", "October",
                           "November", "December"};
    static char *spinFunc(int last, int current, void *data)
    {
      current %= 12;
      if(current < 0) current += 12;
      return(months[current]);
    }

    main(int ac, char **av)
    {
      EZ_Widget *spin;

      EZ_Initialize(ac, av, 0);

      spin  = EZ_CreateWidget(EZ_WIDGET_SPIN_BUTTON,   NULL,
                              EZ_SPIN_VALUE,           3,   "April",
                              EZ_SPIN_FUNCTION,        nextF, NULL,
                              0);
      EZ_DisplayWidget(spin);
      EZ_EventMainLoop();
    }

### Widget Info

Symbolic widget type | EZ_WIDGET_SPIN_BUTTON
Default class name | "SpinButton"
Default instance name | "spinButton"

### Widget Interface Routines

`char *EZ_GetSpinButtonValue(EZ_Widget *spinButton);`

return the spin button selection.

`void EZ_SetupSpinButton(EZ_Widget *spinBtn, char *value,`

`char *(nextValue)(int,int void *));`

setup a spin button.

### Screenshot

### Resources

Config_Option | ResourceName | DefaultValue
EZ_CLASS | class | `"Locator"`
EZ_NAME | name | `"locator"`

EZ_X | x |
EZ_Y | y |
EZ_WIDTH | width |
EZ_HEIGHT | height |

EZ_LOCATION | location |
EZ_SIZE | size |
EZ_GEOMETRY | geometry |

EZ_WIDTH_HINT | widthHint |
EZ_HEIGHT_HINT | heightHint |
EZ_SIZE_HINT | sizeHint |

EZ_BORDER_WIDTH | borderWidth | `2`
EZ_BORDER_TYPE | borderType | `sunken`
EZ_FOCUS_PAD | focusPad | `2`

EZ_EXPAND | expand | `false`
EZ_PROPAGATE | propagate | `true`
EZ_TRANSIENT | transient | `false`

EZ_CURSOR | cursor | `"XC_left_ptr"`
EZ_BUBBLE_STRING | bubbleString | `null`

EZ_MOTION_CALLBACK | N/A | `null null`
EZ_DESTROY_CALLBACK | N/A | `null null`
EZ_EVENT_HANDLER | N/A | `null null`

EZ_FOREGROUND | foreground | `"black"`
EZ_BACKGROUND | background | `"gray74`
EZ_BG_IMAGE_FILE | bgImageFile | `null`
EZ_BG_PIXMAP | N/A | `none`
EZ_SHAPED_WINDOW | shapedWindow | `false`
EZ_SHAPE_FILE | shapeFile | `NULL`
EZ_SHAPE_PIXMAP | N/A | `NULL`

EZ_BG_IMAGE_FILE_B | bgImageFileB | `null`
EZ_BG_PIXMAP_B | N/A | `none`
EZ_CLIENT_PTR_DATA | N/A | `null`
EZ_CLIENT_INT_DATA | clientIntData | `0`

EZ_DND_DRAG_CURSOR | dndDragCursor | `none`
EZ_DND_BUBBLE_STRING | dndBubbleString | `null`

EZ_SPIN_VALUE | spinValue | `0, NULL`
EZ_SPIN_FUNCTION | N/A | `NULL,NULL`

HTML Documentation Maintainance:`Arturo Espinosa <arturo@nuclecu.unam.mx>`