Hi Monks, I am building a graphical interface for my program, using radio Buttons

I would like to have 3 buttons linked to a same variable, 2 of them have a fixed -value field. I want the last one to be configurable by the user

I would like to configure this value using a ttk_entry, here's an extract of my code

$Mode="Mode1"; my $entry26 = $lf21->new_ttk__radiobutton(-text => "Mode1", -variable +=> \$Mode, -value => "Mode1"); my $entry27 = $lf21->new_ttk__radiobutton(-text => "Mode2", -variable +=> \$Mode, -value => "Mode2"); my $entry28 = $lf21->new_ttk__radiobutton(-text => "Other:", -variable + => \$Mode, -value => $OtherMode ); my $entry29 = $lf21->new_ttk__entry( -validate => 'focusout', -textvariable => \$OtherMode, );

From the tests i did, i can say that $OtherMode takes the value of the entry but, if I select the last button, the $Mode variable contains an empty string

do you have any idea of what i did wrong?

thanks in advance, have a great day :)


In reply to [Tkx] passing a variable to -value field in radio button by Anonymous Monk

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.