Author Topic: Codes for touchpad, arrow keys, select button, other keys?  (Read 10430 times)

0 Members and 1 Guest are viewing this topic.

Offline Spyro543

  • LV9 Veteran (Next: 1337)
  • *********
  • Posts: 1189
  • Rating: +74/-3
    • View Profile
Codes for touchpad, arrow keys, select button, other keys?
« on: June 05, 2011, 03:46:38 pm »
I know this code is correct for the up arrow
Code: (up arrow) [Select]
function on.arrowUp
       --what to do goes here
end

Do I just replace the Up in on.arrowUp with whatever direction? and also: Does anyone here know what the Lua codes for detecting what happens with the touchpad, select button, and other keys?

Offline apcalc

  • The Game
  • CoT Emeritus
  • LV10 31337 u53r (Next: 2000)
  • *
  • Posts: 1393
  • Rating: +120/-2
  • VGhlIEdhbWUh (Base 64 :))
    • View Profile
Re: Codes for touchpad, arrow keys, select button, other keys?
« Reply #1 on: June 05, 2011, 06:31:24 pm »
Here is a list of all of the keys that can be "controlled" with Lua (notice on.charLn for non-arrow key characters)

Also, I think you might need a "()" after function.arrowUp (making it read "function.arrowUp()")


Offline Levak

  • LV9 Veteran (Next: 1337)
  • *********
  • Posts: 1002
  • Rating: +208/-39
    • View Profile
    • My website
I do not get mad at people, I just want them to learn the way I learnt.
My website - TI-Planet - iNspired-Lua

Offline Spyro543

  • LV9 Veteran (Next: 1337)
  • *********
  • Posts: 1189
  • Rating: +74/-3
    • View Profile
Re: Codes for touchpad, arrow keys, select button, other keys?
« Reply #3 on: June 05, 2011, 06:46:18 pm »
Here is a list of all of the keys that can be "controlled" with Lua

Where is the list?

Offline Levak

  • LV9 Veteran (Next: 1337)
  • *********
  • Posts: 1002
  • Rating: +208/-39
    • View Profile
    • My website
Re: Codes for touchpad, arrow keys, select button, other keys?
« Reply #4 on: June 05, 2011, 06:48:02 pm »
Here is a list of all of the keys that can be "controlled" with Lua

Where is the list?

All the "basic questions" like this one are answered when looking at http://www.inspired-lua.org/  and http://wiki.inspired-lua.org/
I do not get mad at people, I just want them to learn the way I learnt.
My website - TI-Planet - iNspired-Lua

Offline Spyro543

  • LV9 Veteran (Next: 1337)
  • *********
  • Posts: 1189
  • Rating: +74/-3
    • View Profile
Re: Codes for touchpad, arrow keys, select button, other keys?
« Reply #5 on: June 05, 2011, 06:50:19 pm »
This: http://wiki.inspired-lua.org/Category:Events

So on.down(), on.up(), on.left(), and on.right() are for touchpad motions. Right?

Offline Levak

  • LV9 Veteran (Next: 1337)
  • *********
  • Posts: 1002
  • Rating: +208/-39
    • View Profile
    • My website
Re: Codes for touchpad, arrow keys, select button, other keys?
« Reply #6 on: June 05, 2011, 06:51:37 pm »
This: http://wiki.inspired-lua.org/Category:Events

So on.down(), on.up(), on.left(), and on.right() are for touchpad motions. Right?

wrong.
EDIT : oops sorry, wrong one. Yeah, so "probably". You can test.
EDIT2 : hum, there is neither "on.right()" nor "on.left", so I think it is for something else.


There is no specification between TouchPad and ClickPad, since the TouchPad invokes a mouse.
« Last Edit: June 05, 2011, 06:54:31 pm by Levak »
I do not get mad at people, I just want them to learn the way I learnt.
My website - TI-Planet - iNspired-Lua

Offline Spyro543

  • LV9 Veteran (Next: 1337)
  • *********
  • Posts: 1189
  • Rating: +74/-3
    • View Profile
Re: Codes for touchpad, arrow keys, select button, other keys?
« Reply #7 on: June 05, 2011, 06:54:26 pm »
So it would go like this:

The mouse is already controlled by the touchpad, no need to program this.
on.mouseDown is when the mouse is clicked, it reports that it was clicked and at what coordinates it was clicked at. What is the syntax for on.mouseDown?

