Beefy Boxes and Bandwidth Generously Provided by pair Networks
more useful options
 
PerlMonks  

Comment on

( #3333=superdoc: print w/ replies, xml ) Need Help??

I believe, (though am not able to prove), that you are running into an issue with the way Windows handles selections. I haven't figured out a way to prevent that, though you can kind of half-assed work around it by doing something like this:

use strict; use warnings; use Tk; my $mw = new MainWindow; my $lines = "Distribution ILYAZ/os2/tk/Tk-OS2src-1.04.zip Distribution INGY/Kwiki-Zipcode-0.12.tar.gz Distribution ISHIGAKI/Archive-Any-Plugin-Bzip2-0.01.tar.gz Distribution JAE/perlipse/Perlipse-0.02.zip Distribution JALYCAI/article_fetcher.zip Distribution JAME/ftndb-0.35.zip Distribution JBNIVOIT/Win32-ShellExt-0.1.zip Distribution JBRYAN/AI-NeuralNet-BackProp-0.77.zip Distribution JBRYAN/AI-NeuralNet-BackProp-0.89.zip Distribution JBRYAN/AI-NeuralNet-Mesh-0.44.zip Distribution KRYDE/Filter-gunzip-4.tar.gz"; my $entry = $mw->Entry->pack; my $txt = $mw->Text(-selectbackground=>'lightgreen')->pack; my $but = $mw->Button(-text=>'List Selected to STDOUT', -command=>sub{ print STDERR $txt->getSelected,"\n"; print STDERR "HI THERE\n"; })->pack; $txt->insert('end', $lines); $txt->tagConfigure('winsel', -background => $txt->tagCget('sel','-back +ground')); $txt->bind('<<Selection>>', sub { $txt->tagRemove('winsel','1.0', 'end'); return if !defined $txt->tagRanges('sel'); $txt->tagAdd('winsel', $txt->tagRanges('sel')) } ); MainLoop;

Create your own tag with the same coloring then shadow the selection tag. Works on windows and shouldn't cause problems elsewhere.


In reply to Re: pTk Text Selection: Win32 Issue? by thundergnat
in thread pTk Text Selection: Win32 Issue? by cmv

Title:
Use:  <p> text here (a paragraph) </p>
and:  <code> code here </code>
to format your post; it's "PerlMonks-approved HTML":



  • Posts are HTML formatted. Put <p> </p> tags around your paragraphs. Put <code> </code> tags around your code and data!
  • Read Where should I post X? if you're not absolutely sure you're posting in the right place.
  • Please read these before you post! —
  • Posts may use any of the Perl Monks Approved HTML tags:
    a, abbr, b, big, blockquote, br, caption, center, col, colgroup, dd, del, div, dl, dt, em, font, h1, h2, h3, h4, h5, h6, hr, i, ins, li, ol, p, pre, readmore, small, span, spoiler, strike, strong, sub, sup, table, tbody, td, tfoot, th, thead, tr, tt, u, ul, wbr
  • You may need to use entities for some characters, as follows. (Exception: Within code tags, you can put the characters literally.)
            For:     Use:
    & &amp;
    < &lt;
    > &gt;
    [ &#91;
    ] &#93;
  • Link using PerlMonks shortcuts! What shortcuts can I use for linking?
  • See Writeup Formatting Tips and other pages linked from there for more info.
  • Log In?
    Username:
    Password:

    What's my password?
    Create A New User
    Chatterbox?
    and the web crawler heard nothing...

    How do I use this? | Other CB clients
    Other Users?
    Others browsing the Monastery: (10)
    As of 2015-07-07 10:28 GMT
    Sections?
    Information?
    Find Nodes?
    Leftovers?
      Voting Booth?

      The top three priorities of my open tasks are (in descending order of likelihood to be worked on) ...









      Results (88 votes), past polls