|
From: Thomas, T. B <tim...@lm...> - 2001-01-11 16:59:03
|
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;=20
check(".txt");
check(".pl");
check("Perl");
check(".doc");
check("Perl File");
check(".htm");
check(".html");
sub check {
print "-"x20,"\n";
($type)=3D@_;
if ($obj =3D Win32::FileType::Open($type))=20
{
my ($command,$title);
print "type=3D$type\n";
print "title=3D",$obj->Title,"\n";
print "name=3D",$obj->Name,"\n";
print "Icon=3D",$obj->Icon,"\n";
print "Extensions=3D (".join(', ',$obj->Extensions).")\n";=20
############################################################
#none of this stuff seems to work
#
#
print "Default Action=3D",$obj->DefaultAction,"\n";
print "Action=3D",$obj->Action("Open"),"\n";
($command,$title) =3D $obj->Action('&open') ;
print "command, title=3D$command, $title\n";
($command,$title) =3D $obj->Action('open') ;
print "command, title=3D$command, $title\n";
($command,$title) =3D $obj->Action("Open") ;
print "command, title=3D$command, $title\n";
($command,$title) =3D $obj->Action($type) ;
print "command, title=3D$command, $title\n";
$command =3D $obj->Action($obj->Title) ;
print "command, title=3D$command, $title\n";
($command,$title) =3D $obj->Action($obj->Title) ;
print "command, title=3D$command, $title\n";
($command,$title) =3D $obj->Action($obj->Name) ;
print "command, title=3D$command, $title\n";
$command =3D $obj->Action($obj->Name) ;
print "command=3D$command\n";
($command,$title) =3D $obj->Action('') ;
print "command, title=3D$command, $title\n";
($command,$title) =3D $obj->Action("/open/i") ;
print "command, title=3D$command, $title\n";
#print "Anything=3D",$obj->Anything(),"\n";
#($action, $title) =3D DDEAction($obj->Name);=20
#print "action, title=3D$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 =B7 Denver Data Center
303-430-2281
mailto:tim...@lm...
------------------------------------------------------------------------=
-------------------------
-----Original Message-----
From: Sean Healy [mailto:jal...@ho...]
Sent: Thursday, January 11, 2001 9:22 AM
To: per...@li...
Subject: RE: [perl-win32-gui-users] URL Link Object?
Never tried it or even seen anything on it, but theoretically you =
should be=20
able to grab the mouse position in the window, and if it falls within =
the=20
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=20
the text (or else write a little something to find out the mouse =
position=20
range of the text you want - but that would have to take into account =
font=20
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=20
in the same place.
However, if you are going to use this only for yourself and not change =
the=20
link text (or the text surrounding it), you could theoretically do this =
to=20
make it work.
>Is there an object within Win32::GUI that will allow you to have a URL =
link=20
>in a GUI-window? When you click on the text it should open up your =
default=20
>browser and take you to that URL. You know, the kind that a lot of =
Apps=20
>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
Per...@li...
http://lists.sourceforge.net/lists/listinfo/perl-win32-gui-users
|