I would like to migrate my app from using htmlWindow to Webview found in 2.9 but have some questions as to how to duplicate some methods.
What is the proper method of passing a Javascript variable to (wx)Python? For instance, with htmlWindow one can use an htmlCell event to get the text in a cell or line, but Webview has no equivalent. Apparently one must use Javascript. How does one pass say a Javascript onclick “innerText” variable back to Python when a user clicks a line in the display?
It does not appear that the Javascript onload function works with Webview. Instead there is a Webview WEB_VIEW_LOADED event. If one wanted to scroll a page to a certain position or css element id after it is loaded, how would this be done in a WEB_VIEW_LOADED function? Normally, this is done with the Javascript onload function.
What is the proper way to duplicate the htmlCell.ConvertToText() method in Webview? Is there an equilivent way to get the text of a single word on a click or mouseover?
I really like the new Webview feature since it uses CSS and Javascript, but getting it to duplicate some of the htmlWindow functions is proving problematic.
You should probably ask these questions on wx-users since the author of the new webview classes will likely see the message there.
···
On 12/23/12 7:02 PM, tsmorton wrote:
I would like to migrate my app from using htmlWindow to Webview found in
2.9 but have some questions as to how to duplicate some methods.
1. What is the proper method of passing a Javascript variable to
(wx)Python? For instance, with htmlWindow one can use an htmlCell event
to get the text in a cell or line, but Webview has no equivalent.
Apparently one must use Javascript. How does one pass say a Javascript
onclick "innerText" variable back to Python when a user clicks a line in
the display?
2. It does not appear that the Javascript onload function works with
Webview. Instead there is a Webview WEB_VIEW_LOADED event. If one wanted
to scroll a page to a certain position or css element id after it is
loaded, how would this be done in a WEB_VIEW_LOADED function? Normally,
this is done with the Javascript onload function.
3. What is the proper way to duplicate the htmlCell.ConvertToText()
method in Webview? Is there an equilivent way to get the text of a
single word on a click or mouseover?
I really like the new Webview feature since it uses CSS and Javascript,
but getting it to duplicate some of the htmlWindow functions is proving
problematic.