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

Web and WebWorks Development

Reply
New Developer
Posts: 3
Registered: ‎04-16-2011
My Device: none
My Carrier: student

WebWork -> javascript library?

Hi,

 

I am new in BB things. I am absolutely amazed by BB PlayBook so I am trying to make some APS in PC, using webworks. 

 

I have experiences with web developing (HTML,CSS,JavaScript,PHP) and desktop APS (C,C++ and my favorite C#)

 

I was trying example app "Sketch Pad". Successful zipped, compiled, packaged uploaded to virtual PlayBook and testes.

I have tried few changes, but I have idea to use one of javascript library (jquery)

 

1st. Problem was that there is no $(document).ready available, so i put my code to onload body .. It works

second problem is, some functions are not working, I've tried "draggable function" in jquery, in normal browser it works, but in PlayBook it don't work. 

 

So, my question is if exist any library which is compatible, or i should write these things like draggable, fadein, fadeout and so on myself?

 

Developer
Posts: 1,230
Registered: ‎03-20-2011
My Device: Playbook, Z10 LE, Dev Alpha B, 2x Dev Alpha C
My Carrier: 3, Orange, Vodafone

Re: WebWork -> javascript library?

I'll answer your question in a slightly backwards way

 

Your best choice for an uncompicated development scenario would be Sencha Touch. While I say it's uncomplicated, I use that word as politely as I can (Sencha is well tooled but is a distaster "outside the box")

 

Your second (first?) choice is the far more adaptable JQuery, your quick code inserts prove you use it (so do I)

 

Assuming your JQuery and JavaScript is correct everything will work fine

 

A simple test is to put an alert('boo'); directly after your ready function and see if it fires (I dount it)

 

The easiest test of some bug in he code is (usually) to move your ready function RIGHT to the top of code and insert few alerts so you know here the problem happens

 

Feel free to PM me with a proper email address if you like and I'll have a look to see what's going wrong

 

Hopefully you can sort it without my aid




Click the like button if you find my posts useful!
New Developer
Posts: 3
Registered: ‎04-16-2011
My Device: none
My Carrier: student

Re: WebWork -> javascript library?

[ Edited ]

Thank you for reply, because of it, I've tried it again. Clear new application. 

 

So, check if is document ready works, i dont know what was wrong before.

But "draggable" do not work. And i know why.

 

In apps, when I do not want to scroll aplication (that's what I've read) I shoud use "event.preventDefault();"

And when i add it, dragging in app (in virtual Playbook) stop working.

 

Here is my full code

 

 

 $(document).ready(function(){
 document.ontouchstart = function(event) { event.preventDefault();};
 document.ontouchmove = function(event) { event.preventDefault();};
 document.ontouchend = function(event) { event.preventDefault();};
     alert("Thanks for visiting!");
     $("#t").draggable();
 });

 

so, how can i solve both of it. No scrolling but working dragging?

 

If anyone knows good material to study please write me, i was searching forum and google, i found something, but nothing ideal.

Highlighted
Developer
Posts: 1,230
Registered: ‎03-20-2011
My Device: Playbook, Z10 LE, Dev Alpha B, 2x Dev Alpha C
My Carrier: 3, Orange, Vodafone

Re: WebWork -> javascript library?

Now I see you code I can tell you exaclt what's wrong

 

The touch event and the mouse events are causing your problems

 

You should be VERY careful in using a touch event while we are in beta

 

Simply remove the touches from your app and it should work fine

 

I would suggest that you listen to the BB webcasts for this development process - number 3 is very good (you'll find them in devblog

 

To elucidate touch fires before mouse is the normal order

 

To overcome this you need to write a touch ebent handler - the Sketchpad demo gets you well  on the way

 

You are now at the point where you cancontol the device completely from code

 

I'd give you my code that remobes these issues hapily but my code is spefically riien for a div in my app

 

If y9ou need some more pointers PM me




Click the like button if you find my posts useful!