in reply to Re: Perl::Tk and cursor in Menubutton
in thread Perl::Tk and cursor in Menubutton

Sorry for my English(I'm from Ukraine).
This is interesting way to getting positive result.
But creating new modules with code changes is not true way. At first this is violation of license. In addition I must have root privilegies to correct module code. In future I neede on all PC's where this program must running, correcting code of Tk module. Now my program needn't root privilegies for running.
Creating new procedures in my code with copy-paste code from original module is violation of license too. And this way distend my code.

I think may be present method getting access to menubutton object variables and correct this without correction code im Menubutton.pm?
  • Comment on Re^2: Perl::Tk and cursor in Menubutton

Replies are listed 'Best First'.
Re^3: Perl::Tk and cursor in Menubutton
by zentara (Cardinal) on Oct 20, 2010 at 18:42 UTC
    At first this is violation of license.

    Ha! You are Microsoft brainwashed.

    The Tk module is open source, and you can make a copy of an existing module, rename it and make it yours, then put it in your own home directory for your personal use.

    must have root privilegies to correct module code.

    You are not correcting it, you are making a copy and modifying it for your own use.

    But, just go to Tk download , unpack it, and get your very own free copy!!!!! Yes FREE as in FREE BEER. :-)


    I'm not really a human, but I play one on earth.
    Old Perl Programmer Haiku ................... flash japh
      )))
      MS)))
      It's free. Yes. Free for use...
      If I correct some code or use it in my software with corrections, I must tell about this software owner and publicate my source code of new version...
      As I know, this module many years have not support... May be I thinking wrong...
      This is first.

      I want for my program less dependences...
      May be in future all peoples can get new version of Tk module and my module may be have bad compatability with main procedures. I will have not in future headache with this...
      If I choose correct code way I must track on each system version of Tk and its compatability with my module...
        I must apologize a bit to you. The preferred way to modify a module, for your own use, is to use a Derived widget. But as I experimented with making a Derived Menubutton widget, many unexpected behaviors popped up. I finally resorted to trying a local Tk directory containing a copy of Menubutton.pm . Then even with
        use strict; use lib '.'; BEGIN{ unshift @INC, '.';} use Tk; print "@INC\n"; .....
        It would find the system installed module, instead of my copy.

        I did manage to get a package MyMenuButton to load error free, but the menubutton would not appear in the $mw->menu for some reason.

        Here is as far as I care to take it. It works as a package, as long as you place the Derived MenuButton in the $mw, instead of the $mw->menu(). I do not know why it won't work from the menu. I changed the cursor to a pencil.

        So this would be perfectly acceptable as far as license and distribution goes. You can do some more cursor modifications in the Enter and Leave subs if you desire.


        I'm not really a human, but I play one on earth.
        Old Perl Programmer Haiku ................... flash japh

        I presented two caveats at the end of the code. The first one addresses the compatibility issue you allude to.

        -- Ken

Re^3: Perl::Tk and cursor in Menubutton
by kcott (Archbishop) on Oct 21, 2010 at 05:21 UTC

    Thanks for taking the time to reply. Your English is a lot better than my Russian. :-)

    I concur with the comments made by zentara in his response.

    -- Ken

      You can speak in Russian?
      <OffTopic>
      Я знаю русский тоже...
      Можешь попробовать поговорить и на русском...)))
      </OffTopic>
      I thinking about one method...
      In code I have for example $mw=TK::MainWindow->new; or $help=$menubar->Menubutton(...
      may be I can find objects method getting address of menubutton pointer variable and change -cursor parameter directly?
      I probe use Data::Dumper to find some information about variables but I can't get positive result.
        You can speak in Russian?

        No, none at all. You'll need to translate the part in Cyrillic for me.

        And, just in case there was any confusion, my "Your English is a lot better than my Russian. :-)" was intended as a good-humoured comment (hence the smiley). I hope it wasn't taken the wrong way.

        I thinking about one method...

        I also wanted to do something like that for other options. Here's my code (which appears immediately after the $mb->configure(-cursor => q{}); line):

        my $file_menu = $mb->Cascade( -label => q{~File}, -tearoff => 0, -menuitems => [ [Separator => q{}], [Button => q{Exit}, -command => sub { exit }] ], ); $file_menu->cget(q{-menu})->configure( -borderwidth => 1, -activeborderwidth => 1, );

        Working out how to do that took me a fair amount of investigation too. The method I used is still commented out in my script, so I'll post it here. It may provide some insights.

        #say qq{\$file_menu: $file_menu}; #my @file_opts = $file_menu->configure(); #foreach my $opt (@file_opts) { # map { $_ //= q{undef} } @$opt; # say join qq{\t}, @$opt; #} #say qq{@{[$file_menu->cget(q{-menu})]}}; #my %file_menu_menu = %{$file_menu->cget(q{-menu})}; #foreach my $key (keys %file_menu_menu) { # say join q{ : }, $key, $file_menu_menu{$key}; #}

        Finally, there's a newer (and, by all accounts, preferred) method of creating menu bars using the -menuitems option. I find it easier than the old method and have used it above. Examples of both methods are shown in the widget demo: under the Menus heading, compare item 1 (old method) with item 2 (new method).

        -- Ken