(Browser) Widget documentation

hh hh at hyperhh.de
Wed Sep 20 12:03:55 EDT 2017


> Ben R. wrote:
> General question: where can users find a reference to the supported 
> properties/commands/functions of widgets? E.g. the properties of a Segmented 
> Control widget?
> More specific immediate question: where can I find a reference for the Browser widget?

In the dictionary (sorted by random) or in tinydict (sorted) choose the widget in the API menu.

> Ben R. wrote:
> Even more specific question: how can I interrogate the contents of the loaded 
> page in a browser widget? e.g. the dictionary has
> 
> 	-- Use JavaScript to hide "myButton" in the page displayed in a browser widget.
> 	do "document.getElementById('myButton').hidden = 'hidden'" in widget "myBrowser"
> 
> But how would I get the value of document.getElementById('myButton').hidden 
> back to LiveCode?

___ 1. In your card's script (for example) put:

on openCard
   set the javascriptHandlers of widget "browser" to "jsGetValue"
end openCard

-- handles the return from the browser
on jsGetValue pValue
   put pValue into fld "OUT"
end jsGetValues

___ 2. Then use this as follows.

put "var x=document.getElementById('myButton').value; liveCode.jsGetValue(x);" into js
do js in widget "browser"

Note.
There may be more javascriptHandlers, separate them by cr.
(Was a bug in some versions on Win: If not working separate them by comma).
You may use more than one argument for javascriptHandlers.
That's all.
You don't have to declare them (here jsGetValue) as function in the HTML document.

HTH, H.



More information about the Use-livecode mailing list