I'm not familiar with Mlistbox but after a quick perusal of the docs, it look like it is based on a Listbox primitive rather than one of the tix based List widgets. (TList, Hlist, tixGrid, etc.) Listboxs are designed and optimized to work with text items. I'm not sure if it is possible to make them work with other types of items without major aggravation.
For what it is worth, here is an example Checkbuttons in a TList (which IS a tix based List widget)
#!/usr/bin/perl
use warnings;
use strict;
use Tk;
use Tk::TList;
my %tk;
$tk{mw} = MainWindow->new;
$tk{tlist} = $tk{mw}->TList(
)->pack(
-expand => 1,
-fill => 'both',
);
my @cbvar = ( 0, 1, 1, 0, 0 );
for ( 0 .. $#cbvar ){
$tk{"cb$_"} = $tk{tlist}->Frame;
$tk{"cb$_"}->Checkbutton(
-variable => \$cbvar[$_]
)->pack(
-side => 'left'
);
$tk{"cb$_"}->Label(
-text => " Checkbox $_ "
)->pack(
-side => 'left'
);
$tk{tlist}->insert( 'end',
-itemtype => 'window',
-widget => $tk{"cb$_"},
);
}
MainLoop;
-
Are you posting in the right place? Check out Where do I post X? to know for sure.
-
Posts may use any of the Perl Monks Approved HTML tags. Currently these include the following:
<code> <a> <b> <big>
<blockquote> <br /> <dd>
<dl> <dt> <em> <font>
<h1> <h2> <h3> <h4>
<h5> <h6> <hr /> <i>
<li> <nbsp> <ol> <p>
<small> <strike> <strong>
<sub> <sup> <table>
<td> <th> <tr> <tt>
<u> <ul>
-
Snippets of code should be wrapped in
<code> tags not
<pre> tags. In fact, <pre>
tags should generally be avoided. If they must
be used, extreme care should be
taken to ensure that their contents do not
have long lines (<70 chars), in order to prevent
horizontal scrolling (and possible janitor
intervention).
-
Want more info? How to link
or How to display code and escape characters
are good places to start.
|