>>I'd like to create hyperlinks in an "About" window. I used a label, but didn't see any colour change. Do I need to use RichEdit for colours?
I don't suppose anybody already has any code for hyperlinks?<< Attached: Hyperlink.pm Text from the message Hyperlink originally appeared in: >>please find attached HyperLink.pm, which implements a 'regular' Win32::GUI::HyperLink control ;-) warning: the code is full of black (maybe voodoo) magic. using it is this simple: use Win32::GUI; use Win32::GUI::HyperLink; my $Window = new Win32::GUI::Window( -title => 'Win32::GUI::HyperLink demo', -pos => [ 100, 100 ], -size => [ 150, 100 ], -name => 'Window', ); $Window->AddHyperLink( -text => "dada's perl lab", -name => "test", -pos => [ 25, 25 ], -url => "http://dada.perl.it", # or: -url => "mailto:[EMAIL PROTECTED]", ); $Window->Show(); my $rc = Win32::GUI::Dialog(0); sub Window_Terminate { return -1; } you don't need to specify a Click event, the HyperLink class already provides a default one that simply activates the link.<< - ______________________________ "Very funny Scotty. Now beam up my clothes."
package Win32::GUI::HyperLink; my $VERSION = "0.02"; use Win32::GUI; use Win32::GUI::BitmapInline 0.02; use Win32::API 0.20; @ISA = qw( Win32::GUI::Label ); my $LoadCursor = new Win32::API("user32", "LoadCursor", "NN", "N"); my $ShellExecute = new Win32::API("shell32", "ShellExecute", "NPPPPI", "N"); my $linkCursor = $LoadCursor->Call( 0, 32649 ); if(not $linkCursor) { $linkCursor = newCursor Win32::GUI::BitmapInline( q( AAACAAEAICAAAAwAAQDoAgAAFgAAACgAAAAgAAAAQAAAAAEABAAAAAAAgAIAAAAAAAAAAAAAAAAA AAAAAAAAAAAAAACAAACAAAAAgIAAgAAAAIAAgACAgAAAgICAAMDAwAAAAP8AAP8AAAD//wD/AAAA /wD/AP//AAD///8AAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAATMREREQAAA AAAAAAAAAAAEzEREREAAAAAAAAAAAAAABMxERERAAAAAAAAAAAAAAATMREREQAAAAAAAAAAAAAAE zEREREAAAAAAAAAAAAAAAEQAAAAAAAAAAAAAAAAAAAB////4AAAAAAAAAAAAAAAAf///+AAAAAAA AAAAAAAAB/////+AAAAAAAAAAAAAAH//////gAAAAAAAAAAAAAf///////gAAAAAAAAAAAAH//// ///4AAAAAAAAAAAAf///////+AAAAAAAAAAAAH////////+AAAAAAAAAAAf/////////gAAAAAAA AAAH/4j//////4AAAAAAAAAAf/gA//////+AAAAAAAAAAH+AB/////9/gAAAAAAAAAf4AAf/f/f4 D4AAAAAAAAAHcAAH+A+A+A+AAAAAAAAAAAAAB/gPgPgHcAAAAAAAAAAAAAf4D4D4AAAAAAAAAAAA AAAH+A+AdwAAAAAAAAAAAAAAB/gHcAAAAAAAAAAAAAAAAAf4AAAAAAAAAAAAAAAAAAAH+AAAAAAA AAAAAAAAAAAAB/gAAAAAAAAAAAAAAAAAAAf4AAAAAAAAAAAAAAAAAAAAdwAAAAAAAAAAAAAAAAAA AAAAAAAAAAAAAAD////////////gA///4AP//+AD///gA///4AP///AH///wB///8Af//+AD///A A///gAH//4AB//8AAf//AAD//gAA//4AAP/8AAD//CAA//hgAP/44AD//+AB///gB///4A///+B/ ///h////4f///+H////h////8////////w== ) ); } my %linkFont = Win32::GUI::Font::Info(Win32::GUI::GetStockObject(17)); $linkFont{-underline} = 1; my $linkFont = new Win32::GUI::Font( %linkFont ); my $linkClass = new Win32::GUI::Class( -name => "Win32::GUI::HyperLink", -extends => "STATIC", -cursor => $linkCursor, ); sub new { my $class = shift; my $parent = shift; my %options = @_; $options{-class} = $linkClass; $options{-foreground} = [0, 0, 255] unless exists $options{-foreground}; $options{-font} = $linkFont unless exists $options{-font}; $options{-notify} = 1; eval qq( sub main::$options{-name}_Click { Win32::GUI::HyperLink::OpenLink("\Q$options{-url}\E"); } ); return new Win32::GUI::Label( $parent, %options ); } sub Win32::GUI::Window::AddHyperLink { return Win32::GUI::HyperLink->new(@_); } sub OpenLink { $ShellExecute->Call( 0, 0, shift, 0, 0, 6); } 1;