Discussion:
revBrowserSet
Terence Heaford
2015-07-24 07:22:30 UTC
Permalink
This is my first foray into using a browser in LiveCode and I have come across a couple of points I was hoping someone could help me with:

I am experimenting using a browser to display charts using highcharts from highcharts.com and have got the example charts working in a browser.

I am working with LC 6.7.6 on iMac with Yosemite.

--------------

I have this script to setup the browser

global gBrowserID

on mouseUp
lock screen
set the visible of grc "browserOutline" to false

--put revBrowserOpenCef(the windowId of this stack, "") into gBrowserID
put revBrowserOpen(the windowId of this stack, "") into gBrowserID

revBrowserSet gBrowserID, "rect", the rect of graphic "browserOutline"
revBrowserSet gBrowserID, "offline", true
revBrowserSet gBrowserID, "scrollbars", false
revBrowserSet gBrowserID, "showBorder", true
unlock screen
end mouseUp

I have noticed that with revBrowserCef I cannot disable scrollbars and show border does not work for me but with revBrowserOpen they both work?

Perhaps I am doing something wrong or is revBrowserCef a work in progress?

———————

At the moment it appears that I will have to create my own charts in LiveCode export them as index.htm then reload them into the browser.

Is there a way to create the chart in LiveCode then pass it straight to the browser.

I tried this without success using the content of one of the example files in highcharts:

put the uScript of me into tScript
revBrowserSet gBrowserID, "htmltext", tScript
revBrowserRefresh gBrowserID

———————

Is there any better documentation on the use of the revBrowser commands or is it all to be trial and error?


Thanks


Terry
Kay C Lan
2015-07-24 08:51:50 UTC
Permalink
Post by Terence Heaford
Is there a way to create the chart in LiveCode then pass it straight to the browser.
put the uScript of me into tScript
revBrowserSet gBrowserID, "htmltext", tScript
revBrowserRefresh gBrowserID
If you were to step through your code and take the content of uScript and
paste it straight into a text editor, and then display that file in a
'real' Browser does it display correctly? I've done exactly your steps and
have had no trouble displaying LC created html in an LC Browser instance.
Actually there is one difference, I don't revBrowserRefresh, I just 'wait 1
millisec' and it displays.

As for the CEF browser I seem to remember reading something about it's the
way of the future but it is a work in progress. I may have that wrong
though.

HTH
Terence Heaford
2015-07-24 11:18:58 UTC
Permalink
Yes it works correctly if I use this script from LC with the content in a file

global gBrowserID
global gFile

on mouseUp
answer file "Select a chart to load:"
if the result is not "cancel" then
put it into gFile
revBrowserNavigate gBrowserId, "file://" & gFile
end if
end mouseUp


What I really want to do is just load the content of the file gFile directly from LC.

I thought put revBrowserSet gBrowserID,”htmlText”,theContentsOfgFile might work, but it doesn’t.

Perhaps I am using this in the wrong context but there does not appear to be any docs for using revBrowser type commands unless I can’t find them?


All the best

Terry
Post by Kay C Lan
paste it straight into a text editor, and then display that file in a
'real' Browser does it display correctly? I've done exactly your steps and
have had no trouble displaying LC created html in an LC Browser instance.
Actually there is one difference, I don't revBrowserRefresh, I just 'wait 1
millisec' and it displays.
Kay C Lan
2015-07-26 11:14:49 UTC
Permalink
Post by Terence Heaford
I thought put revBrowserSet gBrowserID,”htmlText”,theContentsOfgFile might
work, but it doesn’t.
Well it works perfectly for me so I can't figure out why it's not working
for you. As far as I know as long as 'theContentsOfgFile' is valid html
content then it should display fine in revBrowser.
Terence Heaford
2015-07-26 18:26:14 UTC
Permalink
Here is an example of HighCharts

When I drag an htm file onto the revBrowser or load the file using revBrowserNavigate gBrowserId, "file://" & gFile it works

When I put the html below into a LC field and try

