Many thanks Rob and Glenn

I tried the label option, but as you say, the text disappears when the button is pressed. I can do a Redraw() after the button has been released and the label reappears, but it still looks "messy" while the button is held down.

I might cheat and use Bitmaps in the buttons instead :) I know they work, its what i fell back on when I couldnt get labels to work.

I`m sure i`ll be back for more answers... but i`ll make sure I`ll try all the options before I return.

Steve

Glenn W Munroe wrote:
Hello Steve,

I was just compiling a reply to this when Rob beat me to it! He's given the
technical answer, but here's a rough-and-ready example using a label.

I noticed that the label disappears when you click button2, so you may have
to mess around to bring the label to the top each time the button is
pressed. There's probably a more elegant way, but I can't just think of one!

Glenn

#!perl -w
use strict;
use warnings;

use Win32::GUI;

my $W1 = Win32::GUI::Window->new(
        -name  => "W1",
        -title => "Main",
        -pos   => [ 100, 100 ],
        -size  => [ 100, 120 ],
);

my $W1Font = Win32::GUI::Font->new(-name => "Papyrus", -size => 9);

$W1->AddButton(
        -name => "Button1",
        -font => $W1Font,
        -size => [ 80, 20 ],
        -text => "Papyrus",
        -pos  => [ 10, 20 ],
);

$W1->AddButton(
        -name => "Button2",
        -size => [ 80, 20 ],
        -pos  => [ 10, 50 ],
);

$W1->AddLabel(
        -parent => $W1->Button2,
        -size => [ 78, 18 ],
        -pos => [ 1, 1 ],
        -font => $W1Font,
        -background => 0xFFFFFF,
        -foreground => 0x0000FF,
        -text => "Hello",
        -align => "center",
);

$W1->Show();
Win32::GUI::Dialog();


-----Original Message-----
From: [EMAIL PROTECTED]
[mailto:[EMAIL PROTECTED] On Behalf Of Steve
Loughran
Sent: Tuesday, 03 January, 2006 18:33
To: perl-win32-gui-users@lists.sourceforge.net
Subject: [perl-win32-gui-users] Newbie Alert -> Button options

Hi all

I have only been playing with Win32::Gui for about 11 hours so far, but its doing almost everything I want it to do so far (windows, buttons, -onEVENT, hooking it into Win32:GuiTest, all works great...)

... but, like most newbies, there are always some things that elude me:

Question #1: Can Button objects have a foreground and background color? It doesnt seem to work for me (no idea why)

Question #2: Can the font and color in Button objects be chosen?

Many thanks in advance for your help, it is greatly appreciated

Steve


-------------------------------------------------------
This SF.net email is sponsored by: Splunk Inc. Do you grep through log files
for problems?  Stop!  Download the new AJAX search engine that makes
searching your log files as easy as surfing the  web.  DOWNLOAD SPLUNK!
http://ads.osdn.com/?ad_id=7637&alloc_id=16865&op=click
_______________________________________________
Perl-Win32-GUI-Users mailing list
Perl-Win32-GUI-Users@lists.sourceforge.net
https://lists.sourceforge.net/lists/listinfo/perl-win32-gui-users
http://perl-win32-gui.sourceforge.net/



-------------------------------------------------------
This SF.net email is sponsored by: Splunk Inc. Do you grep through log files
for problems?  Stop!  Download the new AJAX search engine that makes
searching your log files as easy as surfing the  web.  DOWNLOAD SPLUNK!
http://ads.osdn.com/?ad_id=7637&alloc_id=16865&op=click
_______________________________________________
Perl-Win32-GUI-Users mailing list
Perl-Win32-GUI-Users@lists.sourceforge.net
https://lists.sourceforge.net/lists/listinfo/perl-win32-gui-users
http://perl-win32-gui.sourceforge.net/


Reply via email to