Menu

#334 new widget - read-only text

open
5
2012-02-22
2012-01-28
No

widget::rotext - readonly text widget for tklib.

Discussion

  • Alexander Danilov

    widget

     
  • Andreas Kupries

    Andreas Kupries - 2012-02-22

    Some questions after reading the code:

    Your rotext seems to disable interactive editing (i.e. anything done through the bindings), and allow non-interactive (programmatic) editing. Is that right ?

    Is this based per-chance on some code on the Tcler's Wiki (http://wiki.tcl.tk) ?
    If yes, that are the page numbers ?

    Note that an alternative way of doing a rotext is wrap around text and disable the 'insert' and 'delete' method, without touching the bindings . This will disable all editing, interactive and programmatic. The latter can then be restored by providing differently named methods for programmatic access.

     
  • Andreas Kupries

    Andreas Kupries - 2012-02-22
    • assigned_to: nobody --> andreas_kupries
     
  • Andreas Kupries

    Andreas Kupries - 2012-02-22
    • summary: new widget --> new widget - read-only text
     
  • Alexander Danilov

    > Your rotext seems to disable interactive editing (i.e. anything done
    > through the bindings), and allow non-interactive (programmatic) editing. Is
    > that right ?

    Yes, you are right.

    >
    > Is this based per-chance on some code on the Tcler's Wiki
    > (http://wiki.tcl.tk) ?
    > If yes, that are the page numbers ?

    I write this code myself, but idea is so simple, so may be wiki contains simular code.

    >
    > Note that an alternative way of doing a rotext is wrap around text and
    > disable the 'insert' and 'delete' method, without touching the bindings .
    > This will disable all editing, interactive and programmatic. The latter can
    > then be restored by providing differently named methods for programmatic
    > access.
    >

    I saw such alternative code on the Tcl wiki, but my idea was leave text api as is, just disable interactive editing. Example, in my application I have one text widget for code editing, one other text widget for viewing this code after some preprocessor. Also, I found this widget useful in some other situations.

    P.S: may be it will be good to add my code to widget::scrolledtext, but this at your discretion.