Rocksolid Light

Welcome to RetroBBS

mail  files  register  newsreader  groups  login

Message-ID:  

Love makes the world go 'round, with a little help from intrinsic angular momentum.


devel / comp.lang.tcl / Re: binding <Enter> to Button class

SubjectAuthor
* binding <Enter> to Button classxol odho
`* Re: binding <Enter> to Button classSchelte
 `* Re: binding <Enter> to Button classxol odho
  `* Re: binding <Enter> to Button classGerald Lester
   `* Re: binding <Enter> to Button classnemethi
    `- Re: binding <Enter> to Button classGerald Lester

1
binding <Enter> to Button class

<d8239ce1-acf4-4e07-b8d8-62c95a98afddn@googlegroups.com>

  copy mid

https://www.rocksolidbbs.com/devel/article-flat.php?id=19707&group=comp.lang.tcl#19707

  copy link   Newsgroups: comp.lang.tcl
X-Received: by 2002:a05:620a:319a:b0:6b5:eba5:a1c8 with SMTP id bi26-20020a05620a319a00b006b5eba5a1c8mr17462788qkb.292.1658948767346;
Wed, 27 Jul 2022 12:06:07 -0700 (PDT)
X-Received: by 2002:a05:6808:bce:b0:33a:c6b9:69f3 with SMTP id
o14-20020a0568080bce00b0033ac6b969f3mr2526119oik.51.1658948767156; Wed, 27
Jul 2022 12:06:07 -0700 (PDT)
Path: i2pn2.org!i2pn.org!usenet.blueworldhosting.com!feed1.usenet.blueworldhosting.com!peer02.iad!feed-me.highwinds-media.com!news.highwinds-media.com!news-out.google.com!nntp.google.com!postnews.google.com!google-groups.googlegroups.com!not-for-mail
Newsgroups: comp.lang.tcl
Date: Wed, 27 Jul 2022 12:06:06 -0700 (PDT)
Injection-Info: google-groups.googlegroups.com; posting-host=201.231.246.253; posting-account=DnakAAoAAAA9ZZlBDSXHBE9MWv_A1hHG
NNTP-Posting-Host: 201.231.246.253
User-Agent: G2/1.0
MIME-Version: 1.0
Message-ID: <d8239ce1-acf4-4e07-b8d8-62c95a98afddn@googlegroups.com>
Subject: binding <Enter> to Button class
From: xolodho@gmail.com (xol odho)
Injection-Date: Wed, 27 Jul 2022 19:06:07 +0000
Content-Type: text/plain; charset="UTF-8"
X-Received-Bytes: 1751
 by: xol odho - Wed, 27 Jul 2022 19:06 UTC

Hello. Learning some Tk basics here.

It seems that binding <Enter> to the Button class does not work as I would expect. For instance, this:

pack [button .b1 -text b1 -command {exit 1}]
bind Button <Enter> {puts "Button <Enter> : %W"}

When the mouse cursor enters the button area, it doesn't highlight properly, and does not respond to click so the command is not executed. However, if the event is bound to the specific button widget then it works ok:

pack [button .b1 -text b1 -command {exit 1}]
bind .b1 <Enter> {puts ".b1 <Enter>"}

Now the button reacts properly.

So why is the behavior different? In both cases it is the same proc that is bound to the same <Enter> event, just the binding tag is different. I find this confusing. What's wrong?

Re: binding <Enter> to Button class

<nnd$749383f4$13d16eb5@50a51409f9ce3d94>

  copy mid

https://www.rocksolidbbs.com/devel/article-flat.php?id=19708&group=comp.lang.tcl#19708

  copy link   Newsgroups: comp.lang.tcl
Date: Wed, 27 Jul 2022 22:17:58 +0200
MIME-Version: 1.0
User-Agent: Mozilla/5.0 (X11; Linux x86_64; rv:102.0) Gecko/20100101
Thunderbird/102.0.2
Subject: Re: binding <Enter> to Button class
Content-Language: nl-NL, en-US
Newsgroups: comp.lang.tcl
References: <d8239ce1-acf4-4e07-b8d8-62c95a98afddn@googlegroups.com>
From: nospam@wanadoo.nl (Schelte)
In-Reply-To: <d8239ce1-acf4-4e07-b8d8-62c95a98afddn@googlegroups.com>
Content-Type: text/plain; charset=UTF-8; format=flowed
Content-Transfer-Encoding: 7bit
Message-ID: <nnd$749383f4$13d16eb5@50a51409f9ce3d94>
Organization: KPN B.V.
Path: i2pn2.org!i2pn.org!weretis.net!feeder8.news.weretis.net!newsreader4.netcologne.de!news.netcologne.de!peer01.ams1!peer.ams1.xlned.com!news.xlned.com!peer03.ams4!peer.am4.highwinds-media.com!news.highwinds-media.com!feed.abavia.com!abe004.abavia.com!abp003.abavia.com!news.kpn.nl!not-for-mail
Lines: 18
Injection-Date: Wed, 27 Jul 2022 22:17:58 +0200
Injection-Info: news.kpn.nl; mail-complaints-to="abuse@kpn.com"
X-Received-Bytes: 1561
 by: Schelte - Wed, 27 Jul 2022 20:17 UTC

On 27/07/2022 21:06, xol odho wrote:
> So why is the behavior different? In both cases it is the same proc that is bound to the same <Enter> event, just the binding tag is different. I find this confusing. What's wrong?

The difference is that by binding to the <Enter> event in the Button
class, you overwrite the normal class binding that takes care of
highlighting the button and setting up variables needed when clicking
the button. That's why those things stop working.

If you would add your binding instead of replacing the standard binding,
it works (note the "+"):

bind Button <Enter> {+puts "Button <Enter> : %W"}

Schelte.

Re: binding <Enter> to Button class

<e337fcd7-c367-48a0-9a5e-a67530293e9cn@googlegroups.com>

  copy mid

https://www.rocksolidbbs.com/devel/article-flat.php?id=19709&group=comp.lang.tcl#19709

  copy link   Newsgroups: comp.lang.tcl
X-Received: by 2002:a05:622a:5d2:b0:31f:229d:441d with SMTP id d18-20020a05622a05d200b0031f229d441dmr20521764qtb.277.1658961096067;
Wed, 27 Jul 2022 15:31:36 -0700 (PDT)
X-Received: by 2002:a05:6870:a1aa:b0:10d:a546:8aa3 with SMTP id
a42-20020a056870a1aa00b0010da5468aa3mr3444170oaf.287.1658961095828; Wed, 27
Jul 2022 15:31:35 -0700 (PDT)
Path: i2pn2.org!i2pn.org!usenet.blueworldhosting.com!feed1.usenet.blueworldhosting.com!peer02.iad!feed-me.highwinds-media.com!news.highwinds-media.com!news-out.google.com!nntp.google.com!postnews.google.com!google-groups.googlegroups.com!not-for-mail
Newsgroups: comp.lang.tcl
Date: Wed, 27 Jul 2022 15:31:35 -0700 (PDT)
In-Reply-To: <nnd$749383f4$13d16eb5@50a51409f9ce3d94>
Injection-Info: google-groups.googlegroups.com; posting-host=201.231.246.253; posting-account=DnakAAoAAAA9ZZlBDSXHBE9MWv_A1hHG
NNTP-Posting-Host: 201.231.246.253
References: <d8239ce1-acf4-4e07-b8d8-62c95a98afddn@googlegroups.com> <nnd$749383f4$13d16eb5@50a51409f9ce3d94>
User-Agent: G2/1.0
MIME-Version: 1.0
Message-ID: <e337fcd7-c367-48a0-9a5e-a67530293e9cn@googlegroups.com>
Subject: Re: binding <Enter> to Button class
From: xolodho@gmail.com (xol odho)
Injection-Date: Wed, 27 Jul 2022 22:31:36 +0000
Content-Type: text/plain; charset="UTF-8"
X-Received-Bytes: 1374
 by: xol odho - Wed, 27 Jul 2022 22:31 UTC

I see! Hey, many thanks for the tip, it works now. I had a suspicion that binding <Enter> to the whole Button class was disrupting something. Now it's clear. So one has to be careful with these types of general bindings.

Re: binding <Enter> to Button class

<tbu9hu$14bl$1@gioia.aioe.org>

  copy mid

https://www.rocksolidbbs.com/devel/article-flat.php?id=19710&group=comp.lang.tcl#19710

  copy link   Newsgroups: comp.lang.tcl
Path: i2pn2.org!i2pn.org!aioe.org!ndwByO+NwnqaVZyoWW3vEw.user.46.165.242.75.POSTED!not-for-mail
From: Gerald.Lester@KnG-Consulting.net (Gerald Lester)
Newsgroups: comp.lang.tcl
Subject: Re: binding <Enter> to Button class
Date: Thu, 28 Jul 2022 10:21:34 -0500
Organization: KnG Consulting, LLC
Message-ID: <tbu9hu$14bl$1@gioia.aioe.org>
References: <d8239ce1-acf4-4e07-b8d8-62c95a98afddn@googlegroups.com>
<nnd$749383f4$13d16eb5@50a51409f9ce3d94>
<e337fcd7-c367-48a0-9a5e-a67530293e9cn@googlegroups.com>
Mime-Version: 1.0
Content-Type: text/plain; charset=UTF-8; format=flowed
Content-Transfer-Encoding: 7bit
Injection-Info: gioia.aioe.org; logging-data="37237"; posting-host="ndwByO+NwnqaVZyoWW3vEw.user.gioia.aioe.org"; mail-complaints-to="abuse@aioe.org";
User-Agent: Mozilla/5.0 (X11; Linux x86_64; rv:91.0) Gecko/20100101
Thunderbird/91.9.1
Content-Language: en-US
X-Notice: Filtered by postfilter v. 0.9.2
 by: Gerald Lester - Thu, 28 Jul 2022 15:21 UTC

On 7/27/22 17:31, xol odho wrote:
> I see! Hey, many thanks for the tip, it works now. I had a suspicion that binding <Enter> to the whole Button class was disrupting something. Now it's clear. So one has to be careful with these types of general bindings.

Generally it is a good idea to look at what bindings exist on a class
before doing a binding to it.

bind <Button>

will return all the events currently bound to the Button class.

--
+----------------------------------------------------------------------+
| Gerald W. Lester, President, KNG Consulting LLC |
| Email: Gerald.Lester@kng-consulting.net |
+----------------------------------------------------------------------+

Re: binding <Enter> to Button class

<tbud59$sipe$1@tota-refugium.de>

  copy mid

https://www.rocksolidbbs.com/devel/article-flat.php?id=19711&group=comp.lang.tcl#19711

  copy link   Newsgroups: comp.lang.tcl
Path: i2pn2.org!i2pn.org!weretis.net!feeder8.news.weretis.net!reader5.news.weretis.net!news.tota-refugium.de!.POSTED!not-for-mail
From: csaba.nemethi@t-online.de (nemethi)
Newsgroups: comp.lang.tcl
Subject: Re: binding <Enter> to Button class
Date: Thu, 28 Jul 2022 18:23:04 +0200
Message-ID: <tbud59$sipe$1@tota-refugium.de>
References: <d8239ce1-acf4-4e07-b8d8-62c95a98afddn@googlegroups.com>
<nnd$749383f4$13d16eb5@50a51409f9ce3d94>
<e337fcd7-c367-48a0-9a5e-a67530293e9cn@googlegroups.com>
<tbu9hu$14bl$1@gioia.aioe.org>
Mime-Version: 1.0
Content-Type: text/plain; charset=UTF-8; format=flowed
Content-Transfer-Encoding: 7bit
Injection-Date: Thu, 28 Jul 2022 16:23:05 -0000 (UTC)
Injection-Info: tota-refugium.de;
logging-data="936750"; mail-complaints-to="abuse@news.tota-refugium.de"
User-Agent: Mozilla/5.0 (X11; Linux x86_64; rv:91.0) Gecko/20100101
Thunderbird/91.11.0
Cancel-Lock: sha1:9qa8833Ja7c/4kofyheMZjwEvrk=
Content-Language: en-US
In-Reply-To: <tbu9hu$14bl$1@gioia.aioe.org>
X-User-ID: eJwFwQcBACAIBMBKrGfEAZX+EbyDOvsJc7hhsWL9erJxc3aoXPEStBjWx1IpODFLV0ciKz8nFREJ
 by: nemethi - Thu, 28 Jul 2022 16:23 UTC

Am 28.07.22 um 17:21 schrieb Gerald Lester:
> On 7/27/22 17:31, xol odho wrote:
>> I see! Hey, many thanks for the tip, it works now. I had a suspicion
>> that binding <Enter> to the whole Button class was disrupting
>> something. Now it's clear. So one has to be careful with these types
>> of general bindings.
>
> Generally it is a good idea to look at what bindings exist on a class
> before doing a binding to it.
>
> bind <Button>
>
> will return all the events currently bound to the Button class.
>
>

You meant surely

bind Button

rather than

bind <Button>

--
Csaba Nemethi https://www.nemethi.de mailto:csaba.nemethi@t-online.de

Re: binding <Enter> to Button class

<tc0mau$7s9$1@gioia.aioe.org>

  copy mid

https://www.rocksolidbbs.com/devel/article-flat.php?id=19720&group=comp.lang.tcl#19720

  copy link   Newsgroups: comp.lang.tcl
Path: i2pn2.org!i2pn.org!aioe.org!cBsT+zJBMPI3rOTnuO9Llg.user.46.165.242.75.POSTED!not-for-mail
From: Gerald.Lester@KnG-Consulting.net (Gerald Lester)
Newsgroups: comp.lang.tcl
Subject: Re: binding <Enter> to Button class
Date: Fri, 29 Jul 2022 08:11:57 -0500
Organization: KnG Consulting, LLC
Message-ID: <tc0mau$7s9$1@gioia.aioe.org>
References: <d8239ce1-acf4-4e07-b8d8-62c95a98afddn@googlegroups.com>
<nnd$749383f4$13d16eb5@50a51409f9ce3d94>
<e337fcd7-c367-48a0-9a5e-a67530293e9cn@googlegroups.com>
<tbu9hu$14bl$1@gioia.aioe.org> <tbud59$sipe$1@tota-refugium.de>
Mime-Version: 1.0
Content-Type: text/plain; charset=UTF-8; format=flowed
Content-Transfer-Encoding: 8bit
Injection-Info: gioia.aioe.org; logging-data="8073"; posting-host="cBsT+zJBMPI3rOTnuO9Llg.user.gioia.aioe.org"; mail-complaints-to="abuse@aioe.org";
User-Agent: Mozilla/5.0 (X11; Linux x86_64; rv:91.0) Gecko/20100101
Thunderbird/91.9.1
X-Notice: Filtered by postfilter v. 0.9.2
Content-Language: en-US
 by: Gerald Lester - Fri, 29 Jul 2022 13:11 UTC

On 7/28/22 11:23, nemethi wrote:
> Am 28.07.22 um 17:21 schrieb Gerald Lester:
>> On 7/27/22 17:31, xol odho wrote:
>>> I see! Hey, many thanks for the tip, it works now. I had a suspicion
>>> that binding <Enter> to the whole Button class was disrupting
>>> something. Now it's clear. So one has to be careful with these types
>>> of general bindings.
>>
>> Generally it is a good idea to look at what bindings exist on a class
>> before doing a binding to it.
>>
>> bind <Button>
>>
>> will return all the events currently bound to the Button class.
>>
>>
>
> You meant surely
>
>     bind Button
>
> rather than
>
>     bind <Button>
>
Yeap

--
+----------------------------------------------------------------------+
| Gerald W. Lester, President, KNG Consulting LLC |
| Email: Gerald.Lester@kng-consulting.net |
+----------------------------------------------------------------------+


devel / comp.lang.tcl / Re: binding <Enter> to Button class

1
server_pubkey.txt

rocksolid light 0.9.81
clearnet tor