Sean - thanks for your input. I hadn't thought of checking for the mouse 
position. Your drawbacks are BIG drawbacks and definitely would not be worth 
bothering with.

I had thought of doing it with a button or some other action, but I keep coming 
back to your drawback #2. How do I determine what the default browser is and 
where it is located? There is a Win32::FileType module where you can test file 
associations, but I couldn't seem to get it to work. Theoretically wherever 
your .html is associated, that is your default browser. I believe both IE and 
Netscape use this to check to see if they are the default browser.
Below is the code I have used to test out the Win32::FileType module, any help 
would be appreciated.
                Tim

use Win32::FileType; 

check(".txt");
check(".pl");
check("Perl");
check(".doc");
check("Perl File");
check(".htm");
check(".html");


sub check {
        print "-"x20,"\n";
        ($type)[EMAIL PROTECTED];
        if ($obj = Win32::FileType::Open($type)) 
                {
                my ($command,$title);
                print "type=$type\n";
                print "title=",$obj->Title,"\n";
                print "name=",$obj->Name,"\n";
                print "Icon=",$obj->Icon,"\n";
                print "Extensions= (".join(', ',$obj->Extensions).")\n"; 

############################################################
#none of this stuff seems to work
#
#
                print "Default Action=",$obj->DefaultAction,"\n";

                print "Action=",$obj->Action("Open"),"\n";

                ($command,$title) = $obj->Action('&open') ;
                print "command, title=$command, $title\n";

                ($command,$title) = $obj->Action('open') ;
                print "command, title=$command, $title\n";
                ($command,$title) = $obj->Action("Open") ;
                print "command, title=$command, $title\n";

                ($command,$title) = $obj->Action($type) ;
                print "command, title=$command, $title\n";

                $command = $obj->Action($obj->Title) ;
                print "command, title=$command, $title\n";

                ($command,$title) = $obj->Action($obj->Title) ;
                print "command, title=$command, $title\n";

                ($command,$title) = $obj->Action($obj->Name) ;
                print "command, title=$command, $title\n";

                $command = $obj->Action($obj->Name) ;
                print "command=$command\n";

                ($command,$title) = $obj->Action('') ;
                print "command, title=$command, $title\n";

                ($command,$title) = $obj->Action("/open/i") ;
                print "command, title=$command, $title\n";


                        #print "Anything=",$obj->Anything(),"\n";
                        #($action, $title) = DDEAction($obj->Name); 
                        #print "action, title=$action, $title\n";
#
#
#none of the above stuff seems to work
############################################################

                $obj->Close
                }
        else {print "\"$type\" is not associated\n";}
}

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


-----Original Message-----
From: Sean Healy [mailto:[EMAIL PROTECTED]
Sent: Thursday, January 11, 2001 9:22 AM
To: perl-win32-gui-users@lists.sourceforge.net
Subject: RE: [perl-win32-gui-users] URL Link Object?


Never tried it or even seen anything on it, but theoretically you should be 
able to grab the mouse position in the window, and if it falls within the 
bounds of the text which should be a link, open an external application.

Some drawbacks:
1) You would have to change the mouse position range every time you changed 
the text (or else write a little something to find out the mouse position 
range of the text you want - but that would have to take into account font 
face, font size, and the length of the preceding string, and might be a 
little too complex to bother with.

2) You would have to write something to find the path of the default browser
if you plan to distribute, as not everyone uses the same browser or keeps it 
in the same place.

However, if you are going to use this only for yourself and not change the 
link text (or the text surrounding it), you could theoretically do this to 
make it work.

>Is there an object within Win32::GUI that will allow you to have a URL link 
>in a GUI-window? When you click on the text it should open up your default 
>browser and take you to that URL. You know, the kind that a lot of Apps 
>have in their About screen. Or is there another way to create this effect?
_________________________________________________________________
Get your FREE download of MSN Explorer at http://explorer.msn.com


_______________________________________________
Perl-Win32-GUI-Users mailing list
Perl-Win32-GUI-Users@lists.sourceforge.net
http://lists.sourceforge.net/lists/listinfo/perl-win32-gui-users

Reply via email to