Skip Menu |

This queue is for tickets about the Tcl-Tk CPAN distribution.

Report information
The Basics
Id: 125489
Status: resolved
Priority: 0/
Queue: Tcl-Tk

People
Owner: Nobody in particular
Requestors: PERLMAX [...] cpan.org
Cc:
AdminCc:

Bug Information
Severity: (no value)
Broken in: (no value)
Fixed in: (no value)



Subject: $menubutton->cascade also in the Menubutton wiget
Hello Vadim, I saw that you created several Menu-MetaFunctions to the Menubutton widget (e.g. command, checkbox, radiobutton etc.). But the cascade metafunction isn't added which is a little bit confusing. The following patch makes also $Menubutton->cascade(...) possible as it works in a Menu widget. Best wishes, Max
Subject: Menupatch.diff
--- ./Tk.pm 2011-02-19 21:13:23.000000000 +0100 +++ ./Tk_MenuButton.pm 2018-06-04 23:00:17.521424375 +0200 @@ -1702,8 +1702,9 @@ # internal sub helper for menu sub _addcascade { my $mnu = shift; - my $mnup = $mnu->path; my $int = $mnu->interp; + $mnu = $int->widget("$mnu.m") if (ref($mnu) eq "Tcl::Tk::Widget::Menubutton"); + my $mnup = $mnu->path; my %args = @_; my $smnu = delete $args{'-menu'}; if (!defined($smnu)) { @@ -1781,6 +1782,10 @@ my $int = $wid->interp; $int->call("$wid.m",'add','radiobutton',@_); }, + cascade => sub { + my $wid = shift; + _addcascade($wid, @_); + }, separator => sub { my $wid = shift; my $int = $wid->interp;
Hello Vadim, Enclosed a new version of the patch. I think, it is much clearer to change to the menu widget even in the cascade function, not just in the _addcascade method. we save up for one if condition on this way. Additionally I have added also the entryconfigure method to the Tcl::Tk::Menubutton widget, so that this widget gives access to all methods that can be called from the Menu widget, too. Best wishes, Max
Subject: Menupatch2.diff
--- ./Tk.pm 2018-06-05 07:33:16.358789371 +0200 +++ ./Tk_MenuButtonNew.pm 2018-06-06 23:32:02.025898978 +0200 @@ -1781,6 +1781,11 @@ my $int = $wid->interp; $int->call("$wid.m",'add','radiobutton',@_); }, + cascade => sub { + my $wid = shift; + $wid = $int->widget("$wid.m"); + _addcascade($wid, @_); + }, separator => sub { my $wid = shift; my $int = $wid->interp; @@ -1799,6 +1804,14 @@ } else { die "Finish cget implementation for Menubutton"; } + }, + entryconfigure => sub { + my $wid = shift; + $wid = $int->widget("$wid.m"); + my $int = $wid->interp; + my $label = shift; + $label =~ s/~//; + $int->call("$wid", 'entryconfigure', $label, @_); }); my $mnub = $int->widget( $int->call('menubutton', $w, -menu => "$w.m", %args),
ok I will add your change; also please be aware of related mailing list and also of related github repository https://github.com/vadrer/perl-tcl-tk
Thank you very much. I have added Pull requests for all my suggested patches... PS.: Your Tcl and Tk bindings are really great! Thank you very much for your work... PSS.: Where is the mailing list? I didn't find it so far...
tcltk at perl.org - covers several modules in family;
also, Tcl::pTk provides more perl/Tk compatibility, so you may want to look there as well; we plan for Tcl::Tk to continue to be minimalistic, single-file (mostly) and probably not very much expanding :)
Thank you very much for the informations. I have subscribed to the mailing list. I have never used the old Tk. So compatibility with pTk is no important for me. On the other side I don't like the Tkx module ( too much __ or ___ for my taste ;-) ). So your module is just perfect for me, and yes for me a tiny interface to the Tk toolkit is just fine!!