Here's the code that you all helped me to figure out. You can use this to
implement a clickable URL in your About Window, or whereever you like. The
code may not be very clean, let me know if you have suggestions to improve
this. This example runs as-is.

Aldo - any way to build all this in to the GUI Module and just have a -URL
option on the label? or a separate object?

        Thanks everyone!
                Tim Thomas


use Win32;
use Win32::GUI;
use Win32::Process;


$title='TestTool';
$author='T. Thomas';
$contact='[EMAIL PROTECTED]';
$contacturl='www.coloradonarwhal.com';
$version="1.0";
$date='January 2001';

my $AboutWindow = new GUI::Window(-title=>"About $title...", -left=>110,
-top=>110, -width=>230, -height=>150, -name=>"AboutWindow",);
        my $AboutTitleFont = new Win32::GUI::Font(-name => "Times New
Roman", -height => 20, -bold => 1);
        my $AboutFont = new Win32::GUI::Font(-name => "Times New Roman",
-height => 15);
        my $URLFont = new Win32::GUI::Font(-name => "Times New Roman",
-height => 15, -underline => 1);

        my $AboutTitle = $AboutWindow->AddLabel(    -top => 13,    -left =>
5,    -height => 32,    -width => $AboutWindow->ScaleWidth-10,    -name =>
"AboutTitle",     -text => "$title Version $version",    -font =>
$AboutTitleFont,);
        my $AboutDetails = $AboutWindow->AddLabel(    -top => 32,    -left
=> 5,    -height =>15*3,    -width => $AboutWindow->ScaleWidth-10,    -name
=> "AboutDetails", -text=>"Author: $author\r\nContact: $contact\r\nDate:
$date\r\n\r\n", -font => $AboutFont);
        my $AboutURL = $AboutWindow->AddLabel(    -top
=>(32+$AboutDetails->Height),    -left => 5,    -height => $URLFont->Height,
-width => $AboutWindow->ScaleWidth-10,    -name => "AboutURL",
-text=>"$contacturl", -font => $URLFont, -notify => 1, -foreground
=>[0,0,255]);
        my $AboutOK = $AboutWindow->AddButton(-left => 0,    -top => 0,
-text => "    OK    ",    -name => "AboutOK",     -visible => 1,    -default
=> 1,    -ok => 1,);
        
$AboutOK->Move($AboutWindow->ScaleWidth-$AboutOK->Width,$AboutWindow->ScaleH
eight-$AboutOK->Height,);

$AboutWindow->Show();

Win32::GUI::Dialog();
#---------------------------------------------------------------------------
-----------------------------------------------


sub AboutOK_Click
        {
        $AboutWindow->Hide();
        exit;
        }
sub AboutWindow_Terminate
        {
        AboutOK_Click();
        return 0;
        }

sub AboutURL_Click
        {
        if ($ftype=getftype(".html"))
                {
                $ftype=~s/"//g;
                ($ftypeexe)=$ftype=~/^.*\\(.*\.exe)$/i;
                my ($process);
                Win32::Process::Create($process,$ftype,"$ftypeexe
$contacturl",0,DETACHED_PROCESS,".") || warn "Create: $!";
                }
        }

sub getftype
        {
        use Win32::TieRegistry;
        if (my ($ext) = @_)
        {
                if (my $typeName =
$Registry->{"HKEY_CLASSES_ROOT\\$ext\\\\"})
                {
                        if (my $command =
$Registry->{"HKEY_CLASSES_ROOT\\$typeName\\shell\\open\\command\\\\"})
                        {
                                my ($cmd);
                                unless (($cmd) = $command=~/^(".*")\s+.*$/)
{ ($cmd) = $command=~/^(\S*)\s/; }
                                return $cmd;
                        }
                        else { return 0; }
                }
                else { return 0; }
        }
        else { return 0; }
        }

----------------------------------------------------------------------------
---------------------
Tim Thomas
Unix Systems Administrator
Lockheed Martin EIS ยท Denver Data Center
303-430-2281
mailto:[EMAIL PROTECTED]
----------------------------------------------------------------------------
---------------------


Reply via email to