Omnimaga: The Coders Of Tomorrow
Welcome, Guest. Please login or register.
 
Omnimaga: The Coders Of Tomorrow
18 June, 2013, 23:57:55 *
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]   Go Down
  Print  
Author Topic: Toolpalette not working properly -  (Read 559 times) Bookmark and Share
0 Members and 1 Guest are viewing this topic.
Frog
LV2 Member (Next: 40)
**
Offline Offline

Last Login: 22 February, 2013, 01:51:11
Date Registered: 17 June, 2011, 16:35:35
Posts: 35

Topic starter
Total Post Ratings: 0

View Profile
« on: 28 April, 2012, 21:57:56 »
0

Hi everyone. It's been some time since I last did something in Lua for the TI-NSpire, but I recently made a script for a school project. It basically uses the default NSpire graph window to draw shapes (circles, hyperbola's, etc.) by parameters. It works great. However, the toolpalette doesn't show when clicking the menu-key, unless you have first opened the calculator using the shortcut. This only happens on the calculator, not in the TI simulator. Really strange behavior, isn't it? I have the following code in my on.create function:


1
2
3
4
5
6
7
8
9
menu = {
{"Add",
{"Circle", showForm},
{"Ellipse", showForm},
{"Hyperbola", showForm},
{"Parabola", showForm}
}
}
toolpalette.register(menu)

Am I doing something wrong, or is it just a bug in the OS software?

Thanks!
Logged
Loulou 54
LV4 Regular (Next: 200)
****
Offline Offline

Gender: Male
Last Login: Yesterday at 19:43:29
Date Registered: 22 July, 2011, 21:19:29
Location: Meurthe-et-Moselle FRANCE
Posts: 153


Total Post Ratings: +34

View Profile WWW
« Reply #1 on: 28 April, 2012, 23:58:36 »
0

Try putting the code out of any function, at the end of your code for example.
I think toolpalette is defined before the execution of any event, so, as you define it only in the on.create, toolpalette is first defined as "none". And then you define it in the on.create.

Yes toolpalette's behaviour is sometimes weird.
In my translator, the user can change the language, but the menu isn't modified. You have to switch to an other tab to actualize the toolpalette !
Actually, once the toolpalette is set, if you try to change it, you won't see any changes. But if you switch to an other tab (or scratchpad), the toolpalette is defined for this tab, and then when you switch back to your program, the toolpalette is redefined with its last configuration !

That's the explanations I found for this strange behaviour. Smiley
Don't know if it really works so, though. ^^
« Last Edit: 29 April, 2012, 00:02:10 by Loulou 54 » Logged

Some of my program available here.. Smiley
http://ti.bank.free.fr/index.php?mod=archives&ac=voir2&id=1471

     
Frog
LV2 Member (Next: 40)
**
Offline Offline

Last Login: 22 February, 2013, 01:51:11
Date Registered: 17 June, 2011, 16:35:35
Posts: 35

Topic starter
Total Post Ratings: 0

View Profile
« Reply #2 on: 29 April, 2012, 17:12:10 »
0

That fixed the problem, but it sure is really strange behavior... The more I use the TI Lua API, the more I get the feeling that it is stitched together by some bad tape. For example the D2Editor, or the fact that there is no way to update a graph tab from a Lua tab (a big problem in this app, you have to manually update the graph); it's all weird behavior. Still it's of course better than TI-Basic...

Anyways, thanks a lot for your help! Smiley
Logged
Loulou 54
LV4 Regular (Next: 200)
****
Offline Offline

Gender: Male
Last Login: Yesterday at 19:43:29
Date Registered: 22 July, 2011, 21:19:29
Location: Meurthe-et-Moselle FRANCE
Posts: 153


Total Post Ratings: +34

View Profile WWW
« Reply #3 on: 29 April, 2012, 18:12:34 »
0

Fine, you welcome ! Smiley

Yes the D2Editor could be a very good tool but it has many problem too.. For example I believe we can't disable it. Undecided
Logged

Some of my program available here.. Smiley
http://ti.bank.free.fr/index.php?mod=archives&ac=voir2&id=1471

     
Jim Bauwens
Lua! Nspire! Linux!
Editor
LV10 31337 u53r (Next: 2000)
*
Offline Offline

Gender: Male
Last Login: Today at 22:29:56
Date Registered: 28 February, 2011, 22:32:12
Location: Belgium
Posts: 1736


