Reputation: 2821
I wonder if it is possible to format part of a text string when using the (example)
.tbl cellconfigure $row,$col -text "ThisBoldArial AndThisAsSubscript"
command?
I do know about eg the -font option, but this sets the font of the whole cell. Can I somehow format different parts of the string different?
Upvotes: 0
Views: 177
Reputation: 137707
I don't think you can do it easily. Looking at the documentation, I can't see any way of indicating index ranges of cell text contents (which you'd need in order to apply a rendering variation to them). I guess you could work around it by embedding a text widget as the cell's renderer window with the -window
cell option; the use of a text (or ctext) widget for this purpose is mentioned in passing in documentation of the -windowupdate
cell option so it must be possible to fake it that way, but you'd need to figure out the details of how to make it happen right.
This example shows how to do window embedding, albeit with a frame
or button
instead of a text
. You'll need to do some work to get a text widget in there (basically make it borderless, read only and not scrollable at all).
proc createButton {tbl row col w} { set key [$tbl getkeys $row] button $w -image openImg -highlightthickness 0 -takefocus 0 \ -command [list viewFile $tbl $key] }
…
$tbl cellconfigure $row,$column -window createButton
Naturally, you'll want to do more work to make the embedded text widget render as you want. That's potentially its own special set of complexity…
Upvotes: 1