I want to give the user a message in a failure condition.
The Tk DialogBox widget seems fine since you can ‘add’ what elements you want
and the resulting dialog is in ‘control’ until the user selects the Ok button
Adding a label is fine with the following code
$mw_text->add('Label', -text => $label_str)->pack;
I want to display a list in the dialog that varies in length. I thought I would
create this list in a variable with a line feed after each item as shown next
foreach $text_item (@$ref_text_array) { chomp($text_item); $text_str .= $text_item . "\n"; }
I want to show the list in a text box of the dialog box. I tried the following
$mw_text->add('Text', -scrollbars => "e", -width => 80, -height => 35, -text => $text_str )->pack();
However this failed.
It did not like –scrollbars (but I wanted them in case the list got too long)
It did not like –text (and –textvariable)
I have tried to find suitable examples on the internet but this failed!
What should I do?

In reply to Adding 'text' to a Tk DialogBox by merrymonk

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.