Code Comments
Programming Forum and web based access to our favorite programming groups.I thought I would ask this again in 2004 to see if there has been an update ... is there a way to add a window icon to messageBox? Or is there an equivalent YesNo type widget that I can add a window icon to?
Post Follow-up to this messageOn 3 Nov 2004 09:00:40 -0800, "Johnny Google" <john_pataki@yahoo.com>
wrote:
>I thought I would ask this again in 2004 to see if there has been an
>update ... is there a way to add a window icon to messageBox?
>
>Or is there an equivalent YesNo type widget that I can add a window
>icon to?
Are you talking about on win32?
From perldoc Tk::messageBox
-icon
Specifies an icon to display. On X11 any of the
builtin Tk bitmaps can specified. On Windows only
error, info, question or warning are supported.
########################################
##
#!/usr/bin/perl
use warnings;
use strict;
use Tk;
my $mw = tkinit;
$mw->Button(-text=>'Press Me',
-command => sub{
my $message = localtime;
&send_message( $message) }
)->pack;
MainLoop;
sub send_message{
my $message = shift;
$mw->messageBox(
-background => 'lightyellow',
-icon => 'error',
-message => $message,
-type => 'OK'
);
}
########################################
#####
Or you can define your own bitmap. I don't know if
you can get the bitmap color different from the foreground.
#!/usr/bin/perl
use warnings;
use strict;
use Tk;
my $mw = tkinit;
my $bits = pack("b8"x8,
"...11...",
"..1111..",
".111111.",
"11111111",
"11111111",
".111111.",
"..1111..",
"...11...",);
$mw->DefineBitmap('indicator' => 8,8, $bits);
$mw->Button(-text=>'Press Me',
-command => sub{
my $message = localtime;
&send_message( $message) }
)->pack;
MainLoop;
sub send_message{
my $message = shift;
$mw->messageBox(
-background => 'lightyellow',
-foreground => 'red',
-icon => 'indicator',
-message => $message,
-type => 'OK'
);
}
########################################
#####
--
I'm not really a human, but I play one on earth.
http://zentara.net/japh.html
Post Follow-up to this messageIs there a way to change the icon in the top left corner of something like a MessageBox? R.
Post Follow-up to this messageIn article <cmd8h2$sh1$1@newshost.mot.com>, spikeywan@bigfoot.com says... > Is there a way to change the icon in the top left corner of something like a > MessageBox? You may know that on Windows, you can change the window manager icon of the main window if you have a 32x32 .bmp of .gif as follows: use Tk; my $mw = tkinit; my $image = 'tag.gif'; # 32x32 GIF or BMP my $icon = $mw->Photo(-file => $image); $mw->idletasks; # this line is crucial $mw->iconimage($icon); MainLoop; Add the following lines before MainLoop to change the icon of a Dialog or DialogBox: my $d = $mw->Dialog(-text => 'Test'); $d->iconimage($icon); $d->Show; You cannot use this approach with the messageBox method, but you can convert your code to use Dialog or DialogBox. -- Go to http://MarcDashevsky.com to send me e-mail.
Post Follow-up to this messagePowered by vBulletin
Copyright 2000-2006 Jelsoft Enterprises Limited.