Touchscreen scrolling

Deploying to Windows? Utilizing VB Script execution? This is the place to ask Windows-specific questions.

Moderators: FourthWorld, heatherlaine, Klaus, kevinmiller, robinmiller

Post Reply
cenglish
Posts: 34
Joined: Wed May 11, 2011 6:44 pm

Touchscreen scrolling

Post by cenglish » Wed Nov 07, 2012 10:58 pm

I am in the process of switching over an iOS app to desktop, both mac and windows. I have everything working fine, but I am now wanting to put the app on a touchscreen monitor (windows) but I can't seem to figure out how to capture an event for when the user touches the screen. I thought my rawkeydown script would work for it since I needed it for the desktop scrolling, but it just jumps. Any ideas?

Mark
Livecode Opensource Backer
Livecode Opensource Backer
Posts: 5150
Joined: Thu Feb 23, 2006 9:24 pm
Contact:

Re: Touchscreen scrolling

Post by Mark » Thu Nov 08, 2012 1:58 am

Hi,

Most touch screen work like a trackpad. They just send mouse messages, such as mouseUp, mouseDown, mouseStillDown, mouseMove etc. Some of them can only invoke mouseDown and mouseUp messages. First look at which messages are sent, then write a script similar to e.g.

Code: Select all

local lPreviousLoc

on mouseDown
  put the mouseLoc lPreviousLoc
end mouseDown

on mouseMove
  if the mouse is down then
    put the mouseLoc into myNewLoc
    if item 1 of myNewLoc > item 1 of lPreviousLoc then
      set the hScroll of me to the hScroll of me + 10
    else if item 1 of myNewLoc < item 1 of lPreviousLoc then
      set the hScroll of me to the hScroll of me - 10
    end if
    if item 2 of myNewLoc > item 2 of lPreviousLoc then
      set the vScroll of me to the vScroll of me + 10
    else if item 2 of myNewLoc < item 2 lPreviousLoc then
      set the vScroll of me to the vScroll of me - 10
    end if
    put myNewLoc into lPreviousLoc
  end if
end mouseMove
This could be a field script. Note that this is only an example. I'm not sure what will work for you. Maybe you don't need to check that the mouse is down, maybe you can't check that the mouse is down. It all depends on the device you use.

Kind regards,

Mark
The biggest LiveCode group on Facebook: https://www.facebook.com/groups/livecode.developers
The book "Programming LiveCode for the Real Beginner"! Get it here! http://tinyurl.com/book-livecode

Post Reply