Omnimaga: The Coders Of Tomorrow
Welcome, Guest. Please login or register.
 
Omnimaga: The Coders Of Tomorrow
18 May, 2013, 18:47:30 *
Welcome, Guest. Please login or register.

Login with username, password and session length
 
   home   news downloads projects tutorials misc forums rules new posts irc about Login Register  
+-OmnomIRC

You must Register, be logged in and have at least 40 posts to use this shout-box! If it still doesn't show up afterward, it might be that OmnomIRC is disabled for your group or under maintenance.

Note: You can also use an IRC client like mIRC, X-Chat or Mibbit to connect to an EFnet server and #omnimaga.

Pages: 1 [2] 3 4 ... 10   Go Down
  Print  
Author Topic: Lua Q&A -  (Read 7914 times) Bookmark and Share
0 Members and 2 Guests are viewing this topic.
Jim Bauwens
Lua! Nspire! Linux!
Editor
LV10 31337 u53r (Next: 2000)
*
Offline Offline

Gender: Male
Last Login: Today at 15:02:18
Date Registered: 28 February, 2011, 22:32:12
Location: Belgium
Posts: 1733


Total Post Ratings: +180

View Profile WWW
« Reply #15 on: 01 July, 2011, 22:03:20 »
0

There is a D2Editor, but it really is buggy, so you can't use it.

You can make something like this:

1
2
3
4
5
6
7
8
9
10
11
12

msg = ""

function on.paint(gc)
    gc:drawString(msg,10,10,"top")
end

function on.charIn(ch)
    msg = msg .. ch
    platform.window:invalidate()
end

Of course you will have to do some changes to make it usable, but it should show the basics.
Logged

ExtendeD
Coder Of Tomorrow
LV8 Addict (Next: 1000)
*
Offline Offline

Gender: Male
Last Login: Yesterday at 08:07:39
Date Registered: 02 January, 2010, 13:03:41
Location: France
Posts: 765

Total Post Ratings: +151

View Profile
« Reply #16 on: 02 July, 2011, 10:30:15 »
0

Try to use the class D2Editor.

[edit] sorry I missed jimbauwens's post.

jimbauwens, what's wrong with it? The scrolling?
« Last Edit: 02 July, 2011, 10:31:54 by ExtendeD » Logged

ndlessly - Progress and insights on Ndless
Ndless / Hackspire - Third-party TI-Nspire development
Levak
LV8 Addict (Next: 1000)
********
Online Online

Gender: Male
Last Login: Today at 18:35:54
Date Registered: 04 April, 2010, 23:42:49
Location: France
Posts: 832


Total Post Ratings: +148

View Profile WWW
« Reply #17 on: 02 July, 2011, 16:35:14 »
0

Try to use the class D2Editor.

[edit] sorry I missed jimbauwens's post.

jimbauwens, what's wrong with it? The scrolling?

Because we can't edit it on ClickPad ? (or even I'm stupid)
« Last Edit: 02 July, 2011, 16:35:27 by Levak » Logged

Human always wants to survive and that's why he will fall one day.
My website - TI-Planet - iNspired-Lua
pianoman
LV6 Super Member (Next: 500)
******
Offline Offline

Gender: Male
Last Login: 20 October, 2011, 04:23:28
Date Registered: 21 May, 2011, 19:13:57
Location: You can know that my current velocity is about 0 m/s.
Posts: 427


Topic starter
Total Post Ratings: +24

View Profile
« Reply #18 on: 02 July, 2011, 16:56:10 »
0

Ok, thank you.
Logged

ExtendeD
Coder Of Tomorrow
LV8 Addict (Next: 1000)
*
Offline Offline

Gender: Male
Last Login: Yesterday at 08:07:39
Date Registered: 02 January, 2010, 13:03:41
Location: France
Posts: 765

Total Post Ratings: +151

View Profile
« Reply #19 on: 02 July, 2011, 20:06:20 »
0

Levak: you mean you can't set the focus on it? A quick try with a single D2Editor on the screen gets the focus on nspire_emu.
Logged

ndlessly - Progress and insights on Ndless
Ndless / Hackspire - Third-party TI-Nspire development
Levak
LV8 Addict (Next: 1000)
********
Online Online

Gender: Male
Last Login: Today at 18:35:54
Date Registered: 04 April, 2010, 23:42:49
Location: France
Posts: 832


Total Post Ratings: +148

View Profile WWW
« Reply #20 on: 02 July, 2011, 21:30:20 »
0

Levak: you mean you can't set the focus on it? A quick try with a single D2Editor on the screen gets the focus on nspire_emu.
I can't. setFocus is a nil value :


1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
function on.create()
editor = D2Editor.newRichText()
editor:move(50,50)
editor:resize(200,100)
end
 
function on.charIn(char)
currentText = editor:getText()
editor:setText(currentText .. char) --Add char to the editor
end
 
function on.enterKey()
on.charIn(string.char(10)) --Add a new line
end

function on.tabKey()
if focus then
focus = false
D2Editor.setFocus(false)
else
focus = true
D2Editor.setFocus(false)
end
end

But yes, if I type some keys, it enters the text, OK.

I have thus found another reason to not use the D2Editor : we can't delete it.
Logged

Human always wants to survive and that's why he will fall one day.
My website - TI-Planet - iNspired-Lua
Jim Bauwens
Lua! Nspire! Linux!
Editor
LV10 31337 u53r (Next: 2000)
*
Offline Offline

