Welcome!

Welcome to the official BlackBerry Support Community Forums.

This is your resource to discuss support topics with your peers, and learn from each other.

inside custom component

Native Development

Reply
Regular Contributor
JohnQtQml
Posts: 55
Registered: ‎10-31-2012
My Device: Blackberry 10 Dev Alpha Simulator - VMware
My Carrier: (none)

How to get a html5 canvas bigger than 311 by 211 in Blackberry 10 Dev Alpha Simulator

I am trying to display graphs in html5 canvas in Blackberry 10 Dev Alpha Simulator running in VMWare, using C++ QT QML Blackberry 10 Cascades Beta 3 in a qml WebView. I was having issues making that happen, but I tried the html5 sample from: http://www.w3schools.com/html/tryit.asp?filename=tryhtml5_canvas_first, which is the following code...

<!DOCTYPE html><html><body><canvasid="myCanvas"width="200"height="100"style="border:1px solid #c3c3c3;">Your browser does not support the HTML5 canvas tag.</canvas><script>var c=document.getElementById("myCanvas");var ctx=c.getContext("2d");ctx.fillStyle="#FF0000";ctx.fillRect(0,0,150,75);</script></body></html>

and then after some testing that that red square only showed up if I kept the width no more than 311 and the height no more than 211. But I need to make my graphical content in the html5 canvas in my webview larger than that. Does anyone know any solutions to this problem?

 

I originally asked this question here -

<http://stackoverflow.com/questions/13144099/how-to-get-a-html5-canvas-bigger-than-311-by-211-in-blac...>

and it was recommended to me that I go to a forum like this:

Please use plain text.
Developer
peter9477
Posts: 6,473
Registered: ‎12-08-2010
My Device: PlayBook, Z10
My Carrier: none

Re: How to get a html5 canvas bigger than 311 by 211 in Blackberry 10 Dev Alpha Simulator

[ Edited ]

I haven't tried your sample, and don't have a specific answer, but I wonder if this is related to (or the same thing as) what I reported here: http://supportforums.blackberry.com/t5/Cascades-Development/WebView-HTML5-Canvas-support-in-Cascades...

 

That was a while ago... and prior to the 10.0.9 release.  More recently I've been using the canvas in a WebView without any particular problem (with a canvas size of 2000 by 400). I haven't gone back to re-check any of the things I tried earlier, even the robodesign web site samples which failed in the browser.  My guess is my own issues were fixed with 10.0.9.

 

Just noting it in case there's a connection.

 

(Edit: I should have stated in the first place that I'm using the Dev Alpha, not the simulator.)


Peter Hansen -- (BB10 and dev-related blog posts at http://peterhansen.ca.)
Author of White Noise and Battery Guru for BB10 and for PlayBook | Get more from your battery!
Please use plain text.
Developer
bcs925
Posts: 262
Registered: ‎07-13-2012
My Device: PlayBook, DA B, DA C, LE Z10 #102, Q10, Z30
My Carrier: T-Mobile

Re: How to get a html5 canvas bigger than 311 by 211 in Blackberry 10 Dev Alpha Simulator

I have some good news and some bad news...

 

Good news: Works fine on the Dev Alpha, resized it to whatever size I want for both the canvas and the red box so its not bad code/entirely broken.

 

Bad news: When I try to use the simulator I get the same error as you that it must be 311x211.  I guess this is kind of good news since at least you know you aren't crazy and/or wrong code :smileywink:

 

-Brian

---
Check out my BB10 Cascades Coding site: BBcascades.com & Cascades Blog: bbcascadescode.tumblr.com

My Built for BlackBerry app: The Dive Plan
Please use plain text.
Regular Contributor
JohnQtQml
Posts: 55
Registered: ‎10-31-2012
My Device: Blackberry 10 Dev Alpha Simulator - VMware
My Carrier: (none)

Re: How to get a html5 canvas bigger than 311 by 211 in Blackberry 10 Dev Alpha Simulator

I did some testing and discovered that it is actually the area of the canvas that has a limit, not the width and height - which is what I suspected based on my theory that it is a memory allocation problem

Please use plain text.
Regular Contributor
JohnQtQml
Posts: 55
Registered: ‎10-31-2012
My Device: Blackberry 10 Dev Alpha Simulator - VMware
My Carrier: (none)

Re: How to get a html5 canvas bigger than 311 by 211 in Blackberry 10 Dev Alpha Simulator

I suppose I could just test my html5 canvas code in another browser and not worry about it showing on the simulator and then later on make sure it works on a real Blackberry device - but I wonder if there is a better solution then that to see if I can make it work on the emulator.

Please use plain text.
Contributor
bdev222
Posts: 27
Registered: ‎02-11-2011
My Device: Not Specified

Re: How to get a html5 canvas bigger than 311 by 211 in Blackberry 10 Dev Alpha Simulator

 

 

I too can see a tiny canvas being drawn into (311x211) but full screen nothing shows on the simulator
.All my apps were rejected as showing a blank screen on a dev alpha so wondering how you fared, or found

some other option that allows larger canvases.

 

Please use plain text.