Show Posts

This section allows you to view all posts made by this member. Note that you can only see posts made in areas you currently have access to.


Messages - Goran

Pages: 1 [2] 3
16
Lua / Re: documentation on ETK API?
« on: August 07, 2013, 04:03:29 pm »
Thanx adriweb,

FormulaPro is the exact script I am learning from. On the other hand, I see now in the mentioned demo additional nice widgets! (as I am currently at vacation without my development environment, peeking into demo will have to wait for few days).

Maybe for now only one question:

Is it meant that WScreen has at least one child widget? The reason for question is the following: originally I had a graphical editor that, after discovery of ETK, I have "embeded" into a WScreen.
On PC everything works as planned (Moving, flipping, rotating, editing, connecting of graphical elements).
When I downloaded the app to the handheld, everything worked ok except connecting two elements: I grab the first point, drag a line to the second point, but I cannot make connection on "release" action (mouseUp).

Then I looked to ETK code, and thought maybe the handling of mouseUp event would be correct if I had put the whole graphical editor into a child screen widget? Or I talk rubbish?

Regards,
Goran

17
Lua / documentation on ETK API?
« on: August 07, 2013, 09:58:22 am »
Hello,

Is there any API documentation for ETK?

I currently go through the code itself, I made a cetrain progress in using it, but anyway I have some doubts that can be removed in this way only after I go 100% through to grasp all the concepts.

Best regards,
Gooran

18
Lua / Re: Creating/formating an evaluated Math Box from Lua script?
« on: July 23, 2013, 02:58:56 pm »
One more detail:

