# Eric Hansen, ITSi, Dallas, TX July 1999
use Win32::GUI;
use Time::localtime;
# Hide the Dos Window
($DOShwnd, $DOShinstance) = GUI::GetPerlWindow();
GUI::Hide($DOShwnd);
$mm=localtime-mon()+1;
$dd=localtime-mday();
@fields = split(/ /,ctime());
$lastfld=$#fields;
$=$fields[$lastfld];
$Today=sprintf("%4s%02s%02s",$,$mm,$dd);
$W = new GUI::DialogBox (
-title= "Change Color On The Fly",
-left = 100,
-top = 20,
-width= 250,
-height = 250,
-name = "Window",
);
$Font = new Win32::GUI::Font(
-name = "Courier New",
-size = 12,
-weight = 700,
-height = -14,
);
$BeginDateButton = $W-AddButton(-name = "BeginDateButton",
-text = "Color",
-left = 145,
-top = 100,
-group = 1,
-tabstop = 1,
-height = 25,
-width = 30 );
$BeginDate = $W-AddTextfield(-name = "BeginDate",
-text = $Today,
-font = $Font,
-foreground = 0x8080FF,# soft red
-left = 65,
-top = 100,
-group = 1,
-tabstop = 1,
-height = 20,
-width = 75 );
$BeginDate-SetFocus();
$BeginDate-Select(0,length($BeginDate-Text()));
$BeginDate-SendMessage(197, 8, 0); # limit to 8 characters input
$W-Show;
GUI::Dialog();
sub BeginDateButton_Click {
my $text = $BeginDate-Text();
my $color = GUI::ChooseColor(-owner = $W);
if ($color) {
$BeginDate-Change(-foreground = $color, -text = $text);
}
}
Window_Terminate {
GUI::Show($DOShwnd);
return -1;
}
# End Script
-Original Message-
From: Moore, Paul [SMTP:[EMAIL PROTECTED]]
Sent: Friday, July 16, 1999 3:28 AM
To: '[EMAIL PROTECTED]'; '[EMAIL PROTECTED]'
Subject:RE: [perl-win32-gui] Win32::GUI Tutorial, part 1
From: christopher paul [mailto:[EMAIL PROTECTED]]
would be cool to see some things like "how to call up a color
picker" a "file-open/save dialog" .. also eric's dbgrid would
make a great chapter, if he's keen.
Thanks for the encouragement. I'll certainly look at colour pickers and
file dialogs - but I haven't got to the point where *I* know how to use
them yet, so I'll take things in the order I discover them for now.
I'll look at the dbgrid, but I was also thinking of using (when I get a
bit more advanced!) listviews and DBI to do a SQL query viewer (my job
is as a DBA, so it's relevant to me), as a way of learning list views.
Maybe I could include a comparison with the dbgrid approach...
Anyway, it's good to know the stuff is useful.
Paul.