Offline Levak

  • LV9 Veteran (Next: 1337)
  • *********
  • Posts: 1002
  • Rating: +208/-39
    • View Profile
    • My website
Re: Codes for touchpad, arrow keys, select button, other keys?
« Reply #8 on: June 05, 2011, 06:56:34 pm »
So it would go like this:

The mouse is already controlled by the touchpad, no need to program this.
on.mouseDown is when the mouse is clicked, it reports that it was clicked and at what coordinates it was clicked at. What is the syntax for on.mouseDown?

This question is part of the "Starting in Lua" tutoring part. I guess you should look at it before beginning a project (we haven't finished the EN part ... sorry)


To answer quickly : on.mouseDown(x, y)
I do not get mad at people, I just want them to learn the way I learnt.
My website - TI-Planet - iNspired-Lua

Offline Spyro543

  • LV9 Veteran (Next: 1337)
  • *********
  • Posts: 1189
  • Rating: +74/-3
    • View Profile
Re: Codes for touchpad, arrow keys, select button, other keys?
« Reply #9 on: June 05, 2011, 07:00:32 pm »
So on.mouseDown(n, m) will save the X coordinate to var n, Y coordinate to var m?

Or does it have to store to vars x and y?

Offline Levak

  • LV9 Veteran (Next: 1337)
  • *********
  • Posts: 1002
  • Rating: +208/-39
    • View Profile
    • My website
Re: Codes for touchpad, arrow keys, select button, other keys?
« Reply #10 on: June 05, 2011, 07:02:03 pm »
So on.mouseDown(n, m) will save the X coordinate to var n, Y coordinate to var m?

Or does it have to store to vars x and y?

Again ... you work in an evenmential environnement. Those questions are answered, please take the time to read everything.
http://www.inspired-lua.org/category/tutorials/starting-in-lua/
I do not get mad at people, I just want them to learn the way I learnt.
My website - TI-Planet - iNspired-Lua

Offline apcalc

  • The Game
  • CoT Emeritus
  • LV10 31337 u53r (Next: 2000)
  • *
  • Posts: 1393
  • Rating: +120/-2
  • VGhlIEdhbWUh (Base 64 :))
    • View Profile
Re: Codes for touchpad, arrow keys, select button, other keys?
« Reply #11 on: June 05, 2011, 07:02:07 pm »
Sorry, I forgot to post the link in my first post. :(


Offline Spyro543

  • LV9 Veteran (Next: 1337)
  • *********
  • Posts: 1189
  • Rating: +74/-3
    • View Profile
Re: Codes for touchpad, arrow keys, select button, other keys?
« Reply #12 on: June 05, 2011, 07:04:58 pm »
So on.mouseDown(n, m) will save the X coordinate to var n, Y coordinate to var m?

Or does it have to store to vars x and y?

Again ... you work in an evenmential environnement. Those questions are answered, please take the time to read everything.
http://www.inspired-lua.org/category/tutorials/starting-in-lua/

May I have a simple and direct answer please? I've read tutorials, but only 2 in english.

Offline Levak

  • LV9 Veteran (Next: 1337)
  • *********
  • Posts: 1002
  • Rating: +208/-39
    • View Profile
    • My website
Re: Codes for touchpad, arrow keys, select button, other keys?
« Reply #13 on: June 06, 2011, 04:10:34 am »
Code: [Select]
function on.paint(gc)
 if mX and mY then
  gc:setPen("sansserif", "r", 18)
  gc:drawString("You pressed at ("..mx..", "..my..") coordinates", 0, 0, "top")
 end
end

function on.mouseDown(x, y)
 mX, mY = x, y
end
I do not get mad at people, I just want them to learn the way I learnt.
My website - TI-Planet - iNspired-Lua

Offline Jim Bauwens

  • Lua! Nspire! Linux!
  • Editor
  • LV10 31337 u53r (Next: 2000)
  • **********
  • Posts: 1881
  • Rating: +206/-7
  • Linux!
    • View Profile
    • nothing...
Re: Codes for touchpad, arrow keys, select button, other keys?
« Reply #14 on: June 06, 2011, 04:28:27 am »
Levak, you forgot to invalidate the screen when mouseDown is triggered.

Code: (Lua) [Select]
function on.mouseDown(x, y)
 mX, mY = x, y
 platform.window:invalidate()
end