Re: Tklib's tooltip poss bug in method although fine in a function

Liste des GroupesRevenir à cl tcl 
Sujet : Re: Tklib's tooltip poss bug in method although fine in a function
De : wortkarg3 (at) *nospam* yahoo.com (Harald Oehlmann)
Groupes : comp.lang.tcl
Date : 14. Jul 2024, 20:01:07
Autres entêtes
Organisation : A noiseless patient Spider
Message-ID : <v7179c$8ld2$1@dont-email.me>
References : 1 2 3 4 5
User-Agent : Mozilla Thunderbird
Am 14.07.2024 um 20:25 schrieb greg:
Am 14.07.24 um 15:43 schrieb Harald Oehlmann:
Am 14.07.2024 um 00:32 schrieb undroidwish:
On 7/13/24 18:21, greg wrote:
Am 13.07.24 um 12:50 schrieb Mark Summerfield:
In the script below, clicking button two works fine, but even hovering
over button One produces an error (shown at the end).
...
self may only be called from inside a method
...
"uplevel 2 { self }"
     (procedure "PackageNamespaceGet" line 17)
     invoked from within
"PackageNamespaceGet"
     (procedure "::msgcat::mc" line 2)
...
With tcl 8.6 with the helpers proc callback engine there is no error message.
The error occurs in 9.0.
As far as I understand, the handling has become more restrictive under 9.0.
...
>
My humble interpretation is that the problem lies in msgcat::mc fundamentally. Wrong assumptions over call context. Independent of
Tcl versions 8 or 9. But I might be mislead still. It is worth a
ticket anyways.
>
Dear Mark, dear Christian,
>
yes, both, msgcat and tooltip were recently changed.
>
Did you use tklib 0.8 release and TCL/Tk 9.0b2 ?
>
Those tickets are in both of them:
https://core.tcl-lang.org/tklib/info/3300362
https://core.tcl-lang.org/tcl/tktview/e02798626dfbcd7b33db
>
I tried your snippet with this and can reproduce the issue.
>
Here is the TCL ticket:
https://core.tcl-lang.org/tcl/tktview/91b3a5bb14e6e8ae1d1c5349af12e08879ea152d
and here the TkLib ticket:
https://core.tcl-lang.org/tklib/tktview/6e85abae9e49281b3b1212e25082f73239f7ea9e
>
I hope, we will find a solution. I am not familiar with TCL-OO and all of the TCLOO within msgcat came from others, sorry for that...
>
Thank you all and take care,
Harald
>
 In msgcat.tcl (Tcl 9.0)
 This means I no longer get the error message.
The namespace is being searched for at this point, and in my opinion self is not needed at all.
  proc ::msgcat::PackageNamespaceGet {} {
     set ns [uplevel 2 { namespace current }]
      if {![string match {::oo::*} $ns]} {
         # Not in object environment
         return $ns
     }
      # Check if we are within an object
     if {[info object isa object $ns]} {
         return [info object namespace $ns]
     } elseif {[info object isa class $ns]} {
         return [info object namespace $ns]
     } elseif {[info object isa metaclass $ns]} {
         return [info object namespace $ns]
     } elseif {[info object isa mixin $ns]} {
         return [info object namespace $ns]
     } elseif {[info object isa typeof $ns]} {
         return [info object namespace $ns]
     } else {
         # Not in an object or class environment
         return $ns
     }
}
 Gregor
 
Thanks a lot, Gregor.
Your proposed solution is now in a branch referenced in the ticket.
It would be great, if:
- there would be a test case for the issue
- the comment above the modification may be corrected. If I count the "if's" I get 7 cases and not 4.
Sorry, work always results in additional work...
Thanks for all,
Harald

Date Sujet#  Auteur
13 Jul 24 * Tklib's tooltip poss bug in method although fine in a function14Mark Summerfield
13 Jul 24 `* Re: Tklib's tooltip poss bug in method although fine in a function13greg
13 Jul 24  `* Re: Tklib's tooltip poss bug in method although fine in a function12undroidwish
13 Jul 24   +- Re: Tklib's tooltip poss bug in method although fine in a function1undroidwish
14 Jul 24   `* Re: Tklib's tooltip poss bug in method although fine in a function10Harald Oehlmann
14 Jul 24    +* Re: Tklib's tooltip poss bug in method although fine in a function4greg
14 Jul 24    i`* Re: Tklib's tooltip poss bug in method although fine in a function3Harald Oehlmann
15 Jul 24    i `* Re: Tklib's tooltip poss bug in method although fine in a function2undroidwish
15 Jul 24    i  `- Re: Tklib's tooltip poss bug in method although fine in a function1Harald Oehlmann
15 Jul 24    `* Re: Tklib's tooltip poss bug in method although fine in a function5Mark Summerfield
15 Jul 24     `* Re: Tklib's tooltip poss bug in method although fine in a function4Mark Summerfield
15 Jul 24      `* Re: Tklib's tooltip poss bug in method although fine in a function3Harald Oehlmann
15 Jul 24       `* Re: Tklib's tooltip poss bug in method although fine in a function2Mark Summerfield
15 Jul 24        `- Re: Tklib's tooltip poss bug in method although fine in a function1Harald Oehlmann

Haut de la page

Les messages affichés proviennent d'usenet.

NewsPortal