Does anyone want this enhanced scrolledtext widget? 
Author Message
 Does anyone want this enhanced scrolledtext widget?

I've created a subclass of the 'scrolledtext' iwidget called 'ftext'.
It adds two major features to the scrolledtext feature set.

The first is the ability to embed tags in text, rather than explicitly
specifying tags with the 'insert' command. For example, you can say

        .widget insertftext end {<<Bold:Hello>>, how are you doing?}

and the text "Hellow, how are you doing?" will be inserted into the
widget, with the word "Hello" being tagged with a "Bold" tag. This
feature is pretty much a minor convenience (and one that I will suspect
will soon be obsoleted by additions to Tcl/Tk), but it is very useful
if, for example, you want to read in large, nicely formatted text files.

The second feature of the "ftext" widget, and one that I use all the
time, is the ability to define and change _hierarchical styles_.
For example:

        .widget style add bold -weight bold
        .widget style add bigbold bold -size +4
        .widget style add bolditalic bold -slant italic

The first command adds a new style called bold, based (implicitly) on
the predefined 'default' style. Any text tagged with the "bold" tag
will display in the font associated with the default style (which is
just the default font for the widget), except with the bold version
of that font. The next two commands are based (explicitly) on the
previous bold style, and define a "bigbold" style that is 4 pts larger
than "bold", and a "bolditalic" style that is--well, you figure it out.
Any of the standard options associated with tags may be used when
defining new styles; as well, four new options, "-weight", "-slant",
"-family", and "-size" have been defined, because I hate using
the "-font" option. (Who the hell remembers X font names?)

The nicest thing about this feature is that any change to the widget
default font (also accomplished through using -weight, -slant, etc.,
rather than X font names) will propagate through to currently
existing styles.


There is no documentation yet, aside from internal comments, which are
OK by not great, and probably incorrect in places.

There are probably still a number of bugs in the commands I don't use
much. I'm happy to say that the "style sheet" feature is working very
well for me, and I haven't had to go bug hunting there in a long

Some of the features need to be expanded. For example, it would make
sense to be able to say "style add indent -lmargin +0.5i", but this
won't work because the widget doesn't understand numeric quantities
with units.

Code could use some cleaning up. (Isn't this always the case?)

There are probably some other problems I forgot to mention.

Because of these shortcomings, I've been delaying releasing this until
I get it "done right". However, reality indicates that I may never find
time for this. Accordingly, I am willing to release it to a person or
people on this group who PROMISE to make this into a high-quality piece
of code, that can at some point be included in the iwidgets set.
The only requirement is that my name be included in the credits when the
final version is released. You don't have to keep the current interface,
or anything else like that. I'd prefer to hand it to someone on
the 'iwidgets' team, or someone else on the newsgroup who's provided
good Tcl/Tk stuff in the past, but will pass it on to anyone who's
seriously committed to 'finishing' it.

THIS IS A REALLY USEFUL SUBCLASS. I use it all the time, which is why
I finally decided I should do what I could to get it out to the
rest of the Tcl/Tk community. Just so you know, it's about 660 lines,
but that does include quite a few comments. I hope someone will take
this up.

Email me if you're interested.

Ken McDonald

Fri, 09 Oct 1998 03:00:00 GMT  
 [ 1 post ] 

 Relevant Pages 

1. Anyone doing a dashboard widget for the docs?

2. ScrolledText Widget

3. Tkinter, Saving chages to text in ScrolledText Widget

4. ScrolledText widgets

5. ScrolledText widget

6. how to highlight a single line in a scrolledtext widget

7. Getting row/column in scrolledtext widget

8. whitespaces in widget names (iwidget::scrolledtext causing mischief)

9. autoscrolling scrolledText widget

10. setting colour and font for scrolledText widget label

11. Enhanced List Widget in VW 2.5

12. Need Enhanced Widgets for VisualWorks


Powered by phpBB® Forum Software