Beefy Boxes and Bandwidth Generously Provided by pair Networks
Problems? Is your data what you think it is?

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;

Log In?

What's my password?
Create A New User
Node Status?
node history
Node Type: note [id://951477]
and all is quiet...

How do I use this? | Other CB clients
Other Users?
Others perusing the Monastery: (4)
As of 2017-06-26 19:28 GMT
Find Nodes?
    Voting Booth?
    How many monitors do you use while coding?

    Results (587 votes). Check out past polls.