Google Groups no longer supports new Usenet posts or subscriptions. Historical content remains viewable.
Dismiss

bind and modifier

39 views
Skip to first unread message

Nicolas

unread,
Apr 10, 2018, 10:24:23 AM4/10/18
to
Hi,
is theres' a way to know if a modifier is pressed while binding against <ButtonPress-1> ?

many thanks,
nicolas

Harald Oehlmann

unread,
Apr 10, 2018, 10:35:50 AM4/10/18
to
IMHO two possibilities:

- do multiple binds with all modifiers
- eventually twapi has a method to check for modifiers on windows
operating system

Enjoy,
Harald

Nicolas

unread,
Apr 10, 2018, 11:51:15 AM4/10/18
to
Hi Harald,
Thank you for your answer.
I did it with multiple bind and it works as expected and I would like as much as possible to avoid twapi.
I was wondering if thanks to a magical % one could know if a modifier is pressed.

Best regards
nicolas

Harald Oehlmann

unread,
Apr 10, 2018, 12:23:36 PM4/10/18
to
Am 10.04.2018 um 17:51 schrieb Nicolas:
> I was wondering if thanks to a magical % one could know if a modifier is pressed.

Not to my knowledge...

Any stuff I see with multiple modifiers use multiple binds.
A good example is the drag and drop bindings in BWidget - around 6 of
them...

Enjoy,
Harald

briang

unread,
Apr 10, 2018, 6:23:47 PM4/10/18
to
Use the %s state field. The integer has bit encodings for the various modifier keys. You'll have to experiment to see which is which:

toplevel .x
bind .x <Key> {puts "state=%s k=%k A=%A"}
bind .x <Button> {puts "state=%s b=%b"}

-Brian

Nicolas

unread,
Apr 11, 2018, 12:43:52 AM4/11/18
to
et voila :)
thanks Brian
thanks Harald.

++

Harald Oehlmann

unread,
Apr 11, 2018, 3:12:08 AM4/11/18
to
Yes, great tip !

Here is an analysis which works on which platform:
http://wiki.tcl.tk/4238
apparently, control, alt, shift works on all platforms.

Great news !

Thanks,
Harald
0 new messages