URLPresenter enhancement

Previous Topic Next Topic
 
classic Classic list List threaded Threaded
2 messages Options
Reply | Threaded
Open this post in threaded view
|

URLPresenter enhancement

Bill Schwab-2
Blair,

Something like the following might make a nice addition to URLPresenter, or
perhaps we need a separate HTML aware value presenter????

Have a good one,

Bill

!URLPresenter methodsFor!

valueHtml:aString

"Set HTML for the receiver; shamelessly stolen from one of Blair's posts"

| browser |

browser := self view controlDispatch.

"We must wait until the browser has loaded the blank document..."

[ browser readyState == "READYSTATE_COMPLETE" 4 ]

whileFalse:[SessionManager inputState pumpMessages].

"... and then we can stuff in the HTML"

browser document body innerHTML:aString.

! !

!URLPresenter categoriesFor: #valueHtml:!public! !


--
Wilhelm K. Schwab, Ph.D.
[hidden email]


Reply | Threaded
Open this post in threaded view
|

Re: URLPresenter enhancement

tgkuo
Hi Bill,
    I here reported my experience of using your method and found that your
method ( valueHtml:) is not as good as this method ( I called it
streamHtml:, original codes from Steve's post on "HTML simple question ?") :

!URLPresenter methodsFor!

streamHtml:
"Set HTML for the receiver; from Steve's posts"

| browser pPersistStream  pStream |

   browser := self view controlDispatch.
   pPersistStream := browser  document queryInterface: IPersistStreamInit.
   pStream := (IStream onHGLOBAL) nextPutAll: aString asByteArray;
   reset;yourself.
   pPersistStream initNew.
   pPersistStream Load: pStream ! !
!URLPresenter categoriesFor: #streamHtml:!public! !

   The difference is mainly in the effect of embedded javascript codes ,
which
could be performed using this method but cann't by your method.


Best regards.
Tsun-kuo Kuo.




"Bill Schwab" <[hidden email]> wrote
:b1ccfg$11ig0m$[hidden email]...
> Blair,
>
> Something like the following might make a nice addition to URLPresenter,
or

> perhaps we need a separate HTML aware value presenter????
>
> Have a good one,
>
> Bill
>
> !URLPresenter methodsFor!
>
> valueHtml:aString
>
> "Set HTML for the receiver; shamelessly stolen from one of Blair's posts"
>
> | browser |
>
> browser := self view controlDispatch.
>
> "We must wait until the browser has loaded the blank document..."
>
> [ browser readyState == "READYSTATE_COMPLETE" 4 ]
>
> whileFalse:[SessionManager inputState pumpMessages].
>
> "... and then we can stuff in the HTML"
>
> browser document body innerHTML:aString.
>
> ! !
>
> !URLPresenter categoriesFor: #valueHtml:!public! !
>
>
> --
> Wilhelm K. Schwab, Ph.D.
> [hidden email]
>
>
>