-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathdate_input_demo.go
More file actions
35 lines (28 loc) · 863 Bytes
/
date_input_demo.go
File metadata and controls
35 lines (28 loc) · 863 Bytes
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
package main
import (
"fmt"
"time"
"fyne.io/fyne/v2"
"fyne.io/fyne/v2/widget"
"fyne.io/fyne/v2/container"
)
func CreateDateInputWidget(app fyne.App, win fyne.Window) *fyne.Container {
dateEntry := NewJDateInputWidget(app, win)
label := widget.NewLabel("Current Selection")
button := widget.NewButton("Show", func() { on_show_click(dateEntry, label) } )
helpText := `
1. Press UP/Down/Left/Right Arrow to change the date.
2. Space to set current date.
`
helpTextWidget := widget.NewTextGridFromString(helpText)
return container.NewVBox(dateEntry, button, label, widget.NewSeparator(), helpTextWidget)
}
func on_show_click(d *JDateInputWidget, l *widget.Label) {
var msg string
if d.GetDate().IsZero() == true {
msg = "No Input"
} else {
msg = fmt.Sprintf("Your input is : %s", d.GetDate().Format(time.DateOnly))
}
l.SetText(msg)
}