Sujet : Re: Androwish Label Font
De : csaba.nemethi (at) *nospam* t-online.de (nemethi)
Groupes : comp.lang.tclDate : 28. May 2025, 18:44:12
Autres entêtes
Message-ID : <1017i1c$2lu5$1@tota-refugium.de>
References : 1 2 3 4 5
User-Agent : Mozilla Thunderbird
Am 28.05.25 um 18:38 schrieb undroidwish:
On 5/28/25 12:50, nemethi wrote:
... To your question related to the scrollableframe: Try the following code:
>
foreach class {ScrollableframeMf ScrollableframeCf} isCf {0 1} {
bind $class <<FingerDown>> \
[list scrollutil::sf::onButton1 %W %x %y $isCf]
bind $class <<FingerMotion>> \
[list scrollutil::sf::onB1Motion %W %x %y $isCf]
bind $class <<FingerUp>> \
[list scrollutil::sf::onButtonRelease1 %W $isCf]
}
...
Csaba, please let's try with Button-2 bindings, since this is what
AndroWish emulates for swipe gestures e.g. when dragging a Text widget,
so your proposal becomes:
foreach class {ScrollableframeMf ScrollableframeCf} isCf {0 1} {
bind $class <2> \
[list scrollutil::sf::onButton1 %W %x %y $isCf]
bind $class <B2-Motion> \
[list scrollutil::sf::onB1Motion %W %x %y $isCf]
bind $class <ButtonRelease-2> \
[list scrollutil::sf::onButtonRelease1 %W $isCf]
}
The <<Finger...>> virtual events are more complex since they allow
for multi touch and pressure.
See https://androwish.org/home/wiki?name=sdltk+command for more
detailed information.
Hope this helps,
Christian
Many thanks, Christian! In the meantime I have found out why my proposed solution fails and how to make it work, but your proposal to use Button-2 bindings rather than <<Finger...>> virtual events appears to be the better solution (I didn't know that the swipe gestures emulate <Button-2>, <B2-Motion> and <ButtonRelease-2> events).
Just for completeness, here is my corrected solution using <<Finger...>> events:
foreach class {ScrollableframeMf ScrollableframeCf} isCf {0 1} {
bind $class <<FingerDown>> { set motionCount 0 }
bind $class <<FingerMotion>> [format {
if {[incr motionCount] == 1} {
scrollutil::sf::onButton1 %%W %%x %%y %d
} else {
scrollutil::sf::onB1Motion %%W %%x %%y %d
}
} $isCf $isCf]
bind $class <<FingerUp>> [list scrollutil::sf::onButtonRelease1 %W $isCf]
}
If I understand the manual correctly, <<FingerDown>> events have no %x and %y fields, hence the scrollutil::sf::onButton1 proc is now invoked on the first <<FingerMotion>> rather than on the <<FingerDown>> event. This makes the trick. But, as said, your proposal is in IMHO the better one.
-- Csaba Nemethi https://www.nemethi.de mailto:csaba.nemethi@t-online.de