Prev: interp alias vs proc...
Next: is there a lightweight markup language rendering engine using textwidget
From: Zhang Weiwu on 8 Jun 2010 23:45 as written on http://wiki.tcl.tk/10002 event generate .c <Enter> update set X [expr [winfo pointerx .] - [winfo rootx .]] set Y [expr [winfo pointery .] - [winfo rooty .]] event generate .c <ButtonPress-1> -x $X -y $Y This looks really complicated. One would assume something like this: event generate .c <<Click>> In my script I have to deal with a button, this works for me. I had to ask if this is the "right" way to do it though: event generate .b <1> ; event generate .b <ButtonRelease-1> I tried, that with only <1> does not work. I tried, that with only <ButtonRelease-1> does not work.
From: Uwe Klein on 9 Jun 2010 07:40 Zhang Weiwu wrote: > as written on http://wiki.tcl.tk/10002 > > event generate .c <Enter> > update > set X [expr [winfo pointerx .] - [winfo rootx .]] > set Y [expr [winfo pointery .] - [winfo rooty .]] > event generate .c <ButtonPress-1> -x $X -y $Y > > This looks really complicated. One would assume something like this: > > event generate .c <<Click>> > > > In my script I have to deal with a button, this works for me. I had to > ask if this is the "right" way to do it though: > > event generate .b <1> ; event generate .b <ButtonRelease-1> > > I tried, that with only <1> does not work. > I tried, that with only <ButtonRelease-1> does not work. ..b invoke should work. # > wish % button .b -command "puts push" ..b % pack .b % .b invoke push % uwe
From: Donald Arseneau on 9 Jun 2010 16:41 On Jun 8, 8:45 pm, Zhang Weiwu <zhangweiwu+J...(a)realss.com> wrote: > as written onhttp://wiki.tcl.tk/10002 > > event generate .c <Enter> > update > set X [expr [winfo pointerx .] - [winfo rootx .]] > set Y [expr [winfo pointery .] - [winfo rooty .]] > event generate .c <ButtonPress-1> -x $X -y $Y > > This looks really complicated. One would assume something like this: > > event generate .c <<Click>> > > In my script I have to deal with a button, this works for me. I had to > ask if this is the "right" way to do it though: > > event generate .b <1> ; event generate .b <ButtonRelease-1> > > I tried, that with only <1> does not work. > I tried, that with only <ButtonRelease-1> does not work. I presume you are trying to produce visual feedback of the button depressing. When I have done that, I have used the hot-key character to generate the press (event generate .exit <Alt-x>). The $X and $Y handling in your example gives most of the complexity but is not usually necessary. If you are interacting with a drawing application on a canvas it would be useful, but if you have no desire to provide a position or to click specifically under the mouse pointer, then just leave it out, as you did. If you want visual feedback, do event generate .b <1> ; after 100 {event generate .b <ButtonRelease-1>} For your <<Click>> just do bind all <<Click>> { event generate %W <1> after 100 {event generate %W <ButtonRelease-1>} }
From: Zhang Weiwu on 10 Jun 2010 05:28 On 2010年06月10日 04:41, Donald Arseneau wrote: > The $X and $Y handling in your example gives most of the complexity > but is not usually necessary. Thank you very much for your prompt answer. My example is taken from http://wiki.tcl.tk/10002 It looks obvious the quality of wiki.tcl.tk now is below the usenet, as I asked many questions here with far better answer by looking at the topic discussed on wiki. This should not happen, as wiki might be the first place people look for information. I really hope wiki can be improved towards a certain quality standard as have been done in wikipedia, instead of a messier discussion forum than usenet.
From: Larry W. Virden on 11 Jun 2010 07:45
On Jun 10, 5:28 am, Zhang Weiwu <zhangweiwu+J...(a)realss.com> wrote: > I really hope wiki can be > improved towards a certain quality standard as have been done in > wikipedia, instead of a messier discussion forum than usenet. The way any wiki improves is for people who find useful information missing take a moment and add the information. If they find inaccurate information, they spend a few minutes to add a note offering a correction. Otherwise, it is more likely that changes that one wishes were there will unlikely to appear. |