Here is a tiny example of a large program in which a scrollable array is updated by the program. Users can remove entries, change entries and move entries which all works nicely. (Not shown here) However when the program adds new entries at the end of the list and the list is longer than the viewable window, then the last entry is not shown. How can I get the program to position the cursor so that the last addition can be seen without the user having to move the cursor in the scroll-bar? Thanks

use strict; use Tkx; my $mw = Tkx::widget->new("."); $mw->g_wm_title("test"); my @results=(); my @id6=(); for my $i(0..100) {$results[$i] = 2*$i;} &do_canvas4; Tkx::MainLoop(); sub do_canvas4 {my $canvas4 = $mw->new_tk__canvas(-width => 130, -height => 500,-scro +llregion => "0 4 0 2500"); $canvas4->g_grid(-column => 2, -row => 4, -sticky => "nsew"); my $vscroll = $mw->new_tk__scrollbar(-orient => "vertical", -command = +> [$canvas4, "yview"]); $vscroll->g_grid(-column => 3, -row => 4, -sticky => "nsew"); $mw->new_ttk__sizegrip()->g_grid(-column => 3, -row => 4, -sticky => " +e"); $canvas4->configure(-yscrollcommand => [$vscroll, "set"]); for my $i(0..60) { $id6[$i] = $canvas4->create_text(79, 22+$i*26,-text => $results[$i +],-font => "fixed 16 bold",-activefill => "red",-fill => "black",-anc +hor => "e"); # $canvas4->bind($id6[$i], '<1>' => sub {handle_click3($id6[$i],$i) +}); plus also middle and right button bindings in the program } }

In reply to Tkx scrolling by nitep70

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.