Gestures w/ Mobile Module

All,

A customer asked me to attempt to provide functionality using certain gestures on an iPad. He would like to be able to swipe to navigate screens. Additionally, he would like to have an overview screen that “tile stacks” on top of each other like an Android when you go to close programs.

My question is this functionality possible with the mobile module yet? I know there were some issues with not having right click abilities and no click-drag functionality.

Thanks!
Mike
NeoMatrix Inc.

I discovered how to do this by experimentation and help from another post.

In a mouse pressed script on the window root container:

# Get the start coordinates and store in custom properties
x1 = event.getX()
y1 = event.getY()

event.source.x1 = x1
event.source.y1 = y1

In a mouse released script on same window root container:

def sizeAnim(windowOpen = event.source.windowPath,
windowClose = event.source.previousWindow):
import time
import system
x1 = event.source.x1
y1 = event.source.y1

x2 = event.getX()
y2 = event.getY()

if (x1 > x2 
and (x1 - x2) > 200 
and event.source.windowSeq <= event.source.maxWindow):
	system.nav.openWindow(event.source.nextWindow)
	windowClose = system.gui.getWindow(event.source.windowPath)
	windowOpen = system.gui.getWindow(event.source.nextWindow)
	windowOpen.setLocation(349, 0)
	windowClose.setLocation(0, 0)
	count = 0
	while count < 348:
		window = system.gui.getWindow("Mobile/Header")
		window.setLocation(0, -38)
		system.tag.write("Sts_HeaderExpand", 0) 
		for x in range(349, 0, -1):
			windowOpen.setLocation(x, 0)
			time.sleep(.001)
			count = count + 1	

if x2 > x1 and (x2 - x1) > 200 and event.source.windowSeq >= event.source.minWindow:
	system.nav.openWindow(event.source.previousWindow)
	windowClose = system.gui.getWindow(event.source.windowPath)
	windowOpen = system.gui.getWindow(event.source.previousWindow)
	windowOpen.setLocation(-349, 0)
	windowClose.setLocation(0, 0)
	count = 0
	while count < 348:
		window = system.gui.getWindow("Mobile/Header")
		window.setLocation(0, -38)
		system.tag.write("Sts_HeaderExpand", 0) 
		for x in range(-349, 0):
			windowOpen.setLocation(x, 0)
			time.sleep(.001)
			count = count + 1	


if (y2 > y1 and (y2 - y1) > 150 and (x1 - x2) < 200 
and (x2 - x1) < 200):
	system.nav.openWindow(event.source.nextComponent)
	windowClose = system.gui.getWindow(event.source.windowPath)
	windowOpen = system.gui.getWindow(event.source.nextComponent)
	windowOpen.setLocation(0, -450)
	windowClose.setLocation(0, 0)
	count = 0
	while count < 450:
		window = system.gui.getWindow("Mobile/Header")
		window.setLocation(0, -38)
		system.tag.write("Sts_HeaderExpand", 0) 
		for y in range(-450, 0):
			windowOpen.setLocation(0, y)
			time.sleep(.001)
			count = count + 1		 

system.util.invokeAsynchronous(sizeAnim)

I utilized the time.sleep function as well as the count to slide the window into frame.

Capture the start location on a mouse pressed, and on a mouse released, capture the final location. Based on the difference in location and setting a minimum “distance traveled” will open the next window and slide it in.

1 Like