• scrollutil and text-Widget

    From Matthias Meier@21:1/5 to All on Wed Jul 26 09:09:15 2023
    Hi all!

    I would like to build (since i haven't found a ready to use package) a text-widget with dynamic scrollbars.
    I want to get the scrollbars only, when the text within the text-widget is larger then the visible part of the widget.
    I thought it would be a good idea to use "scrollutil" for, instead building it from scratch.
    But either the scrollbars are shown when the toplevel gets smaller then the text-widget (not the text) or the scrollbars are shown never. (depending on -fitcontentwidth/-fitcontentheight)

    Is it possible to archive this goal with the scrollutil-package or do i have to build a megawidget myself? (canvas+text+scrollbars)

    Here is my sample code:

    ----------------------------------------------------
    package require scrollutil

    toplevel .t

    scrollutil::scrollarea .t.sa
    scrollutil::scrollableframe .t.sa.sf
    .t.sa setwidget .t.sa.sf

    set cf [.t.sa.sf contentframe]

    text $cf.t -wrap none

    $cf.t insert 1.0 "this is a text line in a text widget\nanother line"

    grid .t.sa -row 0 -column 0 -sticky nesw
    grid columnconfigure .t 0 -weight 1
    grid rowconfigure .t 0 -weight 1

    grid $cf.t -row 0 -column 0 -sticky nesw
    grid columnconfigure $cf 0 -weight 1
    grid rowconfigure $cf 0 -weight 1

    # .t.sa.sf configure -fitcontentwidth 1
    # .t.sa.sf configure -fitcontentheight 1


    Thank you very much,
    Matthias

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