Rocksolid Light

Welcome to Rocksolid Light

mail  files  register  newsreader  groups  login

Message-ID:  

"And remember: Evil will always prevail, because Good is dumb." -- Spaceballs


devel / comp.lang.tcl / Re: menu entryconfigure numerical labels

SubjectAuthor
* menu entryconfigure numerical labelsRalf Fassel
`* menu entryconfigure numerical labelsMike Griffiths
 `- menu entryconfigure numerical labelsRalf Fassel

1
menu entryconfigure numerical labels

<yga5y3e8qzv.fsf@panther.akutech-local.de>

  copy mid

https://news.novabbs.org/devel/article-flat.php?id=12568&group=comp.lang.tcl#12568

  copy link   Newsgroups: comp.lang.tcl
Path: i2pn2.org!i2pn.org!weretis.net!feeder8.news.weretis.net!fu-berlin.de!uni-berlin.de!individual.net!not-for-mail
From: ralfixx@gmx.de (Ralf Fassel)
Newsgroups: comp.lang.tcl
Subject: menu entryconfigure numerical labels
Date: Tue, 10 Oct 2023 16:57:24 +0200
Lines: 27
Message-ID: <yga5y3e8qzv.fsf@panther.akutech-local.de>
Mime-Version: 1.0
Content-Type: text/plain
X-Trace: individual.net qjq47tBfv7TuSPx0vClFAgO2ZouNcPRt4bvf4DefOo8E6r8iU=
Cancel-Lock: sha1:8rJstKTwrmexSTVCcM7mxspEfMA= sha1:0NTJmDemirTpvFspfTAXxGFiOug= sha256:rq3vkmDfXyGa5MJL95pRp0p/JU4IPzmam+VHd8+DYlE=
User-Agent: Gnus/5.13 (Gnus v5.13) Emacs/27.2 (gnu/linux)
 by: Ralf Fassel - Tue, 10 Oct 2023 14:57 UTC

I have a menu like this:

menu .m -tearoff false
.m add radiobutton -label 2 -value 2
.m add radiobutton -label foo -value foo

.m entrycget 0 -value
2
.m entrycget 1 -value
foo

Now

.m entryconfigure 2 -value two

fails to configure the first menu entry, since the "2" is taken as
numerical index, and thus the last entry is configured instead:

% .m entrycget 0 -value
2
% .m entrycget 1 -value
two

Is there some way to "configure-by-numerical-label" other than iterating
over the menu and checking whether the label matches the desired value?

R'

Re: menu entryconfigure numerical labels

<c6a5a2d9-0049-4fc4-ad95-93dbd204dc6cn@googlegroups.com>

  copy mid

https://news.novabbs.org/devel/article-flat.php?id=12569&group=comp.lang.tcl#12569

  copy link   Newsgroups: comp.lang.tcl
X-Received: by 2002:a05:6214:a71:b0:66c:fda5:dae2 with SMTP id ef17-20020a0562140a7100b0066cfda5dae2mr39214qvb.12.1696972274912;
Tue, 10 Oct 2023 14:11:14 -0700 (PDT)
X-Received: by 2002:a05:6870:b7b5:b0:1dd:7381:e05 with SMTP id
ed53-20020a056870b7b500b001dd73810e05mr8248834oab.3.1696972274635; Tue, 10
Oct 2023 14:11:14 -0700 (PDT)
Path: i2pn2.org!rocksolid2!news.neodome.net!usenet.blueworldhosting.com!diablo1.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: Tue, 10 Oct 2023 14:11:14 -0700 (PDT)
In-Reply-To: <yga5y3e8qzv.fsf@panther.akutech-local.de>
Injection-Info: google-groups.googlegroups.com; posting-host=81.99.101.178; posting-account=hbOuAgoAAACCTxHaAgRboJbA2XUYvKy2
NNTP-Posting-Host: 81.99.101.178
References: <yga5y3e8qzv.fsf@panther.akutech-local.de>
User-Agent: G2/1.0
MIME-Version: 1.0
Message-ID: <c6a5a2d9-0049-4fc4-ad95-93dbd204dc6cn@googlegroups.com>
Subject: Re: menu entryconfigure numerical labels
From: mike@keyboardzombie.com (Mike Griffiths)
Injection-Date: Tue, 10 Oct 2023 21:11:14 +0000
Content-Type: text/plain; charset="UTF-8"
Content-Transfer-Encoding: quoted-printable
X-Received-Bytes: 2278
 by: Mike Griffiths - Tue, 10 Oct 2023 21:11 UTC

