All pastes #813022 Raw Edit

Stuff

public text v1 · immutable
·published 2007-12-12 05:35 UTC
rendered paste body
use Win32::GUI;
my $file = shift || die "no file specified\n";
open(file, $file) or die $!;
$line=0;
our %window;
our %workspace;
while ($x=<file>) {
	$line++;
	chomp($x);
	$x=~s/\t//;
	$x=~s/\s+/ /g;
	@n=split(/\s/,$x);
	print "$x\n";
	if ($n[0] eq "window") {
		die("fatal error! $file:$line error:window \`$n[1]' already defined\n") if (defined($window{$n[1]}));
		$text = substr($x, length($n[1].$n[2].$n[3])+10);
		$window{$n[1]} = Win32::GUI::Window->new(-name => $n[1], -text => $text, -minsize => [$n[2], $n[3]],
			-width => $n[2], -height => $n[3]) or die $@;
		$window{$n[1]}->Show();
	}
	if ($n[0] eq "text") {
		$text=substr($x, length($n[0].$n[1].$n[2].$n[3].$n[4].$n[5].$n[6].$n[7])+8);
		# print "debug:text on window $n[2] (ID $n[1]) X,Y ($n[3],$n[4]) colour RGB [$n[5]/$n[6]/$n[7]] text $text\n";
		$text{$n[1]} = $window{$n[2]}->AddLabel(-text => $text, -foreground => [$n[5], $n[6], $n[7]]);
		$window{$n[2]}->Show();
	}

}

Win32::GUI::Dialog();

__END__;
window win1 100 100 Test Window
text 1 win1 0 0 255 0 0 herro world