I assume you use Perl Tk, in this case you can use a Tk::StatusBar widget for the task.

Here is a tiny patch to fix a problem, I encountered, regarding 'systembuttonface':

--- lib/Tk/StatusBar.pm 2004-02-05 05:21:14.000000000 +0200 +++ lib/Tk/StatusBar.pm.new 2010-03-29 12:58:51.164978272 +0300 @@ -147,7 +147,6 @@ my $n = $self->ProgressBar( -borderwidth => $borderwidth, -width => 17, - -troughcolor => 'systembuttonface', %args, );

Update: How would I do it: :)

use strict; use warnings; use Tk; use Tk::StatusBar; use Tk::ToolBar; my $mw = MainWindow->new; $mw->geometry('200x80+10+20'); $mw->optionAdd('*Label.font' => '{MS Sans Serif} 8'); my $tb = $mw->ToolBar(qw/-movable 1 -side top/); my $connected = 1; $tb->ToolButton( -image => 'actreload16', -tip => 'back', -command => \&toggle_conn, ); my $sb = $mw->StatusBar(); my $txtstatus = $sb->addLabel( -relief => 'flat' ); my $icostatus = $sb->addLabel( -width => 20, -relief => 'raised', -anchor => 'center', -side => 'right' ); toggle_conn(); MainLoop(); sub toggle_conn { if ($connected) { $connected = 0; my $text = 'Disconnected'; $icostatus->configure( -image => 'connectno16' ); $txtstatus->configure( -foreground => 'darkred', -textvariable => \$text, ); } else { $connected = 1; my $text = 'Connected'; $icostatus->configure( -image => 'connectyes16' ); $txtstatus->configure( -foreground => 'darkgreen', -textvariable => \$text, ); } }

Regards, Stefan


In reply to Re: Menubar checkbutton to show state? by stefbv
in thread Menubar checkbutton to show state? by swe9

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.