I have several utilities based on scrolled text widgets. I have been trying to add a "drag handle" to the lower right of the window to ease resizing (like nearly all windowed applications have) but have been having trouble getting the cursor I would prefer. X11/cursorfont.h doesn't seem to have "resize_nwse" (the diagonal double arrow you see if you place your cursor over the resize pad down in the lower right corner). Instead, I seem to be stuck with the "sizing" cursor, which isn't really what I want, and I havn't been able to figure out how to access the window managers native one. (Almost all window managers have such a beast.)

Any ideas?

Here's a sample script showing what I am trying to do.

Put your cursor at the lower right corner to see the cursor I want, then over the "drag handle" to see what I have.

#!/usr/local/bin/perl use strict; use warnings; use Tk; my $top = MainWindow->new; my $text = $top->Scrolled('Text', -scrollbars => 'se', )->pack( -expand => 1, -fill => 'both' ); my ($mouse_x, $mouse_y); my $corner = $text->Subwidget('corner'); my $corner_label = $corner->Label( -image => $top->Photo( -format=>'gif', -data => 'R0lGODlhDAAMALMAAISChNTSzPz+/AAAAOAAyukAwRIA4wAAd8oA +0MEAe+MTYHcAANAGgnsAAGAA AAAAACH5BAAAAAAALAAAAAAMAAwAAwQfMMg5BaDYXiw178AlcJ6V +hYFXoSoosm7KvrR8zfXHRQA7' ), )->pack(-side => 'bottom', -anchor => 'se'); # I actually want a resize_nwse cursor, but this was the closest I cou +ld find $corner_label->bind('<Enter>' => sub {$corner->configure(-cursor => 's +izing')}); $corner_label->bind('<1>' => sub { ($mouse_x, $mouse_y) = ($top->pointerx, $top->pointery) }); $corner_label->bind('<B1-Motion>' => sub { my $x = $top->width - $mouse_x + $top->pointerx; my $y = $top->height - $mouse_y + $top->pointery; ($mouse_x, $mouse_y) = ($top->pointerx, $top->pointery); $top->geometry($x.'x'.$y); }); MainLoop;
UPDATE: I should have mentioned, I would like to do this cross-platform if possible. I have users running every version of Windows from Win95 up, several different distros of Linux and MAC OSX, so I don't want to lock into a specific platform if I can avoid it.


In reply to Perl/Tk resizing cursor? by thundergnat

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!
  • Titles consisting of a single word are discouraged, and in most cases are disallowed outright.
  • 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, details, 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, summary, 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.