webOS Nation Forums >  webOS apps and software >  webOS development > Drag and drop sample code?
Drag and drop sample code?

  Reply
 
LinkBack Thread Tools Display Modes
Old 02/27/2010, 02:36 PM   #1 (permalink)
Member
 
Join Date: Jul 2009
Posts: 31
Likes Received: 0
Thanks: 14
Thanked 2 Times in 2 Posts
Default Drag and drop sample code?

Could anyone give me some sample code for the Mojo.drag API? All i need is a div that you can drag around the scene. If anyone have used this API in their apps could you help get me started?

Thanks,
Bryce14
Bryce14 is offline   Reply With Quote
Old 02/27/2010, 05:30 PM   #2 (permalink)
Member
 
djpushplay's Avatar
 
Join Date: Aug 2009
Location: Los Angeles
Posts: 159
Likes Received: 0
Thanks: 21
Thanked 11 Times in 11 Posts
Default

Quote:
Originally Posted by Bryce14 View Post
Could anyone give me some sample code for the Mojo.drag API? All i need is a div that you can drag around the scene. If anyone have used this API in their apps could you help get me started?

Thanks,
Bryce14
If you mean you want to drag something on the screen, you can use:

Code:
Element.observe(this.trackingArea, Mojo.Event.dragStart, this.dragStartHandler);

ScrollerAssistant.prototype.dragScreen = function(event) {
	this.rememberX = Event.pointerX(event.down);
	Element.observe(this.trackingArea, Mojo.Event.dragging, this.draggingHandler);
	Element.observe(this.trackingArea, Mojo.Event.dragEnd, this.dragEndHandler);
	Event.stop(event);
}

ScrollerAssistant.prototype.draggingScreen = function(event) {
	var nowX = Event.pointerX(event.move);
    Event.stop(event);
}

ScrollerAssistant.prototype.dragEndScreen = function(event) {
	Element.stopObserving(this.trackingArea, Mojo.Event.dragging, this.draggingHandler);
	Element.stopObserving(this.trackingArea, Mojo.Event.dragEnd, this.dragEndHandler);
	Event.stop(event);
}
Or are you talking about drag/dropping a line from a selectlist to re-order?
__________________
mobigamedepot.com
djpushplay is offline   Reply With Quote
Thanked By: Bryce14
Reply

 

Tags
api, app, div, drag, drag and drop

Thread Tools
Display Modes



 


Content Relevant URLs by vBSEO 3.6.0