I ran an experiment for this, and changed the scrolledhtml
in iwidgets 3.1.0 (TclPro1.4). This by no means is complete
(needs to be more robust and better progress method), but it
demostrates that your request is possible, and quite easy
(it took me maybe an hour tops to do...I had to get familiar
with the http package). I think it also demonstrates the
power of Tcl and Iwidgets. Note though that the rendering
methods need to be overhauled, since with today's sites,
there aren't going to be many pages that it will render
correctly. Here is the diff:
+ public method fetch {url}
public method import {args}
public method clear {}
public method render {html {wd .}}
public method title {} {return $_title}
public method pwd {} {return $_cwd}
+ protected method _http_progress {token total current}
+ protected method _fetch_callback {token}
protected method _setup {}
protected method _set_tag {}
protected method _reconfig_tags {}
***************
*** 488,493 ****
--- 491,542 ----
set _images {}
_setup
$itk_component(text) config -state disabled
+ }
+
+
+ #
------------------------------------------------------------------
+ # METHOD fetch
+ #
+ # This will fetch a url and send the contents to the
render method
+ #
+ #
------------------------------------------------------------------
+ body iwidgets::Scrolledhtml::fetch {url} {
+
+ http::geturl $url \
+ -command [itcl::code $this _fetch_callback]
\
+ -progress [itcl::code $this _http_progress]
+
+ return
+ }
+
+
+ #
------------------------------------------------------------------
+ # METHOD _fetch_callback
+ #
+ # This is a callback for when the data is receive from the
url fetch
+ #
+ #
------------------------------------------------------------------
+ body iwidgets::Scrolledhtml::_fetch_callback {token} {
+ upvar #0 $token state
+
+ switch -- $state(status) {
+ "ok" {
+ clear
+ render "$state(body)"
+ }
+ "error" {
+ clear
+ render "$state(error)"
+ }
+ }
+
+ return
+ }
+
+ body iwidgets::Scrolledhtml::_http_progress {token total
current} {
+
+ puts "$current $total"
+ return
}
Cool idea! I've added a description of this and a reference
to this SF ticket in the incoming/README file in the 4.0.1
distribution. Hopefully we'll get a volunteer to tackle
this.
If you would like to refer to this comment somewhere else in this project, copy and paste the following link:
Logged In: YES
user_id=159778
I ran an experiment for this, and changed the scrolledhtml
in iwidgets 3.1.0 (TclPro1.4). This by no means is complete
(needs to be more robust and better progress method), but it
demostrates that your request is possible, and quite easy
(it took me maybe an hour tops to do...I had to get familiar
with the http package). I think it also demonstrates the
power of Tcl and Iwidgets. Note though that the rendering
methods need to be overhauled, since with today's sites,
there aren't going to be many pages that it will render
correctly. Here is the diff:
*** scrolledhtml.itk-old Wed May 23 20:21:34 2001
--- scrolledhtml.itk Wed May 23 21:23:39 2001
***************
*** 143,154 ****
--- 143,157 ----
itk_option define -update update Update 1
itk_option define -debug debug Debug 0
+ public method fetch {url}
public method import {args}
public method clear {}
public method render {html {wd .}}
public method title {} {return $_title}
public method pwd {} {return $_cwd}
+ protected method _http_progress {token total current}
+ protected method _fetch_callback {token}
protected method _setup {}
protected method _set_tag {}
protected method _reconfig_tags {}
***************
*** 488,493 ****
--- 491,542 ----
set _images {}
_setup
$itk_component(text) config -state disabled
+ }
+
+
+ #
------------------------------------------------------------------
+ # METHOD fetch
+ #
+ # This will fetch a url and send the contents to the
render method
+ #
+ #
------------------------------------------------------------------
+ body iwidgets::Scrolledhtml::fetch {url} {
+
+ http::geturl $url \ + -command [itcl::code $this _fetch_callback]
\ + -progress [itcl::code $this _http_progress]
+
+ return
+ }
+
+
+ #
------------------------------------------------------------------
+ # METHOD _fetch_callback
+ #
+ # This is a callback for when the data is receive from the
url fetch
+ #
+ #
------------------------------------------------------------------
+ body iwidgets::Scrolledhtml::_fetch_callback {token} {
+ upvar #0 $token state
+
+ switch -- $state(status) {
+ "ok" {
+ clear
+ render "$state(body)"
+ }
+ "error" {
+ clear
+ render "$state(error)"
+ }
+ }
+
+ return
+ }
+
+ body iwidgets::Scrolledhtml::_http_progress {token total
current} {
+
+ puts "$current $total"
+ return
}
#
------------------------------------------------------------------
Logged In: YES
user_id=103634
Cool idea! I've added a description of this and a reference
to this SF ticket in the incoming/README file in the 4.0.1
distribution. Hopefully we'll get a volunteer to tackle
this.