• Re: Text widget

    From Rich@21:1/5 to snosniv on Mon Dec 19 22:09:02 2022
    snosniv <[email protected]> wrote:
    Is it possible to make a text widget scroll when lines of text reach the bottom of the window?
    At the moment, I can display 10 lines of text, but lines 11 & beyond are off the window bottom, although I can scroll down with the mouse, I'd prefer if it'd auto scroll as each extra line was added.

    This is a sample of adding one line of text, which is short, all lines about 30 chars max & fit a line easily:

    $f7.txt00 configure -state normal
    $f7.txt00 insert insert "$blk_cnt:- <'simple text to output'>\n"
    $f7.txt00 configure -state disabled
    incr blk_cnt

    TIA, Kev P.

    What you are looking for is the "see" sub-command to the text widget.
    With the 'end' index.

    If you want the widget to always show the last line added then:

    $text insert end "new line of text\n"
    $text see end

    Note that 'end' there is a text index, so other valid indexes are also possible, to move the view to show that index within the widget.

    --- SoupGate-Win32 v1.05
    * Origin: fsxNet Usenet Gateway (21:1/5)
  • From snosniv@21:1/5 to All on Mon Dec 19 13:35:31 2022
    Is it possible to make a text widget scroll when lines of text reach the bottom of the window?
    At the moment, I can display 10 lines of text, but lines 11 & beyond are off the window bottom, although I can scroll down with the mouse, I'd prefer if it'd auto scroll as each extra line was added.

    This is a sample of adding one line of text, which is short, all lines about 30 chars max & fit a line easily:

    $f7.txt00 configure -state normal
    $f7.txt00 insert insert "$blk_cnt:- <'simple text to output'>\n"
    $f7.txt00 configure -state disabled
    incr blk_cnt

    TIA, Kev P.

    --- SoupGate-Win32 v1.05
    * Origin: fsxNet Usenet Gateway (21:1/5)
  • From snosniv@21:1/5 to Rich on Tue Dec 20 09:03:28 2022
    On Monday, 19 December 2022 at 22:09:06 UTC, Rich wrote:
    snosniv <[email protected]> wrote:
    Is it possible to make a text widget scroll when lines of text reach the bottom of the window?
    At the moment, I can display 10 lines of text, but lines 11 & beyond are off the window bottom, although I can scroll down with the mouse, I'd prefer if it'd auto scroll as each extra line was added.

    This is a sample of adding one line of text, which is short, all lines about 30 chars max & fit a line easily:

    $f7.txt00 configure -state normal
    $f7.txt00 insert insert "$blk_cnt:- <'simple text to output'>\n"
    $f7.txt00 configure -state disabled
    incr blk_cnt

    TIA, Kev P.
    What you are looking for is the "see" sub-command to the text widget.
    With the 'end' index.

    If you want the widget to always show the last line added then:

    $text insert end "new line of text\n"
    $text see end

    Note that 'end' there is a text index, so other valid indexes are also possible, to move the view to show that index within the widget.

    Worked nicely, thank you. (Simple when you know how)! :-)

    --- SoupGate-Win32 v1.05
    * Origin: fsxNet Usenet Gateway (21:1/5)