<?xml version="1.0" encoding="windows-1252"?>
<node id="969128" title="Re: Tk Tablematrix configure word in a cell" created="2012-05-06 05:03:43" updated="2012-05-06 05:03:43">
<type id="11">
note</type>
<author id="764402">
stefbv</author>
<data>
<field name="doctext">
&lt;blockquote&gt;That was pretty easy in a text widget.&lt;/blockquote&gt;
&lt;p&gt;Then try to embed a Text widget in the cell.&lt;/p&gt;
&lt;p&gt;&lt;b&gt;Update&lt;/b&gt;: A quick demo:
&lt;c&gt;
use strict;
use warnings;
use Tk;
use Tk::TableMatrix;

my $top = MainWindow-&gt;new;

my $arrayVar = {};
foreach my $row ( 0 .. 7 ) {
    foreach my $col ( 0 .. 3 ) {
        $arrayVar-&gt;{"$row,$col"} = "r$row,c$col";
    }
}

my $tmx = $top-&gt;Scrolled(
    'TableMatrix',
    -rows          =&gt; 7,
    -cols          =&gt; 3,
    -variable      =&gt; $arrayVar,
    -resizeborders =&gt; 'both',
    -titlerows     =&gt; 1,
    -bg            =&gt; 'white',
);

#---

my $c = 2;
foreach my $r ( 1 .. 7 ) {
    my $tc = build_text($top);
    $tmx-&gt;windowConfigure( "$r,$c", -sticky =&gt; 's', -window =&gt; $tc );
}

$tmx-&gt;colWidth( $c, 20 );
$tmx-&gt;pack( -expand =&gt; 1, -fill =&gt; 'both' );

Tk::MainLoop;

sub build_text {
    my $frame = shift;

    my $tc = $frame-&gt;Text( -bg =&gt; 'white', );
    $tc-&gt;tagConfigure( 'blue', -foreground =&gt; 'blue', );
    $tc-&gt;insert('insert', 'Text with ');
    $tc-&gt;insert('insert', ' blue ', 'blue');
    $tc-&gt;insert('insert', ' word ');

    return $tc;
}

&lt;/c&gt;
</field>
<field name="root_node">
969124</field>
<field name="parent_node">
969124</field>
</data>
</node>