Total Post Ratings: +180

View Profile WWW
« Reply #4 on: 29 April, 2012, 18:28:40 »
0

Frog, D2Editor is greatly improved in 3.2.
Also, what do mean with updating a graph tab?
Logged

Frog
LV2 Member (Next: 40)
**
Offline Offline

Last Login: 22 February, 2013, 01:51:11
Date Registered: 17 June, 2011, 16:35:35
Posts: 35

Topic starter
Total Post Ratings: 0

View Profile
« Reply #5 on: 29 April, 2012, 21:15:03 »
0

Jim: Great that it has been improved! I tried to use it once, but I couldn't do anything with it. Do you have any clue as to when 3.2 will be released?

In my document I've got one graph tab and one lua tab. In the latter you can create new shapes by parameters in a nice GUI, so for a circle you have to enter parameters a, b and r for example. This data is then used to create a function (or actually two functions, because it's otherwise impossible) that the stock TI graph window can display. These two functions together make up the desired shape.

Since there is no way to add new functions to a graph tab using lua, I've create 20 functions that are all set to 0/0. This means they will be showed when they are set to something else, but will not be displayed until that happens. I then set 2 of these functions to the two functions that I created using the data in lua. What I meant is that there is no way to make this change visible in the graph tab using lua; the graph is only updated when a variable is set in a calculator window or a function is added in the graph tab. The users of my applications have to do that manually, which is not really handy. This must be something that is required quite often? Huh?

I hope I've made myself clear, since it's quite hard to describe. Do you happen to know a way to do this which I haven't thought of? I need this, because there is no way to display circles, hyperbola's, etc. by parameter in the TI graph window... Lips Sealed

Btw, Loulou, your animated signature strangely enough caused both my computer and my iPad to lag... Wink
Logged
Levak
LV8 Addict (Next: 1000)
********
Online Online

Gender: Male
Last Login: Today at 23:34:42
Date Registered: 04 April, 2010, 23:42:49
Location: France
Posts: 858


Total Post Ratings: +150

View Profile WWW
« Reply #6 on: 29 April, 2012, 22:31:53 »
0

Hi,
You can update the G&G graph view through Lua by using var.store or math.eval to update a variable linked to the G&G (for example a point coordinate or a slider control).
« Last Edit: 29 April, 2012, 22:32:54 by Levak » 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 22:29:56
Date Registered: 28 February, 2011, 22:32:12
Location: Belgium
Posts: 1736


Total Post Ratings: +180

View Profile WWW
« Reply #7 on: 29 April, 2012, 22:44:34 »
0

3.2 should come out soon, how ever I do not know the exact date.
I see your point for the graph stuff. Maybe try to do something like this:
Add a point to the graph where one coordinate is linked to a variable. When updating a graph function change the variable to increment the variable.
This way the point will update, and maybe make that the whole graph screen gets updated.

I'm not sure if it will work, but it's worth a shot.
Logged

Frog
LV2 Member (Next: 40)
**
Offline Offline

Last Login: 22 February, 2013, 01:51:11
Date Registered: 17 June, 2011, 16:35:35
Posts: 35

Topic starter
Total Post Ratings: 0

View Profile
« Reply #8 on: 30 April, 2012, 18:41:29 »
0

Well, that doesn't work either. If I change the variable using math.eval(), it isn't updated in the graph view. No matter whether I use a slider or a function. The only thing that does happen, is that changing a slider value updates the graph. Maybe I can use that to make it slightly easier...

Anyways, thanks for the help!
Logged
Levak
LV8 Addict (Next: 1000)
********
Online Online

Gender: Male
Last Login: Today at 23:34:42
Date Registered: 04 April, 2010, 23:42:49
Location: France
Posts: 858


Total Post Ratings: +150

View Profile WWW
« Reply #9 on: 30 April, 2012, 18:47:42 »
0

I used to force updates by using an animated slider (0-1, inc 1)
Logged

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

Last Login: 22 February, 2013, 01:51:11
Date Registered: 17 June, 2011, 16:35:35
Posts: 35

Topic starter
Total Post Ratings: 0

View Profile
« Reply #10 on: 30 April, 2012, 19:16:12 »
0

How come I never think of something like that? Although it does feel a bit hacky, it works the way it should. But why didn't TI just add a Lua command graph.refresh() or something like that? Anyways, thanks a bunch!  Smiley
Logged
Pages: [1]   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 0.293 seconds with 30 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.