On Tuesday, 10 October 2023 at 15:57:30 UTC+1, Ralf Fassel wrote:
> I have a menu like this:
>
> menu .m -tearoff false
> .m add radiobutton -label 2 -value 2
> .m add radiobutton -label foo -value foo
>
> .m entrycget 0 -value
> 2
> .m entrycget 1 -value
> foo
>
> Now
>
> .m entryconfigure 2 -value two
>
> fails to configure the first menu entry, since the "2" is taken as
> numerical index, and thus the last entry is configured instead:
>
> % .m entrycget 0 -value
> 2
> % .m entrycget 1 -value
> two
>
> Is there some way to "configure-by-numerical-label" other than iterating
> over the menu and checking whether the label matches the desired value?
>
> R'
The index for menus follow the rules for [string match]; as it does various forms of matching (including wildcard), you can use \ to indicate a literal character. So if you use {\2} for your index, it doesn't get treated as a numerical index and instead looks for a label matching the literal character "2".

..m entrycget {\2} -value

Re: menu entryconfigure numerical labels

<yga1qe18ri5.fsf@panther.akutech-local.de>

  copy mid

https://news.novabbs.org/devel/article-flat.php?id=12571&group=comp.lang.tcl#12571

  copy link   Newsgroups: comp.lang.tcl
Path: i2pn2.org!i2pn.org!news.swapon.de!fu-berlin.de!uni-berlin.de!individual.net!not-for-mail
From: ralfixx@gmx.de (Ralf Fassel)
Newsgroups: comp.lang.tcl
Subject: Re: menu entryconfigure numerical labels
Date: Wed, 11 Oct 2023 10:58:42 +0200
Lines: 27
Message-ID: <yga1qe18ri5.fsf@panther.akutech-local.de>
References: <yga5y3e8qzv.fsf@panther.akutech-local.de>
<c6a5a2d9-0049-4fc4-ad95-93dbd204dc6cn@googlegroups.com>
Mime-Version: 1.0
Content-Type: text/plain
X-Trace: individual.net ho8WIzNL3G0i7oCwrjEPyQVsCy9uT/l7T+4JraQ0lzXr8e/6I=
Cancel-Lock: sha1:H5Nf4ltwdHOCiZFQjolmAtFcpNQ= sha1:X55gqPlkr1+9P8faNVa20jSOqqc= sha256:pKqkiQHX3zkGzWxA5xzyeLw7XMoinFGTLJuKxLX/OAA=
User-Agent: Gnus/5.13 (Gnus v5.13) Emacs/27.2 (gnu/linux)
 by: Ralf Fassel - Wed, 11 Oct 2023 08:58 UTC

* Mike Griffiths <mike@keyboardzombie.com>
| On Tuesday, 10 October 2023 at 15:57:30 UTC+1, Ralf Fassel wrote:
| > I have a menu like this:
| >
| > menu .m -tearoff false
| > .m add radiobutton -label 2 -value 2
| > .m add radiobutton -label foo -value foo
| >
--<snip-snip>--
| >
| > Is there some way to "configure-by-numerical-label" other than iterating
| > over the menu and checking whether the label matches the desired value?
| >
| The index for menus follow the rules for [string match]; as it does
| various forms of matching (including wildcard), you can use \ to
| indicate a literal character. So if you use {\2} for your index, it
| doesn't get treated as a numerical index and instead looks for a label
| matching the literal character "2".
>
| .m entrycget {\2} -value

Mike,
great, exactly what I am looking for! And since this is documented
behaviour, it is not even a 'hack' :-)

TNX
R'

1
server_pubkey.txt

rocksolid light 0.9.8
clearnet tor