Are by any chances known/do exist '\\1' formatting commands for font sizes (mixing of sizes within the same D2Editor?
Is this possible at all?

Regards,
Goran

19
Lua / Re: Creating/formating an evaluated Math Box from Lua script?
« on: July 23, 2013, 10:46:37 am »
Thanks adriweb, it finally clicked in!

So, I can put two (or any number of) '\\0el {...} Math Boxes into D2Editor,
fill the first one with a variable/function name and the right one with math.eval(Str)'ed expression,
separate them with any character like '=' (not just with a filled in '>' - the black right-pointing triangle),
and that's it!

All the time I was "locked down" to belief that I give to D2Editor a Math Box with an evaluated variable
name and that some mechanism will show me, if properly configured, also its evaluated value on the right side automatically.


On the formatting issue:

Thanks to Jim who sent me a link to '\\1' formating commands, I already use them.

Anyway, I've noticed the the following behavior:
the reference manual talks about '\\1 <command>...\\' pattern (note the ending backslashes).
My experience is that '\\1 <command>' is effecting the only the first word of '...', the ending '\\' is not used at all (so I see an extra backslash at the end of '...' text.
If I want to e.g. underline text

   'word1 word2 word3'

I have to put a formating command in front of each word, i.e.

   '\\1title word1 \\1title word2 \\1title word3'

(this can be automatized with using e.g.

   string.gsub("...","(%w+)","\\1title %1")

I did not try on the calculator, it's experience from using the PC software.
Did you have such experiences?

Thanks once more to both of you for the great (and quick!) support,
Goran

20
Lua / Re: Creating/formating an evaluated Math Box from Lua script?
« on: July 22, 2013, 04:00:29 pm »
Thanks Jim for the quick answer.

If I forget the formatting part, I still do not understand the sentence from the reference guide on 'a pair of "\0el {...}" separated by a filled in '>'"

Is it some pure statement how a manually created and evaluated Math Box input/output is internally stored as a string (for e.g. parsing purposes),
or can we programatically insert a Math Box into D2Editor (a calculated variable) that would show the result (output part) immediatelly?

Regards,
Goran

21
Lua / Creating/formating an evaluated Math Box from Lua script?
« on: July 22, 2013, 02:22:19 pm »
Hello,

I woud like to create Math Boxes from a Lua script, like:

    self.ed:setExpression('\\0el {v} ')

This works ok, but this shows input part only.
As variable 'v' is already evaluated, I would like to:
   a) show immediatelly the output part, too (i.e. the evaluated result)
   b) to format, i.e to set the attributes of such a Math Box, like it's possible manually when you add a Math Box in e.g. Notes application
       (like "Insert Symbol","Display Digits")

Lua Scripting API Reference says:

"\0el {...}" - Denotes a Math Box (Expression Box). Evaluated Math Box
expressions result in a pair of "\0el {...}" separated by a fi lled in '>'. See the
Guidebook for a list of valid math expressions for the Math Box.



So, can I give to self.ed:setExpression() method such
   'a pair of "\0el {...}" separated by a fi lled in '>'
string?
If yes, how does it look like exactly (example)?

Regarding the formating, the guide  further says:

'Rich text editors embed other formatting information in the text
string. This information may change in future releases, so using it is
not recommended. It is delimited by "\1 ...\".'

Where I can find more on the exact formating commands (the '...' part in "\1 ...\"?

22
Lua / Re: Ti-Nspire: Changing menu items dynamically?
« on: July 22, 2013, 01:49:21 pm »
Thanks Jim,

great, that helped!

I have few other questions (different TI-Nspire/Lua topics), but I'll rather open new topics, I think it's better for the community.

Best regards,
Goran

23
Lua / Ti-Nspire: Changing menu items dynamically?
« on: July 22, 2013, 08:40:07 am »
Hello,

Firstly, sorry if this question has been answered already (link please).

I want to change the menu content during lua script execution.
I found in "Lua Scripting API Reference Guide" the following sentence:

"Beginning with platform.apiLevel = '2.0', the names of the tool palette items
can be changed dynamically while the program is running."

but I am missing an example.

Any help would be appreciated.

Thanks,
Goran

24
Lua / Re: Problem with on.loseFocus() function
« on: October 01, 2012, 08:05:10 am »
Hello guys,

you gave me a nice "homework" to do now :)

I'll enjoy study it (which will take some time).

Thanks and best regards,
Goran

25
Lua / Re: Reuse of code/classes?
« on: October 01, 2012, 07:48:36 am »
Hello,

the main problem with copying/pasting a source code from a script to another script is its multiple existence;
the problem that bothers me here it's not that much of unnecessary extra storage occupation, but rather of the fact
that if I find a bug and fix it in a particular copy, I have to remember all the places and to do the same multiple times.
The same is true if I enhance the "common" code during work on some script.

I saw in the Lua API Reference Guide the warning regarding load()/loadstring() functions: I have understood it in a way
we cannot edit/debug such code in the software, we have to rely on it on "as-it-is" basis, but we can use it w/o problem (assumed it does not contain bugs).
Is this correct?

If we store the code to TI-Nspire variables as a string, can we save/load the variables themselves to a file on the handeld?
Actually, which file types except .tns can we save/load under v3.2?
(e.g. in the printed manual I saw a snapshot of Document Toolbox with a .csv file among handheld files)

(also, I saw some 8* and 9* and v2* file compatibility list for CX, but is this some backward compatibility that CX only reads in?)

Best regards,
Goran

26
Lua / Re: Problem with on.loseFocus() function
« on: October 01, 2012, 05:56:52 am »
@ Jim:

yes, that helped!

Actually, the utmost important thing here is to fully understand the bits and bolts of TI/Lua specific event mechanism,
(what/when/why triggers), which gives you then the real power in designing apps.

Where can one find an additional/complete documentation on that subject?

@ ElementCoder:

Also thanks for the great/prompt support!

Best regards,
Goran

27
Lua / Reuse of code/classes?
« on: October 01, 2012, 05:52:41 am »
Hello,

I would like to re-use my Lua classes (e.g. of vector algebra, special diagrams, etc.) that I often need in my calculations.

What is the "state-of-the-art" here: can I store the code to some module/library/file/whatever?

What about load()/loadstring() functions? Can they be used for this porpose?

Thanks and best regards,
Goran

28
Lua / Re: Problem with on.loseFocus() function
« on: September 30, 2012, 01:17:51 pm »
Note:

When copying/pasting the code, the i-th field table member in on loseFocus() function was interpreted as italics tag,
so in on.loseField() function it is originally written:

    field<bracket open> i <bracket close>  :storeVariable()

For sure must exist some better option to enter the code than directly copy/paste.


Regards,
Goran

29
Lua / Re: Problem with on.loseFocus() function
« on: September 30, 2012, 01:07:48 pm »
Hi,

the same happens on the handheld, too :(

Here is what I do:


InputField = class()   -- a class I use to enter input variables

function InputField:init(name,x,y,init_value)
    self.name = name
    self.x = x
    self.y = y
    self.editor = D2Editor.newRichText()
    self.editor:move(x+30,y)
    self.editor:resize(100,28)
    self.editor:setBorder(1)
    self.editor:setText(var.recall(name) or (init_value or 0))  -- initially store at construction time: init_value (if defined) or 0 (if not defined) or already stored variable value (if the page is re-entered)
    var.store(name,self.editor:getText())
end

...

function InputField:storeVariable()   -- called by clients like on.loseFocus() function 
    var.store(self.name,self.editor:getText())
end

...

function on.construction()  -- create "objects"
    ...   
    field = {}
   
    field[1] = InputField('er',2,4)
    field[2] = InputField('ev',2,34)   
    ...
end

function on.getFocus()
    field[1]:setFocus()
end

function on.loseFocus()
    for i = 1, #field do
        field:storeVariable()
    end
end


Is the order of entered code (I am a newbie in Lua generally) important, too (e.g. of class definitions, variable definitions, event handlers)?

Regards,
Goran

30
Lua / Re: Problem with on.loseFocus() function
« on: September 30, 2012, 12:26:57 pm »
Hello guys,

thanks for your quick answers.

This is my first TI/Lua script and I am developing it using the software (Windows).
I'll now install it at handheld and tell you the outcome.

Best regards,
Goran

Pages: 1 [2] 3