Hi all,
I need some help figuring this out. The goal is to have a cool time-widget for the GtkReactive.jl
package:
- with say 3 fields: hours, minutes, and seconds
- always shows a valid time (e.g. no 63 seconds)
- allows for scrolling, say, the seconds beyond 59 so that the seconds nullify and the minutes widget will go up one unit
Here’s what I have so far:
h = spinbutton(0:23, orientation = "v")
m = spinbutton(0:60, orientation = "v")
s = spinbutton(0:60, orientation = "v")
These get processed into Time
:
t = map(h, m, s) do hh, mm, ss
Dates.Time(0,0,0) + Dates.Hour(hh) + Dates.Minute(mm) + Dates.Second(ss)
end
Good. Now no matter what the user puts into those widgets I’ll end up with a valid time, and therefore valid values for the individual widgets (satisfying feature #3 in the list above):
h2 = map(x -> Dates.value(Dates.Hour(x)), t)
m2 = map(x -> Dates.value(Dates.Minute(x)), t)
s2 = map(x -> Dates.value(Dates.Second(x)), t)
But here’s the problem, how do I update the original widgets without eliciting a never-ending loop?
For a bit more information see feature request #18 in GtkReactive.jl
.
Appreciate any help!