Updated 22 Oct 2005
Brother t0mas -- Thanks so much for adding the button bevel size change to ButtonFactory. What was once good is even better!
In the interest of sharing, just for fun, I am posting some code I quickly hacked up last night to do something a little different with ButtonFactory from the command line. Based on what you include as a sample command-line script in the POD, here is what I am doing:
#!perl -w ## ------------------------------------------------------------ # MS Windoze-specific script. Sorry :-). ## ------------------------------------------------------------ # NOT like t0mas' original idea -- this makes buttons for # horizontal row use only bec if button text is longer # than 20 chars, it expands the length by 8 px for each one # (based on 8pt Myriad font). use ButtonFactory; use Win32::Clipboard; my ( $N_state $P_state @RGBt $BWi ); my $clipping; my $name_it = shift @ARGV; my $btnText = shift @ARGV; my $expsn = ((length ($btnText) - 20) > 0)? (length ($btnText) - 20) * 8 : 0 ; $BWi = 90 + $expsn; @RGBt = ($clipping=Win32::Clipboard::Get()) # Pick-'o-Color format for rgb triplet: "RGB(155, 50, 23)" ? grep /\d+/, (split /[^\d]/,$clipping) : split(/[^\w]/, shift @ARGV); if (scalar @RGBt == 3) { print "Using ", join( ', ',@RGBt ), " for color specification for b +uttons\n"; } else { die "No color as RGB triplet gotten! \nContents of \@RGBt if any: " ." $clipping ". "@RGBt"; } my $x=new ButtonFactory($BWi,21, $RGBt[0],$RGBt[1],$RGBt[2], $btnText =>"Myriad Web Bold.ttf"=>8); $N_state = $name_it .'N_state.png'; $P_state = $name_it .'P_state.png'; open (FILE,">$N_state") or die $!; binmode FILE; my $Ntime = time; print FILE $x->printNormal(); close (FILE); open (FILE,">$P_state") or die $!; binmode FILE; print FILE $x->printPressed(); close (FILE); utime $Ntime, $Ntime, ($N_state, $P_state); _END_
Best,
soren Intrepid
In reply to RE: ButtonFactory
by Intrepid
in thread ButtonFactory
by t0mas
| For: | Use: | ||
| & | & | ||
| < | < | ||
| > | > | ||
| [ | [ | ||
| ] | ] |