Sujet : How to simulate a 'shift click' De : hgiese (at) *nospam* ratiosoft.com (Helmut Giese) Groupes :comp.lang.tcl Date : 25. Aug 2024, 16:55:07 Autres entêtes Organisation : ratiosoft Message-ID :<9bkmcjtdlvvv4o5vpvq2hobtmt3413okto@4ax.com> User-Agent : Forte Free Agent 1.93/32.576 English (American)
Hello out there, I can simulate a simple click but fail at a 'shift click'. Below is what I tried: --- package require Tk foreach ch [winfo children "."] {destroy $ch}
# create a test app set btn [ttk::button .btn -text "Press me"] pack $btn # add some bindings bind $btn <Button-1> {puts "Simple click"} bind $btn <Shift-Button-1> {puts "Shift click"}
focus $btn set x [winfo x $btn] ; set y [winfo y $btn] # place the mouse event generate "." <Motion> -x [incr x 50] -y [incr y 10] -warp 1
# now a 'shift click' if 1 { event generate $btn <KeyPress> -keysym Shift_L } else { event generate $btn <Key-Shift_L> } event generate $btn <ButtonPress-1> after 100 ; event generate $btn <ButtonRelease-1> event generate $btn <KeyRelease> -keysym Shift_L --- All I ever get is twice 'Simple click' - no matter whether I use <Key-Shift_L> or the longer form, wether I generate the keypress for $btn or ".". I am out of ideas what to try next. Any help will be greatly appreciated Helmut. PS: This is on Windows with Tcl 8.6.10