Gender: Male
Last Login: Today at 15:02:18
Date Registered: 28 February, 2011, 22:32:12
Location: Belgium
Posts: 1733


Total Post Ratings: +180

View Profile WWW
« Reply #21 on: 02 July, 2011, 21:54:43 »
0

The D2Editor also sucks events for some reason, and my programs start acting really weird after a while. I really would like to use it, but its so bugged that I can't. It just get to anoying after a time.
Logged

pianoman
LV6 Super Member (Next: 500)
******
Offline Offline

Gender: Male
Last Login: 20 October, 2011, 04:23:28
Date Registered: 21 May, 2011, 19:13:57
Location: You can know that my current velocity is about 0 m/s.
Posts: 427


Topic starter
Total Post Ratings: +24

View Profile
« Reply #22 on: 10 July, 2011, 01:14:18 »
0

Is there a way to resize images in the program?
Logged

Levak
LV8 Addict (Next: 1000)
********
Online Online

Gender: Male
Last Login: Today at 18:35:54
Date Registered: 04 April, 2010, 23:42:49
Location: France
Posts: 832


Total Post Ratings: +148

View Profile WWW
« Reply #23 on: 10 July, 2011, 01:20:22 »
0

Yes :
http://wiki.inspired-lua.org/image.copy
Logged

Human always wants to survive and that's why he will fall one day.
My website - TI-Planet - iNspired-Lua
pianoman
LV6 Super Member (Next: 500)
******
Offline Offline

Gender: Male
Last Login: 20 October, 2011, 04:23:28
Date Registered: 21 May, 2011, 19:13:57
Location: You can know that my current velocity is about 0 m/s.
Posts: 427


Topic starter
Total Post Ratings: +24

View Profile
« Reply #24 on: 10 July, 2011, 01:23:59 »
0

Thanks, Levak!
Logged

cypressx1
LV3 Member (Next: 100)
***
Offline Offline

Last Login: 29 April, 2013, 18:56:24
Date Registered: 26 March, 2011, 12:17:51
Posts: 45

Total Post Ratings: 0

View Profile
« Reply #25 on: 15 July, 2011, 15:16:46 »
0

........... function on.paint(gc) .......Text=editor:getText()  gc:drawString(Text,0,0) end   May this work
Logged
Jim Bauwens
Lua! Nspire! Linux!
Editor
LV10 31337 u53r (Next: 2000)
*
Offline Offline

Gender: Male
Last Login: Today at 15:02:18
Date Registered: 28 February, 2011, 22:32:12
Location: Belgium
Posts: 1733


Total Post Ratings: +180

View Profile WWW
« Reply #26 on: 15 July, 2011, 19:26:39 »
0

cypressx1, You can put Lua code in [ code] tag's for better readability Smiley

Your code is correct, but you must make sure that you have an editor created (D2editor), and that you sometimes invalidate your screen. Also, you should add "top" to your drawString, because now it will be a bit ofscreen:

1
gc:drawString(Text,0,0,"top")
Logged

cypressx1
LV3 Member (Next: 100)
***
Offline Offline

Last Login: 29 April, 2013, 18:56:24
Date Registered: 26 March, 2011, 12:17:51
Posts: 45

Total Post Ratings: 0

View Profile
« Reply #27 on: 18 July, 2011, 14:22:08 »
0

Thanks!
Logged
Munchor
LV13 Extreme Addict (Next: 9001)
*************
Offline Offline

Gender: Male
Last Login: 07 May, 2013, 22:49:01
Date Registered: 16 October, 2010, 15:39:13
Location: Position
Posts: 6209


Total Post Ratings: +174

View Profile
« Reply #28 on: 24 July, 2011, 23:08:06 »
0

Has anybody achieved +- smoothscrolling?
Logged
t0xic_kitt3n
LV10 31337 u53r (Next: 2000)
**********
Offline Offline

Gender: Male
Last Login: 13 May, 2013, 01:56:35
Date Registered: 16 June, 2010, 20:46:00
Location: w,x,y,z
Posts: 1583


Total Post Ratings: +32

View Profile
« Reply #29 on: 25 July, 2011, 02:14:32 »
0

I know the Copter game had smooth scrolling but then again those graphics were simple.
Logged




██████  ██  ██  ███████           ████    ██    ██   ██ ███████
█ ██ █  ██  ██   ██   █          ██  ██  ████   ███ ███  ██   █
  ██    ██  ██   ██             ██   ██ ██  ██  ███████  ██    
  ██    ██  ██   ██  █         ██       ██  ██  ███████  ██  █
  ██    ██████   █████         ██       ██  ██  ██ █ ██  █████ 
  ██    ██  ██   ██  █         ██   ███ ██████  ██   ██  ██  █
  ██    ██  ██   ██             ██   ██ ██  ██  ██   ██  ██    
  ██    ██  ██   ██   █          ██  ██ ██  ██  ██   ██  ██   █
 ████   ██  ██  ███████           █████ ██  ██  ██   ██ ███████

Pages: 1 [2] 3 4 ... 10   Go Up
  Print  
 
Jump to:  

Powered by EzPortal
Powered by MySQL Powered by SMF 1.1.18 | SMF © 2013, Simple Machines Powered by PHP
Page created in 1.811 seconds with 31 queries.
Skin by DJ Omnimaga edited from SMF default theme with the help of tr1p1ea.
All programs, games and songs avaliable on this website are property of their respective owners.
Best viewed in Opera, Firefox, Chrome and Safari with a resolution of 1024x768 or above.