At Tue, 23 Jan 2018 09:18:33 -0800 (PST) Alexandru <
alexandr...@meshparts.de> wrote:
>
> Am Dienstag, 23. Januar 2018 18:15:09 UTC+1 schrieb Rich:
> > Alexandru <
alexandr...@meshparts.de> wrote:
> > > Am Dienstag, 23. Januar 2018 17:54:05 UTC+1 schrieb Harald Oehlmann:
> > >> Am 23.01.2018 um 17:50 schrieb Alexandru:
> > >> > Am Dienstag, 23. Januar 2018 17:40:43 UTC+1 schrieb Andreas Leitgeb:
> > >> >> Alexandru <
alexandr...@meshparts.de> wrote:
> > >> >>> Am Dienstag, 23. Januar 2018 15:43:46 UTC+1 schrieb sled...@gmail.=
> com:
> > >> >>>> On Monday, January 22, 2018 at 10:34:23 PM UTC-5, Alexandru wrote=
> :
> > >> >>>>> What would be the best, simplest, most general way to block doub=
> le-clicks on buttons? Per default, a double-click triggers two times the wi=
> dget command, which is actually not wanted.
> > >> >>>> Implement two bindings: single click and double click. The bindin=
> g on the regular press will match on the first press of the 'double'. Then =
> the command bound to the double will match on the second (accidental) press=
> . This script associated with the second command could then be a "no op"
> > >> >>>> bind . <1> {desired script}
> > >> >>>> bind . <Double-1> {do nothing}
> > >> >>> Thaks, I will check this.
> > >> >>
> > >> >> That doesn't seem to work. It will call the "do nothing" and
> > >> >> still call the -command a second time (assuming that "do nothing"
> > >> >> is changed to a real noop).
> > >> >>
> > >> >> Another approach against too fast re-execution of the command=20
> > >> >> would be setting it to disabled, then set up an "after ..."
> > >> >> timer to re-enable the button.
> > >> >>
> > >> >> If the visual flicker of disabling/enabling the button is not
> > >> >> acceptable for the user, just check some global/namespaced=20
> > >> >> variable...
> > >> >> if {$::running} { return }
> > >> >> set ::running 1; after 1000 { set ::running 0 }
> > >> >> ...
> > >> >=20
> > >> > It does work. See previous post.=20
> > >> >=20
> > >> > Cheers
> > >> > Alexandru
> > >> >=20
> > >>=20
> > >> I would always end bindings with a "break" to avoid the other bindings
> > >> in the binding chain to run.
> > >>=20
> > >> So:
> > >> bind $w <Double-1> break
> > >>=20
> > >> Harald
> > >=20
> > > Hi Harald,
> > >=20
> > > what is the explanation for bind $w <Double-1> {return 1} still working=
> . What is the difference between return and break in this context of bindin=
> gs?
> >=20
> > man n bind:
> >=20
> > The continue and break commands may be used inside a binding script to
> > control the processing of matching scripts. If continue is invoked,
> > then the current binding script is terminated but Tk will continue
> > processing binding scripts associated with other tag's. If the break
> > command is invoked within a binding script, then that script terminates
> > and no other scripts will be invoked for the event.
>
> I was actually aware about the meaning of break and continue. My quastion w=
> as about return. Observed behavior: Returning any value has the same effect=
> as break. But why?
>
In some contexts, return is a kind of "break". Like break, return interupts
the flow of control.
--
Robert Heller --
978-544-6933
Deepwoods Software -- Custom Software Services
http://www.deepsoft.com/ -- Linux Administration Services
hel...@deepsoft.com -- Webhosting Services