Julian H J Loaring
unread,Jan 19, 2012, 10:28:14 AM1/19/12You do not have permission to delete messages in this group
Either email addresses are anonymous for this group or you need the view member email addresses permission to view the original message
to
I recently did a teacup update and this pulled in a new version of
widget::dateentry, version 0.95. Unfortunately this has changed the
behavior of the drop down calendar. It is no longer possible to
quickly skip through months & years by using the embeded calendar's
arrow buttons because the drop down is removed after each button
press.
The cause of this is the following binding
bind $dropbox <ButtonPress> [subst -nocommands {
if {[string first "$dropbox" [winfo containing %X %Y]] != 0} {
$win unpost
} else {
$win DateAccepted
}
}]
This is trying to see if the user clicks outside of dropdown calendar.
If so it closes the window otherwise it assumes the user has selected
a new date. The latter case ain't necessarily so if it was an arrow
button pressed... (IMHO)
The underlying problem is that the embeded widget::calendar doesn't
let the wrapper know what item is under the mouse.
A glorious hack which knows way too much about the calendar ;)
===============================================
1) Change the binding
bind $dropbox <ButtonPress> [mymethod dropboxClick $dropbox %X %Y %x
%y]
2) Add the new callback
method dropboxClick {w X Y x y} {
if {[string first "$dropbox" [winfo containing $X $Y]] != 0} {
$win unpost
} else {
set c $w.calendar
if {[$c find closest $x $y] > 4} {
$win DateAccepted
}
}
}
3) And whilst my sleeves are rolled up, use the mouse wheel to scroll
by month
bind $dropbox <MouseWheel> [mymethod dropboxWheel $dropbox %D]
method dropboxWheel {w d} {
set c $w.calendar
if {$d < 0} {
$c adjust 0 -1 0
} else {
$c adjust 0 1 0
}
}
kind regards
Julian H J Loaring