Code Comments

Programming Forum and web based access to our favorite programming groups.
For Programmers: Free Programming Magazines | New: Database administration forum
Registration is free! Edit your profileCalendarFind other membersFrequently Asked QuestionsSearch -> 
Post New Thread











Thread
Author

Re: Add window icon to messageBox?
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?


Report this thread to moderator Post Follow-up to this message
Old Post
Johnny Google
11-03-04 08:56 PM


Re: Add window icon to messageBox?
On 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

Report this thread to moderator Post Follow-up to this message
Old Post
zentara
11-04-04 01:56 PM


Re: Add window icon to messageBox?
Is there a way to change the icon in the top left corner of something like a
MessageBox?

R.



Report this thread to moderator Post Follow-up to this message
Old Post
Richard S Beckett
11-04-04 01:56 PM


Re: Add window icon to messageBox?
In 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.

Report this thread to moderator Post Follow-up to this message
Old Post
Marc Dashevsky
11-04-04 08:57 PM


Sponsored Links




Last Thread Next Thread Next
Search this forum -> 
Post New Thread

PerlTk archive

Show a Printable Version Send to friend Email This Page to Someone! subscribe to this thread Receive updates to this thread
Computer Consultants
Programming Jobs
Visual Basic Controls
SQL Server Programming
Webservices
Java Security
Visual Studio
C# Programming
Visual J++
Software engineering
Open source Software
Perl Programming
PHP Programming
ASP Programming
ASP .NET Programming
Visual Basic Programming
Windows Scripting Host
Java Programming
Java Help
Java Beans
VBScript
Cobol
MAC Applications
Unix Programming
Forum Jump:
All times are GMT. The time now is 05:35 AM.

 
Free MCSE Braindumps | Real Estate Topics

Programming forum archive

Copyrights CodeComments.com 2004 - 2006

Powered by vBulletin Copyright 2000-2006 Jelsoft Enterprises Limited.