put revBrowserExecuteScript(gBrowserId, the text of field "JavaScript”)

it fails.

Not sure why or even if it should work.


All the best


Terry

<!DOCTYPE HTML>
<html>
<head>
<meta http-equiv="Content-Type" content="text/html; charset=utf-8">
<title>BarChartTitle</title>

<script type="text/javascript" src="http://ajax.googleapis.com/ajax/libs/jquery/1.8.2/jquery.min.js"></script>
<style type="text/css">
${demo.css}
</style>
<script type="text/javascript">
$(function () {
$('#container').highcharts({
chart: {
type: 'column'
},
title: {
text: 'Column chart with negative values'
},
xAxis: {
categories: ['Apples', 'Oranges', 'Pears', 'Grapes', 'Bananas']
},
credits: {
enabled: false
},
series: [{
name: 'John',
data: [5, 3, 4, 7, 2]
}, {
name: 'Jane',
data: [2, -2, -3, 2, 1]
}, {
name: 'Joe',
data: [3, 4, 4, -2, 5]
}]
});
});
</script>
</head>
<body>
<script src="js/highcharts.js"></script>
<script src="js/modules/exporting.js"></script>

<div id="container" style="min-width: 310px; height: 400px; margin: 0 auto"></div>

</body>
</html>
Post by Kay C Lan
Post by Terence Heaford
I thought put revBrowserSet gBrowserID,”htmlText”,theContentsOfgFile might
work, but it doesn’t.
Well it works perfectly for me so I can't figure out why it's not working
for you. As far as I know as long as 'theContentsOfgFile' is valid html
content then it should display fine in revBrowser.
_______________________________________________
use-livecode mailing list
http://lists.runrev.com/mailman/listinfo/use-livecode
paolo mazza
2015-07-28 10:29:41 UTC
Permalink
Hi all,
afaik you can not use revBrowserCef because the close revBrowser
command does not work.
This bug has been confirmed some months ago, but it has not been fixed
yet. See..
http://quality.runrev.com/show_bug.cgi?id=13831
All the best
Paolo
Post by Terence Heaford
I am experimenting using a browser to display charts using highcharts from highcharts.com and have got the example charts working in a browser.
I am working with LC 6.7.6 on iMac with Yosemite.
--------------
I have this script to setup the browser
global gBrowserID
on mouseUp
lock screen
set the visible of grc "browserOutline" to false
--put revBrowserOpenCef(the windowId of this stack, "") into gBrowserID
put revBrowserOpen(the windowId of this stack, "") into gBrowserID
revBrowserSet gBrowserID, "rect", the rect of graphic "browserOutline"
revBrowserSet gBrowserID, "offline", true
revBrowserSet gBrowserID, "scrollbars", false
revBrowserSet gBrowserID, "showBorder", true
unlock screen
end mouseUp
I have noticed that with revBrowserCef I cannot disable scrollbars and show border does not work for me but with revBrowserOpen they both work?
Perhaps I am doing something wrong or is revBrowserCef a work in progress?
———————
At the moment it appears that I will have to create my own charts in LiveCode export them as index.htm then reload them into the browser.
Is there a way to create the chart in LiveCode then pass it straight to the browser.
put the uScript of me into tScript
revBrowserSet gBrowserID, "htmltext", tScript
revBrowserRefresh gBrowserID
———————
Is there any better documentation on the use of the revBrowser commands or is it all to be trial and error?
Thanks
Terry
_______________________________________________
use-livecode mailing list
http://lists.runrev.com/mailman/listinfo/use-livecode
EED-wp Email
2015-07-28 15:08:16 UTC
Permalink
I wonder about this. I had an issue with closing revbrowsercef. I used it to dosplay a youtube video and some straight html. It works fine in recent versions of lc. Be aware tho, that using it will add about 65mb to the app (if my memory serves).
Bill

William Prothero
http://ed.earthednet.org
Post by paolo mazza
Hi all,
afaik you can not use revBrowserCef because the close revBrowser
command does not work.
This bug has been confirmed some months ago, but it has not been fixed
yet. See..
http://quality.runrev.com/show_bug.cgi?id=13831
All the best
Paolo
Post by Terence Heaford
I am experimenting using a browser to display charts using highcharts from highcharts.com and have got the example charts working in a browser.
I am working with LC 6.7.6 on iMac with Yosemite.
--------------
I have this script to setup the browser
global gBrowserID
on mouseUp
lock screen
set the visible of grc "browserOutline" to false
--put revBrowserOpenCef(the windowId of this stack, "") into gBrowserID
put revBrowserOpen(the windowId of this stack, "") into gBrowserID
revBrowserSet gBrowserID, "rect", the rect of graphic "browserOutline"
revBrowserSet gBrowserID, "offline", true
revBrowserSet gBrowserID, "scrollbars", false
revBrowserSet gBrowserID, "showBorder", true
unlock screen
end mouseUp
I have noticed that with revBrowserCef I cannot disable scrollbars and show border does not work for me but with revBrowserOpen they both work?
Perhaps I am doing something wrong or is revBrowserCef a work in progress?
———————
At the moment it appears that I will have to create my own charts in LiveCode export them as index.htm then reload them into the browser.
Is there a way to create the chart in LiveCode then pass it straight to the browser.
put the uScript of me into tScript
revBrowserSet gBrowserID, "htmltext", tScript
revBrowserRefresh gBrowserID
———————
Is there any better documentation on the use of the revBrowser commands or is it all to be trial and error?
Thanks
Terry
_______________________________________________
use-livecode mailing list
http://lists.runrev.com/mailman/listinfo/use-livecode
_______________________________________________
use-livecode mailing list
http://lists.runrev.com/mailman/listinfo/use-livecode
Loading...