I am really confused by this. I need an interface with some fields read only (labels) and some editable (data). I cannot seem to prevent editablity. I have tried two things that I think should work, this:

$Cell[1] = { CellType => "ROText", Row => 0, Col => 0, Contents => "Bank\\Branch\\Dept:" }; $Cell[2] = { CellType => "ROText", Row => 1, Col => 0, Contents => "Requestor:" }; foreach (1 .. $#Cell) { if (${$Cell[$_]}{'CellType'} == "Text") { $cell = $grid->Text( -width => 17, -height => 1, )->grid( -row => ${$Cell[$_]}{'Row'}, -sticky => "nsew", -column => ${$Cell[$_]}{'Col'}, ); } elsif (${$Cell[$_]}{'CellType'} == "ROText") { $cell = $grid->ROText( -width => 17, -height => 1, )->grid( -row => ${$Cell[$_]}{'Row'}, -sticky => "nsew", -column => ${$Cell[$_]}{'Col'}, ); }; $cell->Contents("${$Cell[$_]}{'Contents'}"); };

And this:

foreach (1 .. $#Cell) { if (${$Cell[$_]}{'CellType'} == "Text") { $cell = $grid->Text( -width => 17, -height => 1, -state =>'normal', )->grid( -row => ${$Cell[$_]}{'Row'}, -column => ${$Cell[$_]}{'Col'}, ); } elsif (${$Cell[$_]}{'CellType'} == "ROText") { $cell = $grid->Text( -width => 17, -height => 1, -state =>'disabled', )->grid( -row => ${$Cell[$_]}{'Row'}, -column => ${$Cell[$_]}{'Col'}, ); }; $cell->Contents("${$Cell[$_]}{'Contents'}"); };

Both of these result in fields that can be clicked on and edited.

What am I doing wrong?

Skip

In reply to Read Only fields from Tk, neither Text or ROText seem to work. by SkipHuffman

Title:
Use:  <p> text here (a paragraph) </p>
and:  <code> code here </code>
to format your post, it's "PerlMonks-approved HTML":



  • Posts are HTML formatted. Put <p> </p> tags around your paragraphs. Put <code> </code> tags around your code and data!
  • Titles consisting of a single word are discouraged, and in most cases are disallowed outright.
  • Read Where should I post X? if you're not absolutely sure you're posting in the right place.
  • Please read these before you post! —
  • Posts may use any of the Perl Monks Approved HTML tags:
    a, abbr, b, big, blockquote, br, caption, center, col, colgroup, dd, del, details, div, dl, dt, em, font, h1, h2, h3, h4, h5, h6, hr, i, ins, li, ol, p, pre, readmore, small, span, spoiler, strike, strong, sub, summary, sup, table, tbody, td, tfoot, th, thead, tr, tt, u, ul, wbr
  • You may need to use entities for some characters, as follows. (Exception: Within code tags, you can put the characters literally.)
            For:     Use:
    & &amp;
    < &lt;
    > &gt;
    [ &#91;
    ] &#93;
  • Link using PerlMonks shortcuts! What shortcuts can I use for linking?
  • See Writeup Formatting Tips and other pages linked from there for more info.