Beefy Boxes and Bandwidth Generously Provided by pair Networks
XP is just a number
 
PerlMonks  

disabling the Listbox widget in Perl/Tk

by bobdeath (Scribe)
on Jun 11, 2003 at 14:37 UTC ( [id://265054]=perlquestion: print w/replies, xml ) Need Help??

bobdeath has asked for the wisdom of the Perl Monks concerning the following question:

I am working on a project where I need to disable a Perl/Tk listbox widget. Most widgets have a -state option that I can set to disabled, but the Listbox widget doesn't seem to have this option. Can any monks out there enlighten me as to how I would go about disabling this widget?
  • Comment on disabling the Listbox widget in Perl/Tk

Replies are listed 'Best First'.
Re: disabling the Listbox widget in Perl/Tk
by tall_man (Parson) on Jun 11, 2003 at 15:00 UTC
    The way I have done it is to gray the box manually and disable all the bindings:
    $listbox->configure(-foreground => $grayout_color); # Disable all bindings. foreach my $seq ($listbox->bind()) { my $code = $listbox->bind($seq); # Store the $code somewhere... # if you want to re-enable later. $listbox->bind($seq, ""); }
Re: disabling the Listbox widget in Perl/Tk
by converter (Priest) on Jun 11, 2003 at 14:57 UTC

    The Tix-based Tk::TList widget supports the -state option. The TList widget class includes a lot more functionality than Listbox, but you should be able to use it with only minor modifications to your code.

Re: disabling the Listbox widget in Perl/Tk
by greenFox (Vicar) on Jun 12, 2003 at 02:41 UTC

    Possibly not what your looking for but the Tk::HList widget allows you to disable individual elements:

    $hlist->entryconfigure($entryPath, -state => 'disabled');

    --
    Life is a tale told by an idiot -- full of sound and fury, signifying nothing. William Shakespeare, Macbeth

Log In?
Username:
Password:

What's my password?
Create A New User
Domain Nodelet?
Node Status?
node history
Node Type: perlquestion [id://265054]
Approved by sschneid
Front-paged by tall_man
help
Chatterbox?
and the web crawler heard nothing...

How do I use this?Last hourOther CB clients
Other Users?
Others having an uproarious good time at the Monastery: (4)
As of 2024-04-23 06:11 GMT
Sections?
Information?
Find Nodes?
Leftovers?
    Voting Booth?

    No recent polls found