# TEST.PL
# -------
# This test script is to demonstrate the use of the Win32::Dialog
# extension. This was used as a proof-of-concept.
# roth 970504
use Win32::Dialog;
$Temp = join("", `ipconfig`);
($IP) = ($Temp =~ /IP Address.*?: (\S*)/gis);
$IP = "localhost" unless $IP;
@y = (10, 37, 53, 86);
%Box = (
Style => DS_SETFOREGROUND | DS_MODALFRAME | WS_CAPTION | WS_VISIBLE | WS_SYSMENU | WS_SIZEBOX,
ExtendedStyle => 0,
x => 10,
y => $y[0],
cx => 200,
cy => 250,
Font => "Arial Bold Italic",
FontSize => 12,
# color structure: 0xbbggrr
backcolor => CR_GRAYLT,
fontcolor => CR_WHITE,
Title => "Ameritech IT Survey"
);
%Button = (
Style => BS_PUSHBUTTON | WS_VISIBLE | WS_TABSTOP,
x => 50,
y => 110,
cx => 40,
cy => 10,
ID => IDOK,
Class => "BUTTON",
textcolor => CR_RED,
fontstyle => FN_BOLD | FN_ITALIC,
Title => "Continue...",
font => "Times New Roman",
fontsize => 14
);
%Button2 = (
Style => BS_PUSHBUTTON | WS_VISIBLE | WS_TABSTOP,
x => 10,
y => 110,
cx => 35,
cy => 10,
ID => IDCANCEL,
Class => "BUTTON",
backcolor => CR_BLUE,
fontcolor => CR_WHITE,
Title => "Cancel",
Font => "Times New Roman",
fontstyle => FN_BOLD,
);
%Group = (
Style => BS_GROUPBOX | WS_VISIBLE | WS_TABSTOP,
x => 15,
y => 28,
cx => 170,
cy => 75,
Class => "BUTTON",
fontstyle => FN_BOLD | FN_ITALIC,
font => "ARIAL",
fontcolor => CR_YELLOWLT,
Title => "Answer these questions...",
);
%Check = (
Style => WS_VISIBLE | WS_TABSTOP | BS_AUTOCHECKBOX,
x => 10,
y => 160,
cx => 100,
cy => 10,
Class => "BUTTON",
fontcolor => CR_REDLT,
backcolor => CR_GRAYLT,
Title => "So this is a check box.",
Name => "CheckBox"
);
%Edit1 = (
Style => WS_BORDER | WS_VISIBLE | WS_TABSTOP,
x => 120,
y => 37,
cx => 55,
cy => 12,
Class => "EDIT",
Name => "Cube",
font => "Arial",
fontstyle => FN_PLAIN,
fontsize => 12,
fontcolor => CR_BLUE,
Init => "2430a"
);
%Edit2 = (
Style => ES_CENTER | WS_BORDER | WS_VISIBLE | WS_TABSTOP,
x => 120,
y => $y[2],
cx => 55,
cy => 12,
fontcolor => CR_REDLT,
# backcolor => CR_BLACK,
fontsize => 14,
Init => "Test",
Class => "EDIT",
Name => "Jack"
);
%Edit3 = (
Style => ES_CENTER | WS_BORDER | WS_VISIBLE | WS_TABSTOP,
x => 120,
y => $y[3],
cx => 60,
cy => 12,
Class => "EDIT",
fontcolor => CR_YELLOW,
backcolor => CR_BLACK,
Init => "$IP",
Name => "IP"
);
%Static = (
Style => SS_SUNKEN | WS_VISIBLE | SS_SUNKEN,
x => 5,
y => 2,
cx => 190,
cy => 17,
Class => "STATIC",
textcolor => CR_RED,
Font => "Courier",
fontsize => 10,
fontstyle => FN_BOLD,
Init => "Data collection for this computer.\nPlease answer these questions."
);
%Question1 = (
Style => WS_VISIBLE | SS_SUNKEN,
x => 20,
y => $y[1],
cx => 150,
cy => 12,
Class => "STATIC",
font => "Times New Roman",
fontsize => 12,
fontsytle => FN_BOLD,
fontcolor => CR_BLUE,
Init => "What is your cube number?"
);
%Question2 = (
Style => WS_VISIBLE | SS_SUNKEN,
x => 20,
y => $y[2],
cx => 150,
cy => 30,
Font => "Arial",
fontsize => 14,
fontstyle => FN_BOLD ,
fontcolor => CR_BLUE,
Class => "STATIC",
IniT => "What is your communication\nJack number?\n(The socket where your phone plugs into)"
);
%Question3 = (
Style => WS_VISIBLE | SS_SUNKEN,
x => 20,
y => $y[3],
cx => 150,
cy => 12,
Class => "STATIC",
Title => "What is your IP address?",
FontSize => 14,
fontcolor => CR_BLUE,
Font => "Courier New"
);
%Radio1 = (
Style => BS_AUTORADIOBUTTON | WS_TABSTOP | WS_GROUP | WS_VISIBLE,
x => 120,
y => 105,
cx => 60,
cy => 10,
Class => "BUTTON",
Title => "Radio Button 1",
ID => 1001,
textcolor => CR_GREEN,
Name => "Radio1"
);
%Radio2 = (
Style => BS_AUTORADIOBUTTON | WS_TABSTOP | WS_VISIBLE,
x => 120,
y => 115,
cx => 60,
cy => 10,
Init => 1,
Class => "BUTTON",
Title => "Radio Button 2",
ID => 1002,
textcolor => CR_GREEN,
Name => "Radio2",
font => "FixedSys",
);
@Temp = (1, 2, 3, "Line1", "Line2" , "Line 2.5\n Line 2.75", "Line 3 (Last one)");
%ComboBox = (
Style => CBS_DROPDOWN | CBS_AUTOHSCROLL | WS_TABSTOP | WS_VISIBLE,
x => 12,
y => 125,
cx => 60,
cy => 80,
Init => \@Temp,
Class => "COMBOBOX",
Title => "Combo Box 1",
Name => "ComboBox1"
);
@Temp2 = ("Line 1", "Line 2" , "Line 2.5", "Line 3",
"This is a longer line",
"This is the longest line of all of these lines!",
"This is the last line");
%ListBox = (
Style => WS_VSCROLL | WS_BORDER | LBS_EXTENDEDSEL | WS_TABSTOP | WS_VISIBLE,
x => 80,
y => 125,
cx => 80,
cy => 40,
font => "Courier New",
fontstyle => FN_ITALIC,
fontcolor => 0x00f00080,
Init => [@Temp2],
# Init => \@Temp2,
# Init => [("one", "two", "three")],
Class => "LISTBOX",
Title => "List Box 1",
Name => "ListBox1"
);
%EditComment = (
Style => ES_MULTILINE | WS_BORDER | WS_VISIBLE | WS_TABSTOP,
x =>50,
y => 190,
cx => 100,
cy => 40,
Class => "EDIT",
backcolor => CR_GRAY,
Name => "Comment",
font => "Arial",
fontstyle => FN_PLAIN,
fontsize => 14,
fontcolor => CR_GREEN,
Init => "This is an Edit Box!"
);
%Comment = (
Style => SS_CENTER | WS_VISIBLE,
x =>25,
y => 178,
cx => 150,
cy => 14,
Class => "STATIC",
Name => "Comment",
font => "Bookman Old Style",
fontstyle => FN_BOLD,
fontsize => 14,
fontcolor => CR_BLUE,
Init => "Leave Your Comment:"
);
print "Running Dialog...";
undef $Test;
%Test = Win32::Dialog::Create(\%Box,
\%Button,
\%Question1,
\%Question1,
\%Check,
\%Button2,
\%Edit1,
\%Question2,
\%Edit2,
\%Question3,
\%Edit3,
\%Static,
\%ComboBox,
\%ListBox,
\%Group,
\%Radio1,
\%Radio2,
\%Comment,
\%EditComment,
);
print "$Test.\n";
print "Results: $Result\n";
foreach (keys(%Test)){
print "\t$_ = \"$Test{$_}\"\n";
undef $Temp;
$Temp = $Test{$_};
if (scalar @$Temp){
print "\t\t\"" . join("\"\n\t\t\"", (@$Temp)) . "\"\n";
}
}
               (
geocities.com/siliconvalley/park)                   (
geocities.com/siliconvalley)