Tek-Tips is the largest IT community on the Internet today!

Members share and learn making Tek-Tips Forums the best source of peer-reviewed technical information on the Internet!

  • Congratulations SkipVought on being selected by the Tek-Tips community for having the most helpful posts in the forums last week. Way to Go!

Tkweb: change cursor to hand2 over links

Status
Not open for further replies.

xwax

Programmer
Oct 2, 2008
8
0
0
US
Can anyone point out how one would change the cursor in Tkweb browser to hand2 when over a link? I can change the cursor to hand2 in the page, but it remains that way, everywhere.
Do I need to bind something to a link with a <Button-1> and configure from there? Or is there something else I should look into?
 
The easiest and most standard way is with the CSS directive:
Code:
a:hover { cursor: hand }

This needs to be placed in the stylesheet within your page header.

Yours,

fish

[&quot;]As soon as we started programming, we found to our surprise that it wasn't as easy to get programs right as we had thought. Debugging had to be discovered. I can remember the exact instant when I realized that a large part of my life was going to be spent in finding mistakes in my own programs.[&quot;]
--Maurice Wilkes, 1949
 
I think the original poster is referring to the `tkweb` script that comes with Tk::HTML,
Tk::HTML feels like a very incomplete project to me. I poked around at it a number of different times in the past, mainly trying to get its HTML-rendering widget out of it to use in a different program, before I ended up creating my own (Tk::HyperText). But Tk::HTML and tkweb look to me like more of a technical curiosity of Nick Ing-Simmons, but its lack of documentation supports the theory that it wasn't cared for too much by its creator.

So you'll just have to modify its source code yourself, browse through until you find where it handles links and change the cursor yourself.

(changing it in the CSS won't do anything. I'm skeptical that tkweb even supports CSS to begin with anyway)

-------------
Cuvou.com | My personal homepage
Code:
perl -e '$|=$i=1;print" oo\n<|>\n_|_";x:sleep$|;print"\b",$i++%2?"/":"_";goto x;'
 
Nick Ing-Simmons passed away a little while back, so don't expect anything to ever come of any of his old modules unless the perl 5 porters decide to update them. I am pretty sure they are all listed as PAUSE custodial accounts now.

------------------------------------------
- Kevin, perl coder unexceptional! [wiggle]
 
Fair point, Kirsle. I should have read the original post properly.

Apologies,

fish

[&quot;]As soon as we started programming, we found to our surprise that it wasn't as easy to get programs right as we had thought. Debugging had to be discovered. I can remember the exact instant when I realized that a large part of my life was going to be spent in finding mistakes in my own programs.[&quot;]
--Maurice Wilkes, 1949
 
Thanx,
I have poked around the modules. Ditto, Kirsle, on the documentation.

@Kirsle:
After looking at your module, Tk::HyperText, am I correct in assuming that one could simulate CGI(request/response) scripts using that module?
 
With Tk::HyperText iirc I was able to search CPAN. It has support for rendering most web form components and does tables and stuff, and has a handler for when forms get submitted, so you could adapt it to be a "rough and ready web browser" :p But I wouldn't recommend browsing the general internet with it as it wouldn't do very well (I tried a handful of sites myself).

So you can try poking around at it and see if you can get it to do what you want. One thing I have on my to-do list for it is, there's no method yet for adding additional content to the widget, only to replace the entire page it's rendered with a new one. If ya have any suggestions for it and they aren't too time-consuming (adding CSS would need a significant restructuring of the code, for example) tell me so I can improve the module. :)

-------------
Cuvou.com | My personal homepage
Code:
perl -e '$|=$i=1;print" oo\n<|>\n_|_";x:sleep$|;print"\b",$i++%2?"/":"_";goto x;'
 
I managed to put together a simple browser. Not too bad. Now I understand the complexity of the modern browser! Using, Tk::HyperText, I did notice problems with table widths and it seems that unless "border" is lowercase, it ignores it...at least on Win32, Active Perl (5.8.8).
 
Probably.

As for table widths, Tk::Text isn't a very flexible widget. The tables work by basically creating additional Tk::HyperText widgets and embedding them inside of a frame using a grid() layout, and the frame is embedded inside the parent Tk::HyperText widget (so a new text widget for each table cell).

And Tk::Text only understands width and height in relation to characters, and not pixels. So size=20 means 20 characters wide. And so when it makes table cells it sizes each cell in a way that hopefully all of its contents can be seen without having extra scrollbars inside of the cell (which would look just awful). It falls apart when you embed images inside of table cells, since Tk has no way of figuring out how many "characters" wide an image is.

A better method would be Tk::Canvas and then just throw in label widgets all over, but that opens a whole new can of worms since it would then need to manage word wrapping and stuff manually, and trying to calculate how to word wrap on a label that uses a variable-width font like Times New Roman isn't an easy task.

I made the widget to mimic AOL Instant Messenger's html widgets, so it does hypertext really well. Tables and forms and other such stuff I added in because I felt like doing so, but it ain't perfect. :p I don't think a Perl version of the Tcl/Tk web browser is possible, since Perl's version of Tk is far more ancient than Tcl's current version and has really primitive widgets.

Cuvou.com | My personal homepage
Code:
perl -e '$|=$i=1;print" oo\n<|>\n_|_";x:sleep$|;print"\b",$i++%2?"/":"_";goto x;'
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top