-
Notifications
You must be signed in to change notification settings - Fork 86
glgui datewheels
(glgui-datewheels g x y w h datemin datemax colorvalue colorshade bignumfont smlnumfont2 bigmonthfont smlmonthfont)
glgui-datewheels creates a date entry widget consisting of three vertical wheels for month, date (of month), and year. Using this widget, a user can enter a date between the datemin and datemax. Parameters, attributes and procedures in this widget are very similar to those available in glgui-datepicker.
Parameter | Description |
---|---|
g | Graphical User Interface (GUI) for this widget |
x | Lower left corner along the x-axis in pixels |
y | Lower left corner along the y-axis in pixels |
w | Width of the element in pixels |
h | Height of the element in pixels |
datemin | The minimum (earliest) date (in seconds) allowed to be chosen in the widget. If false, Jan 1st 1970 is used |
datemax | The maximum (latest) date (in seconds) allowed to be chosen in the widget. If false, then the end of the next year is used. |
colorvalue | Color of the selected value in the wheel |
colorshade | Wheel background color shade |
bignumfont | Font for the larger selected date and year value |
smlnumfont | Font for the smaller unselected date and year value |
bigmonthfont | Font for the larger selected month value |
smlmonthfont | Font for the smaller unselected month value |
Example 1: Creates datewheels at coordinates 20,20, width 260, height 160 with the date range limited between 1950 and 2015. The same font (arial_20) is used for all text, which is a black number on a gray wheel.
(set! dw (glgui-datewheels gui 20 20 260 (* 5 32)
(string->seconds "1950/01/01 00:00" "%Y/%m/%d %H:%M")
(string->seconds "2015/12/31 00:00" "%Y/%m/%d %H:%M")
Black (color-shade White 0.5) arial_20.fnt arial_20.fnt arial_20.fnt
arial_20.fnt))
Besides the parameters set in the above procedure, the widget has the following attributes that can be set using glgui-widget-set! and retrieved using glgui-widget-get:
Attribute | Default Value | Description |
---|---|---|
callback | False | If a procedure, this procedure is called when any of the wheels is changed to a new value, with the following two parameters: the Graphical User Interface and the widget. |
defaultvalue | Today's Date | This is initially set the same as the value. This is not used internally by the widget, but can be used to store a default date. |
displayorder | GUI_YEAR_MONTH_DAY | The order of the date wheels. This can also be set to GUI_DAY_MONTH_YEAR or GUI_MONTH_DAY_YEAR. |
hidden | False | If true, the widget is not displayed. |
topdown | True | By default, the larger numbers (latest dates) of the date wheels are displayed at the bottom of the wheels. By setting this to false, the values are reversed, with the larger numbers at the top. |
value | Today's Date | The current date to show on the wheels (in seconds). This defaults to today's date unless that is out of the range given, and then it uses the datemin or datemax, which ever is closest to today's date. |
Example 2: Retrieves the current date value of the datewheels created in Example 1. This is a Unix timestamp (number of seconds since January 1st, 1970).
(glgui-widget-get gui dw 'value)
Besides glgui-datewheels, there are three other procedures that operate on datewheels.
The following procedure changes the display of months from the default of "Jan", "Feb", etc to a list of strings you provide. It should be of length 12. This is useful for using a different language. This will affect all date wheels in the app.
(glgui-datewheel-update-months strlist)
Under normal circumstances the day, month, and year wheels do not allow the user to choose a date outside the datemin - datemax range or a date that does not exist. For example, if the range is from January 1st, 2013 to March 1st, 2013, the month wheel will not include months after March. Also, if the month wheel were set to February then the date wheel would only show values between 1 and 28, since there is no February 29th in 2013. If the wheels are arranged with the day wheel on the left and the user uses this wheel first these restrictions can be confusing. For example, if the date wheels display 15 Feb 2013 and the user wants to enter 30 Jan 2013, they will find that the 30 is not visible because Feb is chosen.
(glgui-datewheels-unlimited g wgt)
Calling the above procedure with the GUI and datewheels widget causes the day wheel to display all days from 1-31 and the month wheel to display all months regardless of the datemin and datemax parameters or even which days exist. Thus, a user changing the date from 15 Feb 2013 to 30 Jan 2013 could change the day and then the month rather than having to change the month first. It is useful to call this procedure when first displaying the date wheels.
Note: The effects of the above procedure are temporary. When the year wheel is adjusted, the month and day limits are automatically restricted depending on the year. Similarly, when the month wheel is adjusted, the day wheel limits are automatically restricted as well. If only the day wheel is adjusted after the above procedure this may lead to a date being chosen that is outside the datemin and datemax range or doesn't exist at all.
(glgui-datewheel-update-limits g wgt)
The above procedure enforces the datemin and datemax as well as the existence of dates across all three wheels. It will also adjust the currently selected date if need be to be within the new range shown on the wheels. It is useful to call this procedure when the user is done entering the date in the date wheels, to ensure this date is a valid one.
Note: This procedure is only needed if the procedure above it was called sometime before it.
-
- accelerometer
- alist
- audio
- audioaux
- base64
- btle-scan
- camera
- cdb
- cgi
- config
- csv
- curl
- digest
- dmtx
- download
- eventloop
- fcgi
- fft
- generalized-arrays
- gps
- graph
- gyro
- hidapi
- hpdf
- html
- httpsclient
- hybridapp
- json
- lmdb
- ln_core
- ln_glcore
- ln_glgui
- ln_store
- localization
- localization_gui
- localnotification
- magnetometer
- mdns
- mqtt
- mqtt-store
- multitouch
- oauth
- orientation
- p256ecdsa
- png
- portaudio
- pregexp
- pressure
- prime
- pushnotification
- redcap
- rsa
- rtaudio
- rupi
- rotation
- sanestring
- scheduler
- serial
- sets
- settings
- simplexnoise
- sqlite
- ssax
- syntax-case
- timestamp
- ttf
- uiform
- url
- uuid
- vibrate
- videoplayer
- watchdog
- website
- xml
- zip