D2Editor in Lua

119 views
Skip to first unread message

Dennis Donovan

unread,
Apr 9, 2012, 11:21:33 PM4/9/12
to TI-NSpire Google Group
Hi,

I've been learning Lua by creating a Quadratic Equation Solver using the quadratic formula.  I initially though that I would create a class that was an input box and then take the character input and send it to math.eval() to get a numerical value for a, b and c.

I then found D2Editor and began using that, but the editor acts differently than the rest of the "gc" content (at least it seems so to me).  I thought I'd be able to overlay the text editor on my input box, then once the user clicked outside the input box region, I could remove the text editor and reveal the numerical value in the input box area that was below.  Then if the user clicked back into the input box region, a text editor populated with the current value converted to text would be overlay the region again.

Am I missing something or is there no way to remove the text editors from the page once they are there?  I have attached both a .tns and my Lua code (it's a bit messy, since there is still some test code commented out).  Thanks to Marc Garneau for the code bits regarding classes to get me going)

Also, when you are editing text, the on.char(), etc. routines don't seem to be called as outlined in the wiki at http://wiki.inspired-lua.org/D2Editor.newRichText

Any help with the API for the text editor would be greatly appreciated.

Thanks.

Dennis Donovan
QuadraticFormula.lua
QuadForm.tns

Steve Arnold

unread,
Apr 9, 2012, 11:28:59 PM4/9/12
to tins...@googlegroups.com
Sorry Dennis - I have spent many fruitless hours on that 2D Editor and cannot get it to work the way I want. I think it is actually being dropped from support - more trouble than it was worth. A shame, but…

My online lessons include step by step how to use on.charIn and accept inputted text. Feel free to have a look and take what you want:


Lesson 4 is what you want…

Steve


--
To post to this group, send email to tins...@googlegroups.com
To unsubscribe send email to tinspire+u...@googlegroups.com
For more options, visit this group at
http://groups.google.com.au/group/tinspire?hl=en-GB?hl=en-GB
The tns documents shared by group members are archived at
https://sites.google.com/site/tinspiregroup/classroom-news/welcome-abouttime
<QuadraticFormula.lua><QuadForm.tns>

With best wishes,
Steve
_________________
Dr Stephen Arnold
Educational Technology Consultant
Compass Learning Technologies

T3 Fellow, Teachers Teaching with Technology Australia

Office: +61-2-4237-6314
Mobile: +61-4-0175-3834
US cell: +1 (508) 869 4350
UK cell: +44 79 2425 1196
Web: http://compasstech.com.au
_________________

Levak Borok

unread,
Apr 10, 2012, 1:20:21 AM4/10/12
to tins...@googlegroups.com
Hi,

The 2D Editor is not recommended to use in many cases in <3.1 and it has been requested to be enhanced for the next release.
Just wait & see.

On the other hand, it is interesting to make your own 2D Editor with classes and standard events like so http://wiki.inspired-lua.org/on.charIn 



2012/4/10 Steve Arnold <steve.co...@gmail.com>

Dennis Donovan

unread,
Apr 10, 2012, 9:16:21 AM4/10/12
to tins...@googlegroups.com
Thanks Steve & Levak.  My first inclination was indeed to create an InputBox using classes and on.charIn, then when I saw the Editor, I gave it a shot.  It's a shame that it doesn't interface as you would expect, I do like what I've done with it, but the fact that it can't be removed and behaves weirdly on resize are two things that I would like to get around.

I'll go back and try to finish my first design, then see what happens to the Editor in 3.2.

Dennis Donovan


From: Levak Borok <lev...@gmail.com>
To: tins...@googlegroups.com
Sent: Tuesday, April 10, 2012 1:20 AM
Subject: Re: [tinspire] D2Editor in Lua

jwal...@live.com

unread,
Apr 10, 2012, 9:25:24 AM4/10/12
to tinspire
I have written a GUI library that has forms(windows), textboxes,
checkboxes, radiobuttons, picture boxes, lables, dialog boxes and an
early beta of a tabcontrol. The tabcontrol works prety well tho
go here: http://www.ticalc.org/archives/files/fileinfo/444/44428.html

On Apr 9, 10:21 pm, Dennis Donovan <ddha...@yahoo.com> wrote:
> Hi,
>
> I've been learning Lua by creating a Quadratic Equation Solver using the quadratic formula.  I initially though that I would create a class that was an input box and then take the character input and send it to math.eval() to get a numerical value for a, b and c.
>
> I then found D2Editor and began using that, but the editor acts differently than the rest of the "gc" content (at least it seems so to me).  I thought I'd be able to overlay the text editor on my input box, then once the user clicked outside the input box region, I could remove the text editor and reveal the numerical value in the input box area that was below.  Then if the user clicked back into the input box region, a text editor populated with the current value converted to text would be overlay the region again.
>
> Am I missing something or is there no way to remove the text editors from the page once they are there?  I have attached both a .tns and my Lua code (it's a bit messy, since there is still some test code commented out).  Thanks to Marc Garneau for the code bits regarding classes to get me going)
>
> Also, when you are editing text, the on.char(), etc. routines don't seem to be called as outlined in the wiki athttp://wiki.inspired-lua.org/D2Editor.newRichText
>
> Any help with the API for the text editor would be greatly appreciated.
>
> Thanks.
>
> Dennis Donovan
>
>  QuadraticFormula.lua
> 11KViewDownload
>
>  QuadForm.tns
> 6KViewDownload

Adriweb

unread,
Apr 11, 2012, 6:14:17 PM4/11/12
to tins...@googlegroups.com, Dennis Donovan
There are also other GUI libs available for use from this nice Lua program, that has a GUI like a native one : 

EEPro-Nspire also has a deeply-worked GUI interface as you can see on some of the screenshots here: 

Sean Bird

unread,
Apr 11, 2012, 6:25:18 PM4/11/12
to tins...@googlegroups.com
That EEPro is looking quite nice. Myself and some students will enjoy giving it a spin when it is ready.


--

Adriweb

unread,
Apr 11, 2012, 6:27:24 PM4/11/12
to tins...@googlegroups.com
Thanks :-)

We will release the biggest part quite soon since we want to have it ready before June.


On Thursday, April 12, 2012 12:25:18 AM UTC+2, Bird wrote:
That EEPro is looking quite nice. Myself and some students will enjoy giving it a spin when it is ready.
On Wed, Apr 11, 2012 at 6:14 PM, Adriweb <bertran...@gmail.com> wrote:
There are also other GUI libs available for use from this nice Lua program, that has a GUI like a native one : 

EEPro-Nspire also has a deeply-worked GUI interface as you can see on some of the screenshots here: 

--
To post to this group, send email to tins...@googlegroups.com
To unsubscribe send email to tinspire+unsubscribe@googlegroups.com

Jim Fullerenex

unread,
Apr 11, 2012, 8:08:14 PM4/11/12
to tins...@googlegroups.com
Thanks Adrien!

I'm looking forward to the release. ;)

Best,

Jim
To unsubscribe send email to tinspire+u...@googlegroups.com
Reply all
Reply to author
Forward
0 new messages