Beefy Boxes and Bandwidth Generously Provided by pair Networks
Perl Monk, Perl Meditation

Re: Insert checkbutton into MListbox

by thundergnat (Deacon)
on Feb 02, 2012 at 16:13 UTC ( #951477=note: print w/ replies, xml ) Need Help??

in reply to Insert checkbutton into MListbox

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;

Comment on Re: Insert checkbutton into MListbox
Download Code

Log In?

What's my password?
Create A New User
Node Status?
node history
Node Type: note [id://951477]
and the web crawler heard nothing...

How do I use this? | Other CB clients
Other Users?
Others taking refuge in the Monastery: (3)
As of 2014-11-29 10:03 GMT
Find Nodes?
    Voting Booth?

    My preferred Perl binaries come from:

    Results (204 votes), past polls