pebble
  • Tutorials
  • Get the SDK
  • Guides
  • Documentation
  • Examples
  • Community
  • Blog
  • More
Privacy
Cookies
Publish

Pebble C API

  • Pebble C API
  • Pebble JavaScript API
  • PebbleKit JS
  • PebbleKit iOS
  • PebbleKit Android
  • Foundation
    • App
    • App Communication
    • App Glance
    • AppMessage
    • AppSync
    • AppWorker
    • DataLogging
    • DataStructures
      • UUID
    • Dictation
    • Dictionary
    • Event Service
      • AccelerometerService
      • AppFocusService
      • BatteryStateService
      • CompassService
      • ConnectionService
      • HealthService
      • TickTimerService
    • Exit Reason
    • Internationalization
    • Launch Reason
    • Logging
    • Math
    • Memory Management
    • Platform
    • Resources
      • File Formats
    • Storage
    • Timer
    • Wakeup
    • Wall Time
    • WatchInfo
    • Rocky
  • Graphics
    • Draw Commands
    • Drawing Paths
    • Drawing Primitives
    • Drawing Text
    • Fonts
    • Graphics Context
    • Graphics Types
      • Color Definitions
  • User Interface
    • Animation
      • PropertyAnimation
    • Clicks
    • Layers
      • ActionBarLayer
      • BitmapLayer
      • MenuLayer
      • RotBitmapLayer
      • ScrollLayer
      • SimpleMenuLayer
      • StatusBarLayer
      • TextLayer
    • Light
    • Preferences
    • UnobstructedArea
    • Vibes
    • Window
      • ActionMenu
      • NumberWindow
    • Window Stack
  • Standard C
    • Format
    • Locale
    • Math
    • Memory
    • String
    • Time

NumberWindow

A ready-made Window prompting the user to pick a number.

Function Documentation

NumberWindow * number_window_create(const char * label, NumberWindowCallbacks callbacks, void * callback_context)

Creates a new NumberWindow on the heap and initalizes it with the default values.

Note

The number window is not pushed to the window stack. Use window_stack_push() to do this.

Parameters

label

The title or prompt to display in the NumberWindow. Must be long-lived and cannot be stack-allocated.

callbacks

The callbacks

callback_context

Pointer to application specific data that is passed

Returns

A pointer to the NumberWindow. NULL if the NumberWindow could not be created

void number_window_destroy(NumberWindow * number_window)

Destroys a NumberWindow previously created by number_window_create.

void number_window_set_label(NumberWindow * numberwindow, const char * label)

Sets the text of the title or prompt label.

Parameters

numberwindow

Pointer to the NumberWindow for which to set the label text

label

The new label text. Must be long-lived and cannot be stack-allocated.

void number_window_set_max(NumberWindow * numberwindow, int32_t max)

Sets the maximum value this field can hold.

Parameters

numberwindow

Pointer to the NumberWindow for which to set the maximum value

max

The maximum value

void number_window_set_min(NumberWindow * numberwindow, int32_t min)

Sets the minimum value this field can hold.

Parameters

numberwindow

Pointer to the NumberWindow for which to set the minimum value

min

The minimum value

void number_window_set_value(NumberWindow * numberwindow, int32_t value)

Sets the current value of the field.

Parameters

numberwindow

Pointer to the NumberWindow for which to set the current value

value

The new current value

void number_window_set_step_size(NumberWindow * numberwindow, int32_t step)

Sets the amount by which to increment/decrement by on a button click.

Parameters

numberwindow

Pointer to the NumberWindow for which to set the step increment

step

The new step increment

int32_t number_window_get_value(const NumberWindow * numberwindow)

Gets the current value.

Parameters

numberwindow

Pointer to the NumberWindow for which to get the current value

Returns

The current value

Window * number_window_get_window(NumberWindow * numberwindow)

Gets the "root" Window of the number window.

Parameters

numberwindow

Pointer to the NumberWindow for which to get the "root" Window

Returns

The "root" Window of the number window.

Data Structure Documentation

struct NumberWindowCallbacks

Data structure containing all the callbacks for a NumberWindow.

Data Fields

NumberWindowCallback incremented

Callback that gets called as the value is incremented. Optional, leave NULL if unused.

NumberWindowCallback decremented

Callback that gets called as the value is decremented. Optional, leave NULL if unused.

NumberWindowCallback selected

Callback that gets called as the value is confirmed, in other words the SELECT button is clicked. Optional, leave NULL if unused.

Typedef Documentation

typedef struct NumberWindow NumberWindow
typedef void(* NumberWindowCallback)(struct NumberWindow *number_window, void *context)

Function signature for NumberWindow callbacks.

Need some help?

Functions

  • number_window_create
  • number_window_destroy
  • number_window_set_label
  • number_window_set_max
  • number_window_set_min
  • number_window_set_value
  • number_window_set_step_size
  • number_window_get_value
  • number_window_get_window

Data Structures

  • NumberWindowCallbacks

Typedefs

  • NumberWindow
  • NumberWindowCallback

Getting Help

Do you have questions about the Pebble SDK?

Do you need some help understanding something on this page?

You can either take advantage of our awesome developer community and check out the SDK Help forums, or you can send us a message through the website!