Omnimaga

Calculator Community => TI Calculators => Lua => Topic started by: jwalker on December 27, 2011, 12:03:30 am

Title: Updating WZGUILib
Post by: jwalker on December 27, 2011, 12:03:30 am
Ok, so im updating my library and the documentation. So far i have Dialog Boxes, Text Boxes, Radio Buttons, Check Boxes, Numeric Up Downs, Labels and Picture Boxes. I would like some input if you have used my library or if i could add some controlls to it.
I did fix the picture box bug so it does work correctly, I am also working on adding more editing functions to the text boxes.
tell me if i missed something
Title: Re: Updating WZGUILib
Post by: Jim Bauwens on December 27, 2011, 04:55:54 am
Hi :)
I never tried your library but to me it doesn't look like you are using classes.
Making your code object oriented will make your life a 1000 times easier ;)

In case you never heard of classes, here is some reference:
http://ourl.ca/12291
http://www.inspired-lua.org/2011/05/5-object-classes/

I would also try to use a "screenmanager", create a screen class were all the functions of "on" are redirected too.
You can also take a look at  my GUI library I'm developing for EEPro (https://github.com/adriweb/EEPro-for-Nspire ). I extensively use classes there.
Title: Re: Updating WZGUILib
Post by: Adriweb on December 27, 2011, 06:48:36 am
Good job, but in EEPro, we've been doing some intensive GUI Lib work, and here's an example of dialog boxes we make :

(http://i.imgur.com/mQULJ.jpg)

with this kind of code :

Code: [Select]

add_unit = Dialog("Add unit","10","7.5","80","85")

unit_value = sInput()
unit_value.ww = "77"
unit_value.number = true

units_list = sList()
units_list.hh = "41"
units_list.ww = "77"
units_list.shrink = true

lbl1 = sLabel("Value:", unit_value)
lbl2 = sLabel("Unit:", units_list)

button_ok = sButton("OK", compute)
button_esc = sButton("Cancel", remove_screen)

add_unit:appendWidget(lbl1, "2", "18")
add_unit:appendWidget(lbl2, "2", "38")
add_unit:appendWidget(unit_value, "20", "18")
add_unit:appendWidget(units_list, "20", "38")
add_unit:appendWidget(button_ok, "60", "82")
add_unit:appendWidget(button_esc, "75", "82")

( https://github.com/adriweb/EEPro-for-Nspire/blob/master/2%20-%20%20FormulaPro/FPGui.lua (https://github.com/adriweb/EEPro-for-Nspire/blob/master/2%20-%20%20FormulaPro/FPGui.lua) )

They are all interactive (tab keys to switch focus, unicode input text, react to mouse and keyboard) etc.

Maybe you should try to make some native-looklike GUI stuff and then we'd combien what you have with what we've done in EEPro ? :)
Title: Re: Updating WZGUILib
Post by: jwalker on December 27, 2011, 11:23:57 am
ok good to know. one of the reasons i am updating it is to make a better use of the lua's OOP programming.
the screen manager idea is one that i hadnt thought of before that i probably should have.
The EEPro stuff looks realy cool too
Title: Re: Updating WZGUILib
Post by: Nick on December 28, 2011, 03:50:31 pm
would you mind posting your source, or a screenie with everything working? i wanna see how it looks like
Title: Re: Updating WZGUILib
Post by: Jim Bauwens on December 28, 2011, 03:59:46 pm
Just check ticalc.org :)
Title: Re: Updating WZGUILib
Post by: epic7 on December 28, 2011, 05:00:38 pm
So... Whats wsguilib? A GUI library?
Title: Re: Updating WZGUILib
Post by: Nick on December 28, 2011, 05:12:47 pm
yes it is a set of radiobuttons, checkboxes, screens, textboxes etc

here's a pic of it:
(http://www.ticalc.org/cgi-bin/zipview?nspire/lua/libs/wzguilib.zip;12-04-2011%20Image001.jpg)
Title: Re: Updating WZGUILib
Post by: jwalker on December 28, 2011, 06:00:15 pm
yea, i added some stuff to it and put it on ticalc a few hours ago. some things i have to fix yet is the lack of inheritance and the fact that dialog boxes only support text right now. its a good thing i have the rest of christmas break to work on it :)
meaning i am adding a screen manager and better features for dialog boxes
here is some code for  numeric up downs that i added:
Code: [Select]
function NumericUD:init(x, y, num, selected, linecolor, maxnum, minnumber, textcolor, pmbcolor)
self.x = x
self.y = y
self.pmbcolor = pmbcolor
self.num = num
self.text = tostring(num)
self.selected = selected
self.linecolor = linecolor
self.maxnum = maxnum
self.minnumber = minnumber
self.textcolor = textcolor
self.width = 42
self.height = 23
table.insert(NUDTable, self)
end

function NumericUD:paint(gc)
gc:setPen("thin", "smooth")
gc:setColorRGB(unpack(self.pmbcolor))
gc:drawLine(self.x + 35, self.y, self.x + 35, self.y + 23)
gc:drawLine(self.x + 35, self.y + 11, self.x + 42, self.y + 11)
gc:setFont("serif", "r", 6)
gc:drawString("+", self.x + 36, self.y - 2, "top")
gc:drawString("-", self.x + 36, self.y + 10, "top")
gc:setColorRGB(unpack(self.linecolor))
gc:drawRect(self.x, self.y, self.width, self.height)
gc:setColorRGB(unpack(self.textcolor))
gc:setFont("serif", "r", 11)
gc:drawString(self.text, self.x + 2, self.y + 2, "top")
end
function NumericUD:click(x, y)
if y >= self.y and y <= self.y + 11 and x >= self.x + 35 and x <= self.x + 40 then
self:Up()
elseif y >= self.y + 11 and y <= self.y + 23 and x >= self.x + 35 and x <= self.x + 40 then
self:Down()
end
end
function NumericUD:Up()
if self.num ~= self.maxnum then
self.num = self.num + 1
self.text = tostring(self.num)
end
platform.window:invalidate()
end
function NumericUD:Down()
if self.num ~= self.minnumber then
self.num = self.num - 1
self.text = tostring(self.num)
end
platform.window:invalidate()
end
function drawNUD(gc)
for _, NUD in pairs(NUDTable) do
NUD:paint(gc)
end
end
i probably would have worked on it way more, but i found a bug in the picture box function
Title: Re: Updating WZGUILib
Post by: Nick on December 28, 2011, 06:01:07 pm
maybe i can give you one advice. i would make the colors more soft. I mean not those flashy green fluocolors, but simple grey or so

and maybe put the close button on the dialog box in the middle, it will look more real if you understand what i mean
Title: Re: Updating WZGUILib
Post by: jwalker on December 28, 2011, 06:18:49 pm
i was thinking something like that too. and i might change the circle to a square. the colors can be changed just by creating the dialog box or changing the color after it is created kind of like this:
Code: [Select]
----colors:
color = {
black = {0, 0, 0},
lightgreen = {0, 255, 0},}
-----------dialog code
dialog = class()

function dialog:init( x, y, text, title, isselected, backcolor, textcolor, closecolor, isdrawn)--add buttons and other features
self.x = x
self.y = y
self.text = text
self.title = title
self.width = 200
self.height = 150
self.cbw = 10
self.cbh = 10
self.cbx = self.x + 175
self.cby = self.y + 7
self.selected = isselected
self.backcolor = backcolor
self.textcolor = textcolor
self.closecolor = closecolor
self.isdrawn = isdrawn
self.moveable = false
table.insert(dialogTable, self)
end
function dialog:paint(gc)
if self.isdrawn then
gc:setFont("sansserif", "b", 12)
gc:setColorRGB(unpack(self.backcolor))
gc:fillRect( self.x, self.y, self.width, self.height)
gc:setColorRGB(unpack(color.white))
gc:fillRect( self.x + 5, self.y + 20, self.width - 10, self.height - 30)
gc:setColorRGB(unpack(self.textcolor))
if string.len(self.title) > 10 then
self.title = string.sub(self.title, 1, 10).."..."
end
gc:drawString(self.title, self.x + 10, self.y + 8, "middle")
gc:drawString(self.text, self.x + 9, self.y + 25, "middle")
gc:setColorRGB(unpack(self.closecolor))
gc:fillArc( self.cbx, self.cby, self.cbw, self.cbh, 0, 360)
end
end
function dialog:checkUnclick()
self.moveable = false
cursor.set("default")
self.selected = false
platform.window:invalidate()
end
function dialog:checkClick(x, y)
if self.isdrawn then
if (x >= self.cbx and x <= self.cbx + 10) and (y >= self.cby and y <= self.cby + 10) then
self:close()
elseif self.moveable == false and (x >= self.x and x <= self.x + self.width) and (y >=self.y and y <= self.y + (self.height - 130)) then
self:wasclicked(x, y)
else
self:checkUnclick()
end
end
end
function dialog:close()
self.selected = false
self.isdrawn = false
self.moveable = false
cursor.set("default")
platform.window:invalidate()
end
function dialog:wasclicked(x, y)
self.moveable = true
if self.selected ~= self then
for _, dlg in pairs(dialogTable) do
dlg.selected = false
end
self.selected = true
end
self.xvar = x - self.x
self.yvar = y - self.y
cursor.set("drag grab")
platform.window:invalidate()
end
function dialog:mouseMove(x, y)
if self.moveable and self.isdrawn and self.selected then
cursor.set("drag grab")
self.x = x - self.xvar
self.y = y - self.yvar
self.cbx = self.x + 175
self.cby = self.y + 7
platform.window:invalidate()
end
end
function drawDialog(gc)
for _, SD in pairs(dialogTable) do
if SD.isdrawn then
SD:paint(gc)
end
end
end
------------
---------------create the dialog box
function on.create()
dia1 = dialog(45, 23, "Color change", "Colors", false, color.lightgreen, color.red, color.red, true)
end
----------------------------say a function changes the color like this later on if it is called
function color_change()
dia1.backcolor = color.black
-----after that the color of the boarder would be black
end
in the end its what the programmer decides, but i probably would tone the colors down just because they are hard to see on the calc :P
EDIT: @epic7 it is a small, easy to use gui library that offers quite a few features, im working on making a better use of the OOP that Nspire lua offers
Title: Re: Updating WZGUILib
Post by: jwalker on December 29, 2011, 06:54:50 pm
Im trying to make a cursor for the text box but ive encountered a problem...
im not quite sure if the "gc:getStringWidth" command works properly
does anyone else have problems with it
Title: Re: Updating WZGUILib
Post by: Jim Bauwens on December 30, 2011, 04:26:18 am
It works fine for me. What is the problem ?
Title: Re: Updating WZGUILib
Post by: jwalker on December 30, 2011, 11:12:41 am
the problem is that with diffrent charachters like a and A it dosen't seem to recognize the diffrence in size:
example this code:
Code: [Select]
textbox = class()

function textbox:init(x, y, text, selected, textcolor, tbcolor)
self.x = x
self.y = y
self.width = 156
self.height = 20
self.text = text
self.textcolor = textcolor
self.tbcolor = tbcolor
self.selected = isselected
self.curx = self.x + platform.gc():getStringWidth(self.text)
self.cury = y + 1
self.curh = (self.y + self.height) - 1
table.insert(textboxTable, self)
end
function textbox:paint(gc)
gc:setColorRGB(unpack(self.tbcolor))
gc:drawRect( self.x, self.y, self.width, self.height)
gc:setColorRGB(unpack(self.textcolor))
gc:setFont("serif", "r", 11)
gc:drawString( self.text, self.x + 4, self.y + 8, "middle")
gc:setColorRGB(unpack(color.black))
gc:drawLine(self.curx, self.cury, self.curx, self.curh)
end
function textbox:charIn(ch)
if self.selected then
if (self.width - 8) < platform.gc():getStringWidth(self.text) then
platform.window:invalidate()
else
self.text = self.text..ch
self.curx = self.x + platform.gc():getStringWidth(self.text) + 2
platform.window:invalidate()
end
end
end
function textbox:backspace()
if self.selected then
self.text = string.sub(self.text, 1, string.len(self.text) - 1)
self.curx = self.x + platform.gc():getStringWidth(self.text) + 2
platform.window:invalidate()
end
end

function textbox:click()
if self.selected then
self.selected = false
else
for _, tb in pairs(textboxTable) do
tb.selected = false
end
self.selected = true
end
platform.window:invalidate()
end

function textbox:checkClick(x, y)
if y >= self.y and y <= self.y + self.height and x >= self.x and x <= self.x + self.width then
self:click()
end
end
the code is this: cury = self.x + platform.gc():getStringWidth(self.text)
it seems that if you continualy type a lowercase "a" the cursor goes farther ahead
and it seems that if you continualy type a capital "A" the cursor will fall behind
this is the same for most of the capitol and lowercase letters
also this dosent have a drawTB function because im working on a small screen manager
Title: Re: Updating WZGUILib
Post by: Adriweb on December 30, 2011, 12:24:16 pm
Your problem might come from the fact that you're using platform.gc():getStringWidth()  instead of the normal  gc  you use when you draw stuff.
platform.gc() initialize a new  gc   and then doesn't know about the font properties (size etc.) of the one you want, so this is probably the source of problem...

Try either to :
  -  pass gc (the one you use to draw with) to the function where   getStringWidth()   is needed, then do that with this gc.
  -  calculate the width beforehand (then pass it to the function)... but that might be too heavy. It's better to use the 1st solution.
Title: Re: Updating WZGUILib
Post by: cyanophycean314 on December 30, 2011, 01:10:50 pm
Every time I read about the platform.gc function, it's always something bad. What's the actual use of it? Why not just use gc?

Oh and I'm pretty excited and curious about what's going to happen to Lua soon. You guys (adriweb and jimbauwens) are dropping hints everywhere. The SDK is being released in 2012, but what exactly will that do to Lua?
Title: Re: Updating WZGUILib
Post by: Jim Bauwens on December 30, 2011, 01:30:23 pm
platform.gc() will go away in the next release, so that's also a reason not to use it ;)

Sadly enough we can't tell more what's to come next release as we are under NDA.
All we can say is that its going to be great :)
Title: Re: Updating WZGUILib
Post by: cyanophycean314 on December 30, 2011, 03:47:53 pm
If we update to the next release of Lua, will we have to update the OS? I'm still running 3.0.1.  :P

Will Ndless still be compatible if we have to update the OS? Even though I love programming Lua, I'm not willing to give up the chance for a GBC emulator, inter alia.  :)
Title: Re: Updating WZGUILib
Post by: Adriweb on December 30, 2011, 04:11:06 pm
If we update to the next release of Lua, will we have to update the OS? I'm still running 3.0.1.  :P
Yes

Will Ndless still be compatible if we have to update the OS? Even though I love programming Lua, I'm not willing to give up the chance for a GBC emulator, inter alia.  :)
No idea. Ndless 3.1 works with 3.1. If the exploit(s?) is still there in the future OS update, there's a good chance that ndless will work too :)
It has not been tested with the alpha build we have (and we won't do it - and we can't, even if we would want to-)
Title: Re: Updating WZGUILib
Post by: jwalker on December 30, 2011, 07:36:18 pm
I cant wait for the next os, but i might not upgrade my CX CAS if if ndless comes out
after i fix this i will get rid of all of the other platform.gc's its a good thing there isnt many of them
Title: Re: Updating WZGUILib
Post by: jwalker on December 31, 2011, 09:53:59 pm
well i redesigned dialog boxes and added multiline-text support, added a "forms" class that makes up for the features that are lacking in the dialog boxes. now all thats left is working on the screen manager...
I will get pics as fast as i can
Title: Re: Updating WZGUILib
Post by: jwalker on January 01, 2012, 11:03:25 am
an image is below
right now im trying to get the widndows and dialog boxes moveable again
also dialog boxes are now children of a main window or a form
also every control must have a parent
the code to create the objects was this:
Code: [Select]
cmtable = {text= {"File", "Save", "Add"},
actions = {File, Save, Add}}
frm1 = form(1, 1, 300, 200, false, "Title", color.white,color.Bdark, true, true, cmtable, true)
button1 = button("button", 2, 12, ck, color.black, color.Bcontrol, false, frm1, false)
dialog1 = dialog( 50, 50, "text", "title", color.black, color.white, true, frm1, true)
right now you dont have to have a main window

EDIT: is there a better way to upload images?
Title: Re: Updating WZGUILib
Post by: jwalker on January 03, 2012, 12:44:38 am
here are some more images
forms and dialogs are moveable
using string.split you can use the \n charachter in dialogs and labels
Title: Re: Updating WZGUILib
Post by: Nick on January 03, 2012, 02:43:22 am
looks very good, but maybe you shoould change the serif font from the button to sansserif :)

and i see u have a "file" "save" and "add" menu in the first window, are they useable? i mean, is there a pop up menu or so?
Title: Re: Updating WZGUILib
Post by: jwalker on January 03, 2012, 09:06:44 am
yea i added a context menu in the form and im working on getting it working. its going to be like a windows dropdown menu. you would also have the option of not haveing one.
and the great thing is its not limited to those, you can choose what is in it, i just put some standard ones in :)
you have to have a table like the one two posts above.
Title: Re: Updating WZGUILib
Post by: Nick on January 03, 2012, 01:16:42 pm
great, this will become a really nice lib, i think..

maybe you can add one thing, you have the coords of the windows, right, well when you now add something like this:
Code: [Select]
platform.window:invalidate(unpack(self.dim))with dim = {x,y,width,height}
it will only redraw the content of the screen, and not the rest of the screen, might be useful
Title: Re: Updating WZGUILib
Post by: jwalker on January 03, 2012, 01:40:58 pm
i was thinking about that but i didnt think about using lists, which is a great idea. static controls would definately benafit
i might try it on windows but the only problem is they arent static and can be moved by clicking them and moving the mouse... this will definitely speed up the redraw process
Title: Re: Updating WZGUILib
Post by: Nick on January 03, 2012, 01:43:45 pm
that moving isn't a problem..
you keep track of the x and y position of the window, then you just replace those x an y from the list by the new values after the replacement --> problem solved :)
Title: Re: Updating WZGUILib
Post by: Jim Bauwens on January 03, 2012, 01:47:04 pm
I have something like this in EEPro.
My screens have an invalidate function that only invalidate the screen area.
Like this: dialog:invalidate() .
Title: Re: Updating WZGUILib
Post by: jwalker on January 03, 2012, 11:53:16 pm
the context menues are almost there it wont be long now
tables are set up like this right now
cmtable = {item = {text, list, x, y, width, height, xoff, yoff},}
the x to yoff are initialized by zeros i may remove them from the users site
todo: add actions for the menu sub-items__make the menu apear under the item that was clicked__ change the color scheme
i also added platform.window:invalidate(x, y, width, height) instead of platform.window:invalidate(), for some reason i thought it would mess with other stuff :P
also i have an idea with forms but im not quite sure how to implement it:
if a form is focused i would need it to draw overtop of the other windows
would table.sort work for this??
Title: Re: Updating WZGUILib
Post by: Nick on January 04, 2012, 05:49:57 am
well, you could give every window an extra id, just 1 or 0. store all these values in a list (with only one 1 of course, fot the one on top, the rest is 0), do table.sort, and draq them, based on the id (by comparing it to the id of the window)

that's how i do it..but with blocks instead of windows :)
Title: Re: Updating WZGUILib
Post by: jwalker on January 04, 2012, 09:09:39 am
i thought of that a while back but when i tried table.sort i wasnt sure how to use it and it didnt work, how do you use it any way?
Title: Re: Updating WZGUILib
Post by: Nick on January 04, 2012, 09:34:38 am
add a spec to your class:init and call it depth, initial value is 1 (1=draw in foreground, 0=drawn in background)
you probably have a table in which you store all the window forms to keep track of?
make a table in which you store those depths, with the number of the window in the table of all the windows (in which you do table.insert to keep track of them)

Code: [Select]
function form:init(*other specs here*,depth)
   *other specs here*
   self.depth=depth
end

table.insert(windows,form(*other specs here*,1)

for i=1,#windows do
   table.insert(depthtable,i,[tostring(i)]=windows[1].depth)
end

function on.paint(gc)
   table.sort(depthtable)
   for v,k in pairs(depthtable) do
      v:paint(gc,windows(k))
   end
end

function form:paint(gc,window)
    *draw form here with self.***
end
i haven't tested it, but it could work i suppose
Title: Re: Updating WZGUILib
Post by: jwalker on January 05, 2012, 09:13:39 am
Ok I have working context menues except for the part where they perform and action, im doing that tonight
i didnt use table.sort i used this instead, for now:

Code: [Select]
local ltblhold = {}
table.insert(ltblhold, self)
for i = 1, #wndTbl do
if wndTbl[i] == self then
b = i
break
end
end
table.remove(wndTbl, b)
table.insert(wndTbl, ltblhold[1]) 


i dont know if i actualy need the ltblhold table but its in here for now, i think i do need it though
EDIT: Here are the pic of the functioning context menu, complete with actions and all, also is there a better way to upload images???
the add in the dialog is from the file menu, not the add option, this is all realy random and you can basicly make it look more organized
the table to make 1 item or option looks like this:
item1 = {text = /*text for option*/, list = {/*list of options, actions and their x, y, width , height values*/},/*the x, y and width and height values of the option}
all x y width and height values are initialized by the programmer to zero while makeing them in the table
Title: Re: Updating WZGUILib
Post by: Nick on January 05, 2012, 11:05:22 am
this looks really good.. so it opens a dialog box when you select an item out of the dropdown menu?

and it seems that your drawing order is ok? or is that just an illusion?
Title: Re: Updating WZGUILib
Post by: jwalker on January 05, 2012, 11:51:40 am
the drawing order is ok, i didnt use table.sort though, and it works perfectly. the menu items will open a dialog and i have defined functions for it to pop up the dialog.
i need to make the table less complex though... it looks like this:
item1 = {text = "File", list ={item1 = {text = "add", x = 0, y = 0, width = 0, heigt = 0}, {item2 = {text = "badd", x = 0, y = 0, width = 0, heitght = 0}}}, x = 0, y = 0, width = 0, hight = 0}
when i get home form school im going to work on getting the table simpler, get rid of the x, y, width , and height values and insert them into the table when it maps out the text items
Title: Re: Updating WZGUILib
Post by: jwalker on January 06, 2012, 09:15:51 am
Here is a prerelease version with lua source.
NOTE: it is prerelease so a few things are going to change, most likely tonight :)
Title: Re: Updating WZGUILib
Post by: flyingfisch on January 06, 2012, 09:18:17 am
I'm going to take a look at that code :)
Title: Re: Updating WZGUILib
Post by: jwalker on January 06, 2012, 09:20:33 am
sounds good
Title: Re: Updating WZGUILib
Post by: Nick on January 06, 2012, 09:55:43 am
oh, great, a realease.. i'll check it
Title: Re: Updating WZGUILib
Post by: jwalker on January 06, 2012, 10:04:33 am
sounds good, and like i said i have to fix some things and add some other stuff, and optimize a little more
Title: Re: Updating WZGUILib
Post by: Nick on January 06, 2012, 10:14:28 am
lol, ok :) good luck.. maybe, if you finished all the necessary stuff, you could add rounded corners for the forms/windows :)
Title: Re: Updating WZGUILib
Post by: jwalker on January 06, 2012, 10:16:58 am
that would look cool!!
also if you notice the only class that has platform.window:invalidate() is the form class.
i took them out of all of the other classes because i dont need them do to the fact that they get redrawn with the form!!
Title: Re: Updating WZGUILib
Post by: Nick on January 06, 2012, 10:18:35 am
true, very good, that keeps unnecessary drawings out.. but just one point, it's "due to the fact", not "do to the fact" lol just to let you know
Title: Re: Updating WZGUILib
Post by: jwalker on January 06, 2012, 11:17:22 am
i know, the bell wrang and i was typing as fast as i could
also i noticed i need to break out of the for loop in the mouseDown stuff so that if i close a window and another window is behind it and some how the other close button was right under it, the second window must not close, right now it does..
Title: Re: Updating WZGUILib
Post by: Nick on January 06, 2012, 02:37:16 pm
ow, well yeah, you should set a small timer on it or so? that disables the action from mouseDown
Title: Re: Updating WZGUILib
Post by: jwalker on January 06, 2012, 02:49:39 pm
i thought about something like that, set a timer to like 0.02 or something, i also may try to break the loop scince the one that is on top is the one tht is focused
Title: Re: Updating WZGUILib
Post by: Nick on January 06, 2012, 02:50:34 pm
oh yeah, that could work too, just use break
Title: Re: Updating WZGUILib
Post by: jwalker on January 06, 2012, 03:01:10 pm
i will have to do some of this when i get home
Title: Re: Updating WZGUILib
Post by: jwalker on January 07, 2012, 01:25:23 pm
im realy starting to think that users will have to select a window before closeing it....
Title: Re: Updating WZGUILib
Post by: Nick on January 07, 2012, 01:49:59 pm
how do you mean? like you cannot close an unactive window?
Title: Re: Updating WZGUILib
Post by: jwalker on January 07, 2012, 02:50:13 pm
haha was kinda frustrated when i said that, im going to still let them do that but ive got to work on some other things first....
Title: Re: Updating WZGUILib
Post by: Nick on January 07, 2012, 03:43:18 pm
uh, is it a mystery? or you just didn't tell it?
Title: Re: Updating WZGUILib
Post by: jwalker on January 07, 2012, 05:39:44 pm
i didnt tell, but i fixed what is bothering me..
AND IM SO HAPPY
the lua script with the fix is below
i fixed the click one close button click all problem
i also fixed the i just unclicked that window over that window and it got selected problem
EDIT: if you downloaded the other prerelease this one replases it
EDIT#2:The old lua script that i jus uploaded was the old script, here is the new one
Title: Re: Updating WZGUILib
Post by: Nick on January 08, 2012, 03:07:36 am
nice :) maybe you should adapt all the downloads in this thread by the new one, so that noone comes to sit with the old one, thinking he has the new

nice to see everything worked out fine
Title: Re: Updating WZGUILib
Post by: jwalker on January 08, 2012, 10:05:06 am
just did. now on to the text boxes....
Title: Re: Updating WZGUILib
Post by: jwalker on January 09, 2012, 09:54:54 am
while im working on the text boxes... has anyone tried out the new source, looked at it?
if so tell me anything you want to about it, good, bad , what needs to be improved...
Title: Re: Updating WZGUILib
Post by: jwalker on January 10, 2012, 07:49:10 am
hmmm... textboxes are kinda tricky.....
Title: Re: Updating WZGUILib
Post by: jwalker on January 15, 2012, 08:38:03 pm
almost done.... got caught up in the windows gadgets stuff :)
Title: Re: Updating WZGUILib
Post by: jwalker on January 27, 2012, 06:52:52 pm
i will be writing up the documentation tonight and releasing it to ticalc tonight, i will also upload to omnimaga sometime also tonight
this now includes:
*textboxes with a type of scrolling text
*forms
*re-designed dialog boxes
*small window manager
*and much more
Title: Re: Updating WZGUILib
Post by: jwalker on April 07, 2012, 02:49:31 pm
wow, its been a while.
any way this is the place where i release my information so here is some information:
In V3 there will be a tabcontrol, yes a tabcontrol. here is an image of it in development.

Also if you have any questions or comments post them here


Title: Re: Updating WZGUILib
Post by: Nick on April 07, 2012, 02:52:55 pm
wow รถ that's really nice.. so you can click on them with the mouse? great :) maybe you could give it a slightly different color and a little more alignement so it does not stick to the borders, but this is cool

if you would want me to help with some of the design or different styles, i would be glad to help you with this :)
Title: Re: Updating WZGUILib
Post by: jwalker on April 07, 2012, 03:03:13 pm
that would be great...
it isnt clickable yet due to the fact i just started about 30 min. ago and was just working on drawing it out
here is the current code for the tabcontrol and the table that is used to make the tabs
like i said it is in the very beginning stages and it will change alot befor i release v3
Code: [Select]
tabcontrol = class()

function tabcontrol:init(x, y, width, height, tabcpntr, parent)
self.x = x + parent.x
self.y = y + parent.y
self.xoff = x
self.yoff = y
self.width = width
self.height = height
self.parent = parent
self.controls = {}
self.tabcollection = tabcpntr
self.curtab = startingtab
self.tabcount = table.maxn(self.tabcollection)
table.insert(parent.controls, self)
end
function tabcontrol:paint(gc)
stroff = gc:getStringWidth("SOF") - 6
gc:setColorRGB(unpack(color.white))
gc:fillRect(self.x, self.y, self.width, self.height)
gc:setColorRGB(unpack(color.black))
gc:drawRect(self.x, self.y, self.width, self.height)
gc:drawRect(self.x, self.y - stroff, self.width, stroff)
gc:setFont("sansserif", "r", 6)
local y = self.y - 8
local x = self.x + 2
for _, bb in pairs(self.tabcollection) do
bb.x = x
bb.y = y
bb.width = gc:getStringWidth(bb.text)
bb.height = gc:getStringHeight(bb.text)
if bb.selected then
gc:setColorRGB(unpack(color.Bdark))
gc:fillRect(bb.x - 2, bb.y - 2, bb.width + 2, bb. height - 4)
gc:setColorRGB(unpack(color.black))
end
gc:drawRect(bb.x - 2, bb.y - 2, bb.width + 2, bb.height - 4)
gc:drawString(bb.text, x, y, "middle")
x = x + 5 + bb.width
end

end

function tabcontrol:checkClick(x, y)

end

function tabcontrol:clicked(x, y)

end
function tabcontrol:getCurTab()
for _, tabs in pairs(self.tabcollection) do
if tabs.selected then
return tabs
end
end
end

Table:
Code: [Select]
Tabs = {tab4 = {text = "Tab3", selected = false},
tab2 = {text = "Tab1", selected = true},
tab3 = {text = "Tab2", selected = false},
tab1 = {text = "Tab4", selected = false}}


also about the styles...
i will be working on making a 3D style pack for release with V3, but only once i get the last bug eraticated from the form class
Title: Re: Updating WZGUILib
Post by: Nick on April 07, 2012, 03:04:44 pm
I'll check it out in a while (this evening).

what do you mean with 3D? with gradients and stuff?

Oh and there's one thing i've seen on some places, what's that "for __," part? i mean, what does that __ sign to?
Title: Re: Updating WZGUILib
Post by: jwalker on April 07, 2012, 03:24:42 pm
ive never been realy able to figure it out what the _ sign does, i know my code loops through a table and uses values in them, i also know that it doesnt seem to want to go in order, if you knoticed my code for the tab table where tab1 is assigned the text "tab4". ive tried googleing it but without much luck

its just a false 3D, drawn with lines
if you have V2 in the buttons there is an opt3D paramater, it will be removed in 3 so poeple will be able to use a style pack
also go to cemetech to get the newest version, which is v2.1 beta
Title: Re: Updating WZGUILib
Post by: Nick on April 07, 2012, 03:37:34 pm
I'm going to design a style that fits the nspire, isn't hard to port (without a lot of gradients) and a nice look ok? but just in photoshop, then you just have to tell me how to write it to your needs or do it yourself.

Also, i noticed that boxes are only activated when you select them by pressing the titlebar. Couldn't you change that somehow so that it gets selected by pressing the entire form?
Title: Re: Updating WZGUILib
Post by: jwalker on April 07, 2012, 05:07:07 pm
i am planning to work on that to make the form active,
and sounds great, just post it here
Title: Re: Updating WZGUILib
Post by: hoffa on April 07, 2012, 05:14:18 pm
Oh and there's one thing i've seen on some places, what's that "for __," part? i mean, what does that __ sign to?
It's a convention (used in Python among others), it's no special character. Usually if we don't care about the variable we're looping with, it's better just to use "_" to explicitly show it's not important.
Title: Re: Updating WZGUILib
Post by: jwalker on April 07, 2012, 06:19:19 pm
that makes sence....
also tabs are clickable and can hold controls of their own

here are some pics:
Title: Re: Updating WZGUILib
Post by: Nick on April 08, 2012, 02:45:40 am
wonderful! and there's one other thing. If you have a long title (or a short titlebar), and the title comes further than the red/green buttons, will it be covered by them or will they cover the buttons? or is there just enough space to make it all fit?
Title: Re: Updating WZGUILib
Post by: jwalker on April 08, 2012, 09:36:14 am
that is something i have been meaning to work on, but since you cant drag windows to make them bigger or smaller, i havnt implemented it, it has been up to the programmer to make sure thier title is the right size. what this would do is determine if the maximize/minimize button is too close to the title, the title would display less charachters with a ".." after it.
Also i fixed the Fullscreen patamater bug and i made the windows clickable in other places than the title bar to activate them. you can only move a window by clicking the title bar.
The file i uploaded is what ive been testing 3d object creation and right now only buttons and textboxes have a "3D" look.

this includes all of the new features i listed above
Title: Re: Updating WZGUILib
Post by: jwalker on April 08, 2012, 10:59:02 pm
even though this is double posting.... its been quite a while sooooo

V2.1 is now released, it has to be approved on Ti-Calc and Omnimaga and Cemetech, also i noticed a v1 version on Ti-Planet that needs to be updated so, if you are like an admin on Ti-Planet, or the person who uploaded it would you please update it, i would but i didnt upload it so i dont think i can. The only reason im asking is that this is a MAJOR upgrade from v1. also in v2.1 i fixed the fullscreen patamater issue and also have made the body of the form clickable so you can activate it without clicking the titlebar

also ive included tabcontrol beta

also unicode support and listboxes, which i worked on today, will be released in V3
V3 will be released AFTER the new OS update. I will release 2 versions, one for 3.1 and one for 3.2, due to the fact many probably wont upgrade to 3.2 so we can have ndless
Title: Re: Updating WZGUILib
Post by: Adriweb on April 09, 2012, 05:04:38 am
Let me change the direct download link on TI-Planet from a hosted file to the download page here on Omni so it will always be updated ;-)
( nice update btw ! )
Title: Re: Updating WZGUILib
Post by: jwalker on April 09, 2012, 09:42:48 am
Thanks, i think i finaly have a realy good Version.
I think i finaly have it bug free too

Also if you need more info, just ask

Also i have been requested to seperate the controls into seperate files, so i did, also i plan to write a "Programming with WZ" thing soon
Title: Re: Updating WZGUILib
Post by: jwalker on April 11, 2012, 07:20:07 am
Well, since it has been out for a while... Is there any comments, any ideas, any controls you would like to see?
Title: Re: Updating WZGUILib
Post by: Nick on April 11, 2012, 08:01:08 am
it lught be hard to add, but would a  trackbar be possible? that would be really useful for my later projects :)
Title: Re: Updating WZGUILib
Post by: jwalker on April 11, 2012, 03:22:29 pm
That wouldnt be too hard, i could probably get it done prety fast.
Also i was thinking about adding events to forms, like when you close a form it calls a function that the user defined, or when a form is maximized or minimized.
formEvents = {close = function(), maximized = function(), minimized = function()}
Title: Re: Updating WZGUILib
Post by: Nick on April 11, 2012, 04:05:25 pm
wow, you're making it really making it heavy loaded with features รถ nice work!

small list:
 - a small box that comes beneath your cursor when hovering over a button or link
 - trackbar
 - toolbar with icons
 - progressbar (http://ourl.ca/14573)
         This is the one i made, maybe you can just add it to your controls and adapt it maybe..

here is an image of the visual studio toolbow, might Nspire you
(http://blogs.microsoft.co.il/blogs/arik/image_thumb_3D08A7D5.png)

edit: and could you please give examples that work in the package? i tried the button one, and i had to change a lot to make it work, and it still seems not to do what it has to.. so if you could please check that
Title: Re: Updating WZGUILib
Post by: jwalker on April 11, 2012, 05:31:28 pm
are you meaning this:
make a window: wnd1 = form(10, 10, 100, 100, false, "Example", color.white, color.black, true, false)--no context menu
btn1 = button("Button", 1, 1, action(), color.black, color.Bcontrol, false, wnd1)
                       text, x, y, called when clicked, text color, bg color, opt3d, parent

x and y are offsets from the body of the parent window. opt3d will be depricated

this example will work, all you need is to create a function called action()
Title: Re: Updating WZGUILib
Post by: jwalker on April 12, 2012, 04:38:47 am
Ok, Due to the fact that Omnimaga seems to be having problems and i would like to reach farther into the community, ive created a second thread that i will also release information and answer questions
it is located on cemetech and can be found here:
http://www.cemetech.net/forum/viewtopic.php?t=7677 (http://www.cemetech.net/forum/viewtopic.php?t=7677)

THIS will still be the main thread though

Its not that omnimaga is having huge problems or anything, its just that if i am working with others on creating a style pack or controls or something and omnimaga happens to go down, i can still do some work
Title: Re: Updating WZGUILib
Post by: jwalker on April 12, 2012, 02:52:17 pm
I am going to make a progress bar, but it will be contained in a new control, the status bar
I also am planning to make group boxes, trackbars, scrollbars and a few others
I also am probably will make a "tooltip", where when you hover your mouse over something it will display a box with info in it

Also this is not a double post.
Title: Re: Updating WZGUILib
Post by: jwalker on April 13, 2012, 03:24:12 pm
Yesterday i added icon support to forms, created an alpha status bar, and started working on a progress bar
Title: Re: Updating WZGUILib
Post by: Nick on April 13, 2012, 08:40:09 pm
nice. what should the resolution of the icons be? 8x8, 16x16 or something else? and a status bar, nice :)

just another question, is it possible to use all these objects out of a form, just on the screen? or do you have to make a form for them?
and could you please update the examples with working ones so we can actually use them?
Title: Re: Updating WZGUILib
Post by: DJ Omnimaga on April 13, 2012, 11:26:58 pm
Glad this is still progressing jwalker. :)
Title: Re: Updating WZGUILib
Post by: jwalker on April 14, 2012, 01:50:30 am
yea, i am too :), and there still as so much more to come...
Also right now there are 16X16 icons, but i think that may be too big, so i will try a smaller size.
As of right now, you have to have them in a form, but i thought of making the "Home screen", that would have the abbility to contain controls, but also have a windows like taskbar that contains the icon of forms that are open.
These controls will work:

Paste these controls into the create method with the form, past the form first:
Code: [Select]
Icon1 = image.new("\016\000\000\000\016\000\000\000\000\000\000\000 \000\000\000\016\000\001\000\239\189\239\189\239\189\239\189\239\189\239\189\239\189\239\189\239\189\239\189\239\189\239\189\239\189\239\189\239\189\239\189\239\189\192\255\192\255\192\255\192\255\192\255\192\255\192\255\192\255\192\255\192\255\192\255\192\255\192\255\192\255\239\189\239\189\192\255\192\255\157\130\157\130\157\130\157\130\157\130\157\130\157\130\157\130\157\130\157\130\192\255\192\255\239\189\239\189\192\255\192\255\157\130\157\130\157\130\157\130\157\130\157\130\157\130\157\130\157\130\157\130\192\255\192\255\239\189\239\189\192\255\192\255\192\255\192\255\192\255\192\255\157\130\157\130\192\255\192\255\192\255\192\255\192\255\192\255\239\189\239\189\192\255\192\255\192\255\192\255\192\255\192\255\157\130\157\130\192\255\192\255\192\255\192\255\192\255\192\255\239\189\239\189\192\255\192\255\192\255\192\255\192\255\192\255\157\130\157\130\192\255\192\255\192\255\192\255\192\255\192\255\239\189\239\189\192\255\192\255\192\255\192\255\192\255\192\255\157\130\157\130\192\255\192\255\192\255\192\255\192\255\192\255\239\189\239\189\192\255\192\255\192\255\192\255\192\255\192\255\157\130\157\130\192\255\192\255\192\255\192\255\192\255\192\255\239\189\239\189\192\255\192\255\192\255\192\255\192\255\192\255\157\130\157\130\192\255\192\255\192\255\192\255\192\255\192\255\239\189\239\189\192\255\192\255\192\255\192\255\192\255\192\255\157\130\157\130\192\255\192\255\192\255\192\255\192\255\192\255\239\189\239\189\192\255\192\255\192\255\192\255\192\255\192\255\157\130\157\130\192\255\192\255\192\255\192\255\192\255\192\255\239\189\239\189\192\255\192\255\157\130\157\130\157\130\157\130\157\130\157\130\157\130\157\130\157\130\157\130\192\255\192\255\239\189\239\189\192\255\192\255\157\130\157\130\157\130\157\130\157\130\157\130\157\130\157\130\157\130\157\130\192\255\192\255\239\189\239\189\192\255\192\255\192\255\192\255\192\255\192\255\192\255\192\255\192\255\192\255\192\255\192\255\192\255\192\255\239\189\239\189\239\189\239\189\239\189\239\189\239\189\239\189\239\189\239\189\239\189\239\189\239\189\239\189\239\189\239\189\239\189")
Icon2 = image.new("\016\000\000\000\016\000\000\000\000\000\000\000 \000\000\000\016\000\001\000\024\227\024\227\024\227\024\227\024\227\024\227\024\227\024\227\024\227\024\227\024\227\024\227\024\227\024\227\024\227\024\227\024\227\157\130\157\130\157\130\157\130\157\130\157\130\157\130\157\130\157\130\157\130\157\130\157\130\157\130\157\130\024\227\024\227\000\128\000\128\000\128\000\128\000\128\000\128\000\128\000\128\000\128\000\128\000\128\000\128\000\128\000\128\024\227\024\227\157\130\157\130\157\130\157\130\157\130\157\130\157\130\000\128\157\130\157\130\157\130\157\130\157\130\157\130\024\227\024\227\157\130\157\130\157\130\157\130\157\130\157\130\157\130\000\128\157\130\157\130\157\130\157\130\157\130\157\130\024\227\024\227\157\130\157\130\157\130\157\130\157\130\157\130\157\130\000\128\157\130\157\130\157\130\157\130\157\130\157\130\024\227\024\227\157\130\000\128\000\128\000\128\000\128\000\128\000\128\000\128\000\128\000\128\000\128\000\128\000\128\157\130\024\227\024\227\157\130\157\130\157\130\157\130\157\130\157\130\157\130\000\128\157\130\157\130\157\130\157\130\157\130\157\130\024\227\024\227\157\130\157\130\157\130\157\130\157\130\157\130\157\130\000\128\157\130\157\130\157\130\157\130\157\130\157\130\024\227\024\227\157\130\157\130\157\130\157\130\157\130\157\130\157\130\000\128\157\130\157\130\157\130\157\130\157\130\157\130\024\227\024\227\157\130\157\130\157\130\157\130\157\130\000\128\000\128\000\128\000\128\000\128\157\130\157\130\157\130\157\130\024\227\024\227\157\130\157\130\157\130\157\130\000\128\000\128\157\130\000\128\157\130\000\128\000\128\157\130\157\130\157\130\024\227\024\227\157\130\157\130\157\130\000\128\000\128\157\130\157\130\000\128\157\130\157\130\000\128\000\128\157\130\157\130\024\227\024\227\157\130\000\128\000\128\000\128\157\130\157\130\157\130\000\128\157\130\157\130\157\130\000\128\000\128\157\130\024\227\024\227\000\128\000\128\157\130\157\130\157\130\157\130\157\130\000\128\157\130\157\130\157\130\157\130\000\128\000\128\024\227\024\227\024\227\024\227\024\227\024\227\024\227\024\227\024\227\024\227\024\227\024\227\024\227\024\227\024\227\024\227\024\227")
Icon3 = image.new("\016\000\000\000\016\000\000\000\000\000\000\000 \000\000\000\016\000\001\000\239\189\239\189\239\189\239\189\239\189\239\189\239\189\239\189\239\189\239\189\239\189\239\189\239\189\239\189\239\189\239\189\239\189}\207}\207}\207}\207}\207}\207}\207}\207}\207}\207}\207}\207}\207}\207\239\189\239\189}\207}\207}\207}\207}\207}\207\000\128\000\128}\207}\207}\207}\207}\207}\207\239\189\239\189}\207}\207}\207}\207}\207}\207\000\128\000\128}\207}\207}\207}\207}\207}\207\239\189\239\189}\207}\207}\207}\207}\207\000\128\192\255\192\255\000\128}\207}\207}\207}\207}\207\239\189\239\189}\207}\207}\207}\207}\207\000\128\192\255\192\255\000\128}\207}\207}\207}\207}\207\239\189\239\189}\207}\207}\207}\207\000\128\192\255d\244d\244\192\255\000\128}\207}\207}\207}\207\239\189\239\189}\207}\207}\207}\207\000\128\192\255d\244d\244\192\255\000\128}\207}\207}\207}\207\239\189\239\189}\207}\207}\207\000\128\192\255\192\255d\244d\244\192\255\192\255\000\128}\207}\207}\207\239\189\239\189}\207}\207}\207\000\128\192\255\192\255d\244d\244\192\255\192\255\000\128}\207}\207}\207\239\189\239\189}\207}\207\000\128\192\255\192\255\192\255d\244d\244\192\255\192\255\192\255\000\128}\207}\207\239\189\239\189}\207}\207\000\128\192\255\192\255\192\255\192\255\192\255\192\255\192\255\192\255\000\128}\207}\207\239\189\239\189}\207\000\128\192\255\192\255\192\255\192\255d\244d\244\192\255\192\255\192\255\192\255\000\128}\207\239\189\239\189}\207\000\128\192\255\192\255\192\255\192\255d\244d\244\192\255\192\255\192\255\192\255\000\128}\207\239\189\239\189\000\128\000\128\000\128\000\128\000\128\000\128\000\128\000\128\000\128\000\128\000\128\000\128\000\128\000\128\239\189\239\189\239\189\239\189\239\189\239\189\239\189\239\189\239\189\239\189\239\189\239\189\239\189\239\189\239\189\239\189\239\189")

              Tabs = {atab = {text = "Tab1", selected = true, controls = {}, x = 0, y = 0},
btab = {text = "Tab2", selected = false, controls = {}, x = 0, y = 0},
ctab = {text = "Tab3", selected = false, controls = {}, x = 0, y = 0},
dtab = {text = "Tab4", selected = false, controls = {}, x = 0, y = 0}}
              wndIX = form(1, 1, 160, 160, true, "Title", color.white, color.brickred, true, false, false)
mpics = { Icon1, Icon2, Icon3}
mlbls = { "Icon1", "Icon2", "Icon3"}
pcb = pb(1, 1, 16, 16, mlbls, mpics, color.red, 3, lblsys, wndIX, false)
btn1 = button( "Tst", 20, 20, clickFabove, color.white, color.Bcontrol, wndIX)
lbl1 = lable(150, 100, "WZGUIlib", 6, color.red, wndIX)
ud = NumericUD(3, 3, 5, color.black, 25, -20, color.black, color.black, wndIX, true)
chk1 = checkbox(1, 1, "Checkbox 1", true, color.Bdark, color.green, color.black, wndIX)
chk2 = checkbox(1, 14, "Checkbox 2", false, color.Bdark, color.green, color.black, wndIX)
chk3 = checkbox(1, 26, "Checkbox 3", true, color.Bdark, color.green, color.black, wndIX)
rdb1 = radioButton("RDB 1", 1, 38, true, color.Bdark, color.green, color.red, wndIX)
rdb2 = radioButton("RDB 2", 1, 50, false, color.Bdark, color.green, color.red, wndIX)
rdb3 = radioButton("RDB 3", 1, 62, false, color.Bdark, color.green, color.red, wndIX)
textbox1 = textbox(3, 3, "", color.black, color.black, wndIX, true)
tbc = tabcontrol(15, 15, 105, 30, Tabs, wndIX)
The icons are some quick images i made for testing the new form stuff, they arent important
Title: Re: Updating WZGUILib
Post by: jwalker on April 16, 2012, 11:22:55 am
Yesterday i stoped work on the this version to try and port the form control to prizm C, since it worked prety well i will continue with the prizm C version AFTER the release of v3. I will continue working on this version today
Title: Re: Updating WZGUILib
Post by: jwalker on April 28, 2012, 10:53:34 am
Ok, how would I call the make.bat in the prizm-0.3 sdk in a C# program?
I will be porting WZGUILIB to prizm C so I'm writing some tools for myself, also im trying to boost my C# skills :p
Title: Re: Updating WZGUILib
Post by: DJ Omnimaga on April 28, 2012, 01:14:57 pm
You might want to ask here instead: http://www.omnimaga.org/index.php?board=146.0

Since your question is PRIZM-related, you will get more answers there.
Title: Re: Updating WZGUILib
Post by: jwalker on April 28, 2012, 09:57:02 pm
Thats ok, I think I have it figured out
Title: Re: Updating WZGUILib
Post by: jwalker on May 07, 2012, 07:03:24 pm
Ok, So here is what is going on
I have to move back the project just a little bit,
1. Ti-Nspire 3.2 doesnt come out until june
2. Finals are comming up next week
3. I am having about 3 track meets a weak, so i dont have a lot of time

Expect a release sometime in june
I also may release a small beta release soon on this thread to show what i have done
Title: Re: Updating WZGUILib
Post by: jwalker on May 23, 2012, 04:30:16 pm
here is textbox V3 beta with smooth scrolling
im also going to add a maxChar property and will have the ability to actualy edit the textbox without having to backspace and loose everything
after this is complete i will also add passwordChar and multiline
just insert the code where the old textbox class was
i will also add more to this class as the day goes on.
Code: [Select]
----------------------textbox-------------------------------------------

textbox = class()

function textbox:init(x, y, width, text, textcolor, tbcolor, parent, selected)
self.parent = parent
self.x = x + parent.x
self.y = y + parent.y
self.xoff = x
self.yoff = y
self.width = width
if self.width < 10 then
self.width = 10
end
self.height = 11
self.text = text
self.textcolor = textcolor
self.tbcolor = tbcolor
self.selected = selected
self.cury = self.y + 1
self.curx = self.x + 1
self.curh = (self.y + self.height) - 1
self.parent = parent
self.type = "txt"
self.stwid = 0

self.dIndex = 1
self.initial = true
self.bsflag = false


table.insert(parent.controls, self)
end
function textbox:paint(gc)

self.stwid = gc:getStringWidth(self.text)

if self.initial == true then
local dtext = self.text
while gc:getStringWidth(dtext) >= self.width - 1 do
dtext = string.sub(dtext, 2)
end
self.initial = false
self.dIndex = string.find(self.text, dtext)
else
while gc:getStringWidth(string.sub(self.text, self.dIndex)) >= self.width and self.bsflag == false do
self.dIndex = self.dIndex + 1
self.dText = string.sub(self.text, self.dIndex)
end
if self.bsflag == true then
self.text = string.sub(self.text, 1, string.len(self.text) - 1)
if string.len(self.text) > string.len(string.sub(self.text, self.dIndex)) then
self.dIndex = self.dIndex - 1
while gc:getStringWidth(string.sub(self.text, self.dIndex)) >= self.width do
self.dIndex = self.dIndex + 1
self.dText = string.sub(self.text, self.dIndex)
end
end
end
end
self.bsflag = false

gc:setColorRGB(unpack(self.tbcolor))
gc:drawRect( self.x, self.y, self.width + 3, self.height)
gc:setColorRGB(unpack(self.textcolor))
gc:setFont("sansserif", "r", 8)
self.stwid =
gc:drawString( string.sub(self.text, self.dIndex), self.x + 4, self.y + 3, "middle")
gc:setColorRGB(unpack(color.black))
self.cury = self.y + 1
self.curx = self.x + gc:getStringWidth(string.sub(self.text, self.dIndex)) + 3
self.curh = (self.y + self.height) - 1
gc:drawLine(self.curx, self.cury, self.curx, self.curh)
end
function textbox:charIn(ch)
if self.selected then
self.text = self.text..ch
end
platform.window:invalidate(self.x, self.y, self.width + 2, self.height)
end
function textbox:backspaceKey()
self.bsflag = true
platform.window:invalidate(self.x, self.y, self.width + 2, self.height)
end

function textbox:click()
if self.selected then
self.selected = false
else
for _, tb in pairs(self.parent.controls) do
if tb.type == "txt" then
tb.selected = false
end
end
self.selected = true
end
end
function textbox:checkClick(x, y)
if y >= self.y and y <= self.y + self.height and x >= self.x and x <= self.x + self.width then
self:click()
end
end

an example:
wndIX = form(1, 1, 160, 160, true, "Title", color.white, color.brickred, true, false, false)
tb1 = textbox(3, 3, 100, "Hello Omnimaga, i now scroll smoothly!", color.black, color.black, wndIX, false)
Title: Re: Updating WZGUILib
Post by: jwalker on May 27, 2012, 05:53:07 pm
Just a general update: The textbox is almost complete but i need an idea on how to start out the track bar.
Title: Re: Updating WZGUILib
Post by: jwalker on May 30, 2012, 12:08:11 am
Since creation of tables for menu bars and tabs are hard and tedious, i decided to write a tool in java to make it simpler.
As of right now only part of it works (the tab creation part) because that is the time ive had.
Once this tool is complete I will distribute it with all new versions of WZGUILIB.
It works on Windows and it should work on Mac and Linux, but I dont know for sure since i dont have any of those operating systems.

This will generate a tabData.lua file in the directory of the jar file.
If you have questions just ask
Title: Re: Updating WZGUILib
Post by: jwalker on June 01, 2012, 11:31:02 am
I thought I would leak the dev version of 3.1, there isnt alot of new stuff, but trust me, there is more coming!!
dont worry about all of the stuff in the on.create method, in fact you could uncomment most of the stuff and it would all work
also even though it says wzpack_3d, there isnt much 3d, i ended up doing most of my testing there
Title: Re: Updating WZGUILib
Post by: Jim Bauwens on June 01, 2012, 11:32:58 am
Nice to see there is still progress :)
Also, 3.2 should be out in 1-2 weeks.
Title: Re: Updating WZGUILib
Post by: jwalker on June 01, 2012, 11:59:56 am
well that is good to know, i will have make this 3.2 friendly and get all of the other things done that I want done
Title: Re: Updating WZGUILib
Post by: jwalker on June 04, 2012, 02:07:54 pm
So I had an Idea...
As of right now to create a control and add it to a window you have to do this:
form1 = form(....)
child1= control(..., form1) -- form 1 is the parent control
I am thinking about change this to:
form1 = form(....)
child1 = control(...)
form1.addChild(child1)
where you can also do this:
form1.addChild(control(.....))
Title: Re: Updating WZGUILib
Post by: Nick on June 04, 2012, 02:26:15 pm
does that mean yo udon't need any form anymore and still be able to use all of the controls? that would be useful..

and i still haven't seen any examples that i can just copy-paste to the emulator without changing a thing. those examples are the most easy ones to learn from, since in the last examples i had to change some thing, and i really didn't know why
Title: Re: Updating WZGUILib
Post by: jwalker on June 04, 2012, 06:59:43 pm
hmm maybe you were using a diffrent version...
any way i posted a dev version of wz in this post:
I thought I would leak the dev version of 3.1, there isnt alot of new stuff, but trust me, there is more coming!!
dont worry about all of the stuff in the on.create method, in fact you could uncomment most of the stuff and it would all work
also even though it says wzpack_3d, there isnt much 3d, i ended up doing most of my testing there

Also make sure you paste the examples that I post in the on.create event

Download this lua file, and then tell me the controls you would like to have examples on.

Also with the new release I will have a "Programming with WZGUILIB" document to explain the controls in depth and tell how to make your own.

to answer your first question:
I may add a "NO_FRAME" flag that would emulate having no forms which would require no moding, OR I could try to make a way for you to do that that would allow you to have the same functionality as a form, but it would not even use a form.
either way I will work on it and pm you or post a solution, it shouldnt be that hard.

Also I did make a drawable trackbar that accepts events but it just dosent do anything usefull yet.
Title: Re: Updating WZGUILib
Post by: jwalker on June 05, 2012, 11:59:57 am
So I decided to make the examples, so here they are:
**Notice: I only provided examples for the controls that came with WZGUILIB 2.1, BUT these controls use the WZGUILIB 3.0 test version, which I included.

Once in the test version, delete all of the code inside of the on.create event and paste this code:
Code: [Select]
Icon1 = image.new("\012\000\000\000\012\000\000\000\000\000\000\000\024\000\000\000\016\000\001\000\014\194\014\194\014\194\014\194\014\194\014\194\014\194\014\194\014\194\014\194\014\194\014\194\014\194\192\255\228\247\228\247\228\247\228\247\228\247\228\247\228\247\228\247\192\255\014\194\014\194\192\255\213\162\157\130\157\130\157\130\157\130\157\130\157\130\213\162\192\255\014\194\014\194\192\255\192\255\192\255\192\255\213\162\213\162\192\255\192\255\192\255\192\255\014\194\014\194\192\255\192\255\192\255\192\255\213\162\213\162\192\255\192\255\192\255\192\255\014\194\014\194\192\255\192\255\192\255\192\255\213\162\213\162\192\255\192\255\192\255\192\255\014\194\014\194\192\255\192\255\192\255\192\255\213\162\213\162\192\255\192\255\192\255\192\255\014\194\014\194\192\255\192\255\192\255\192\255\213\162\213\162\192\255\192\255\192\255\192\255\014\194\014\194\192\255\192\255\192\255\192\255\213\162\213\162\192\255\192\255\192\255\192\255\014\194\014\194\192\255\213\162\157\130\157\130\157\130\157\130\157\130\157\130\213\162\192\255\014\194\014\194\192\255\228\247\228\247\228\247\228\247\228\247\228\247\228\247\228\247\192\255\014\194\014\194\014\194\014\194\014\194\014\194\014\194\014\194\014\194\014\194\014\194\014\194\014\194")
Icon2 = image.new("\012\000\000\000\012\000\000\000\000\000\000\000\024\000\000\000\016\000\001\000\014\194\014\194\014\194\014\194\014\194\014\194\014\194\014\194\014\194\014\194\014\194\014\194\014\194\000\128\000\128\000\128\000\128\000\128\000\128\000\128\000\128\000\128\000\128\014\194\014\194\157\130\157\130\157\130\157\130\157\130\000\128\157\130\157\130\157\130\157\130\014\194\014\194\157\130\157\130\157\130\157\130\157\130\000\128\157\130\157\130\157\130\157\130\014\194\014\194\157\130\000\128\000\128\000\128\000\128\000\128\000\128\000\128\000\128\157\130\014\194\014\194\157\130\157\130\157\130\157\130\157\130\000\128\157\130\157\130\157\130\157\130\014\194\014\194\157\130\157\130\157\130\157\130\157\130\000\128\157\130\157\130\157\130\157\130\014\194\014\194\157\130\157\130\157\130\157\130\000\128\000\128\000\128\157\130\157\130\157\130\014\194\014\194\157\130\157\130\157\130\000\128\000\128\000\128\000\128\000\128\157\130\157\130\014\194\014\194\157\130\157\130\000\128\000\128\157\130\000\128\157\130\000\128\000\128\157\130\014\194\014\194\000\128\000\128\000\128\157\130\157\130\000\128\157\130\157\130\000\128\000\128\014\194\014\194\014\194\014\194\014\194\014\194\014\194\014\194\014\194\014\194\014\194\014\194\014\194")
Icon3 = image.new("\012\000\000\000\012\000\000\000\000\000\000\000\024\000\000\000\016\000\001\000\016\194\016\194\016\194\016\194\016\194\016\194\016\194\016\194\016\194\016\194\016\194\016\194\016\194}\207}\207}\207}\207\000\128\000\128}\207}\207}\207}\207\016\194\016\194}\207}\207}\207}\207\000\128\000\128}\207}\207}\207}\207\016\194\016\194}\207}\207}\207\000\128`\255`\255\000\128}\207}\207}\207\016\194\016\194}\207}\207\000\128`\255\000\188\000\188`\255\000\128}\207}\207\016\194\016\194}\207}\207\000\128`\255\000\188\000\188`\255\000\128}\207}\207\016\194\016\194}\207}\207\000\128\192\255\000\188\000\188`\255\000\128}\207}\207\016\194\016\194}\207\000\128\000\128\192\255\000\188\000\188`\255\000\128\000\128}\207\016\194\016\194}\207\000\128`\255`\255`\255`\255`\255`\255\000\128}\207\016\194\016\194\000\128`\255`\255`\255\000\188\000\188`\255`\255`\255\000\128\016\194\016\194\000\128`\255`\255`\255\000\188\000\188`\255`\255`\255\000\128\016\194\016\194\016\194\016\194\016\194\016\194\016\194\016\194\016\194\016\194\016\194\016\194\016\194")

Tabs = {atab = {text = "Tab1", selected = true, controls = {}, x = 0, y = 0},
btab = {text = "Tab2", selected = false, controls = {}, x = 0, y = 0},
ctab = {text = "Tab3", selected = false, controls = {}, x = 0, y = 0},
dtab = {text = "Tab4", selected = false, controls = {}, x = 0, y = 0}}


lableT = {"l1", "l2", "l3"}
picT = {Icon1, Icon2, Icon3}

--This is the form class: Params x, y, width, height, fullscreen, title, title color, title bar and frame color, is drawn, has context menu, c.m. table, has status bar, has icon, icon img
form1 = form(1, 1, 160, 160, true, "Title", color.white, color.brickred, true, false, false, true, true, Icon1)

--This is the tabcontrol class: Params x, y, width, height, tab table, parent
tabControl1 = tabcontrol(10, 15, 110, 50, Tabs, form1)

--This is the textbox class: Params x, y, width, text, text color, textbox color, parent, is selected
textbox1 = textbox(10, 70, 100, "Hello World", color.black, color.black, form1, false)

--this is the button class: Params text, x, y, action, text color, bg color, parent
button1 = button("BTN1", 4, 4, btnClick, color.black, color.Bcontrol, Tabs.atab)--could also be tabControl1.tabcollection.atab

--this is the lable class: Params x, y, text, text size, color, parent
lable1 = lable(1, 2, "BTN1 not clicked ever!", 7, color.black, Tabs.btab)

--this is the radioButton class: Params text, x, y, marked, back color, mark color, text color, parent
rdb1 = radioButton("rdb1", 2, 2, true, color.Bcontrol, color.green, color.black, Tabs.ctab)
rdb2 = radioButton("rdb2", 2, 14, false, color.Bcontrol, color.green, color.black, Tabs.ctab)

--this is the Checkbox class: Params x, y, text, checked, back color, check color, text color, parent
checkbox1 = checkbox(2, 2, "Checkbox1", true, color.Bcontrol, color.red, color.black, Tabs.dtab)
checkbox2 = checkbox(2, 14,"Checkbox2", true, color.Bcontrol, color.red, color.black, Tabs.dtab)

--this is the Picture box class: Params x, y, width, height, label table, picture table, text color, index, lable name, parent, selected
picturebox1 = pb(130, 15, 20, 20, lableT, picT, color.red, 1, lblmm, form1, false)

--this is the numeric updown class: Params x, y, curent number, line color, maximum number, minimum number, text color, plus minus color, parent, selected
numericUPDown1 = NumericUD(10, 130, 10, color.black, 25, -1, color.black, color.black, form1, false)

--this is the dialog class: Params x, y, text, title, back color, text color, is drawn, parent, selected
dialog1 = dialog(10, 10, "Dialog1 is right here~secondline", "Dialog1", color.brickred, color.black, false, form1, false)
Then underneath the "end" of the on.create event paste this code:
Code: [Select]
function btnClick()
lable1.text = "Button has been clicked!"
picturebox1:nextpic()
if checkbox1.checked and checkbox2.checked and rdb2.marked then
dialog1.isdrawn = true
end
I()
end

If this doesnt work, Tell me.
The file I included is the one that I mentioned in the above post, I just cut all of the junk from the on.create event and the two unneeded functions from underneath the on.create event
Title: Re: Updating WZGUILib
Post by: jwalker on June 12, 2012, 03:15:54 pm
So after I found out that os 3.2 seems to draw things out diffrently than the os's < 3.2. Well I guess that the light at the end of the tunnel is that I can add some new stuff to the current controls.
Title: Re: Updating WZGUILib
Post by: Adriweb on June 12, 2012, 04:38:15 pm
Well, for 99% if you coded it "clean" (using official API etc. and not platform.gc() which we discouraged using :P), it would be fine for 3.2.
Basically a on.create() to change into on.construction()

What problems do you have with 3.2 now with your library ?
Title: Re: Updating WZGUILib
Post by: jwalker on June 12, 2012, 07:12:29 pm
not realy, some of the strings dont draw out in the same place as they used to. All I did was change on.create to on.construction in the "UseThisFile.lua" file I uploaded and I got rid of platform.gc() along time ago, but that is ok because it gives me a real good reason to go back and change the looks of some controls.
Title: Re: Updating WZGUILib
Post by: Adriweb on June 12, 2012, 08:06:51 pm
OK, well if you have any issue, tell us :P
Title: Re: Updating WZGUILib
Post by: jwalker on June 12, 2012, 08:09:06 pm
yea, I will.
Also it seems to be with the third paramater of the gc:drawString function
Title: Re: Updating WZGUILib
Post by: jwalker on June 17, 2012, 10:56:53 am
I just thought I would post what it looks like when you change the on.create to on.construction on the "UseThisFile.lua" file that I had provided above and run it in 3.2...

What this means is that if I want to still have 3.1 compatibility, I will have to have diffrent drawing code, at least for strings.
Title: Re: Updating WZGUILib
Post by: Adriweb on June 17, 2012, 06:27:55 pm
That doesnt sound right. I don't see why drawing-related stuff would get changed... ?
Can you post the full code, I'll be helping you :P
(Edit:  or is it directly the UseThisFile.lua ? )
Title: Re: Updating WZGUILib
Post by: jwalker on June 17, 2012, 07:20:30 pm
It is Directly using the UseThisFile.lua file that that is located in page 7, I just changed on.create to on.construction
Title: Re: Updating WZGUILib
Post by: Jim Bauwens on June 18, 2012, 02:18:47 am
Is the problem related to the "middle" in [lua]gc:drawString[/lua] you used, or did you not use anything before ?

(I recommend you to use "top". I have no problems in 3.1/3.2 with it, as it's the most accurate argument)
Title: Re: Updating WZGUILib
Post by: Adriweb on June 18, 2012, 07:20:40 am
I just put that up on Inspired-Lua's [lua]gc:drawString[/lua] :

(http://i.imgur.com/CrXwR.gif)
Title: Re: Updating WZGUILib
Post by: jwalker on June 18, 2012, 09:00:25 am
the problem is related to middle, thanks for the help
Title: Re: Updating WZGUILib
Post by: jwalker on June 21, 2012, 08:06:00 pm
So I have an Idea that could change the way WZGUILIB operates and can be used forever, if it works. I will keep you posted.
Title: Re: Updating WZGUILib
Post by: jwalker on June 27, 2012, 10:43:51 am
So I solved the Idea for styles. I believe that I can store all of the paint, checkClick, click, and other methods that deal with how they are drawn and interacted with by the user. What this would allow is having multiple styles on one calculator without having to take up a large amount of space. It also would allow the programmer change between styles in the middle of the program by calling the function loadLibs(). The libs would be loaded at runtime after the creation of the objects and will load only one time unless the programmer calls loadLibs() later on.
I do have a questions though before I jump in and start changing code.
How much does var.recall fail when trying to get external data.

Also I did some testing with loading strings into lua strings and I ran into a problem. The Document that I created I put a string in it, but it wont load. I then used a file that came with Make3D_lib and it loaded the strings successfully. I used one lua file that I created to do this. Did levak do something diffrent than what I did to get his stuff to load properly?
I included the files.
Title: Re: Updating WZGUILib
Post by: jwalker on June 27, 2012, 11:32:47 pm
So I got the strings to load successfully, but I have another problem.
When you use assert() to run the lua chunck, how can you use the variables that already exist?
I get an error that global gc has been indexed so I know something isnt working.
I included the files that I have created in order to test this stuff out.
Title: Re: Updating WZGUILib
Post by: Jim Bauwens on June 28, 2012, 05:11:36 pm
Normally if you execute a new lua chunk it should be able to access all the existing variables.
I'll take a look at your code tomorrow.
Title: Re: Updating WZGUILib
Post by: jwalker on June 28, 2012, 08:08:49 pm
thanks, maybe its a student software bug?
Title: Re: Updating WZGUILib
Post by: Jim Bauwens on June 29, 2012, 05:01:49 am
Quote
I get an error that global gc has been indexed so I know something isnt working.

Something like, "Attempt to index nil value gc" ?
Well, maybe you just forgot to add gc to the function parameter ?

Edit:
BTW, assert doesn't run a Lua chunk/function. It just checks that it's not nil. So you would need to do assert(chunkname, "chunk is nil")()
Title: Re: Updating WZGUILib
Post by: jwalker on June 29, 2012, 11:02:17 am
yea I get that error, and the example you have shown is how I have it in my code.
It runs the string from on.paint, so I didnt forget gc.
I have also ran the string like this:
loadstring(string)()
and
func = loadstring(string)
func()
I also tried passing gc to each of those things and it failed

Also I have attatched the new files
Title: Re: Updating WZGUILib
Post by: someone on June 29, 2012, 02:33:30 pm
Seems like the problem is on the function "string.sub". It might not be loading it when you open the file or something.
Title: Re: Updating WZGUILib
Post by: jwalker on June 29, 2012, 03:48:43 pm
No, I only use string.sub to display the end part of the error message created by pcall()
Title: Re: Updating WZGUILib
Post by: jwalker on June 29, 2012, 08:23:54 pm
Even though this is kind of a double post, I think we may have stumbled on to a Ti-Nspire Lua bug...
Say you create a class outside of the string you want to load, or even try to use gc, it will always say that that variable is nil
I even tried this:

********************This is the main lua script
Code: [Select]
ccsb = class()
function ccsb:init(x, y, zs)
    self.x = x
    self.y = y
    self.zs = zs
end
function ccsb:paint(gc)
    local Wself = self
    local Wgc = gc
    loadstring(painter)()
end
---
function loadLibs()
    painter = var.recall("WZEX_lib\\s__paint__")
end
function on.construction()
    ss = ccsb(1, 1, "This is the main string")
    loadLibs()
end
function on.paint(gc)
    ss:paint(gc)
end
function on.charIn(ch)
    platform.window:invalidate()
end
*******************this is inside of the WZEX_lib.tns file
Code: [Select]
"local WZself = Wself
local WZgc = Wgc
WZself.x = WZself.x + 10
WZself.y = WZself.y + 10
WZgc:drawString(WZself.zs, WZself.x, WZself.y, ""top"")"

Even though I tried to use a variable to point to the object as you can see, it is still considered nil inside of the loaded string.
Anything you are not trying to index will be created/modified like normal.
I have attatched the files.
Title: Re: Updating WZGUILib
Post by: jwalker on July 02, 2012, 02:20:50 pm
well i got a responce from the TI technical support, a very nice email telling me that Lua scripting is not supported at this time.
Title: Re: Updating WZGUILib
Post by: Jim Bauwens on July 02, 2012, 02:52:35 pm
Lol :P

Can you try to see if making Wself and Wgc global if it works then. Just to see.
Also, it will not be Nspire specific as the class function is just a lua function.
Title: Re: Updating WZGUILib
Post by: jwalker on July 02, 2012, 03:17:58 pm
true, I will have to try it and post my results.

EDIT: that works, I wish there was a better way to do it tho...
Title: Re: Updating WZGUILib
Post by: Jim Bauwens on July 02, 2012, 03:26:15 pm
Alright, now try to directly  run loadstring in loadlibs.
painter = loadstring(painter).
And then use painter() instead of loadstring everywhere.
It might be because you create a new Lua chunk Lua doesn't allow you to access the local variables there.

Edit: also local the variables again
Title: Re: Updating WZGUILib
Post by: jwalker on July 02, 2012, 03:54:32 pm
It didn't work. The second I make Wgc or Wself local it will give me the 'attempt to index a local 'Wgc/Wself' a nil value' error

EDIT: I changed some code in the WZEX_lib file to this: Wgc:drawString(Wself.zs, Wself.x, Wself.y, "top") and I got an error about indexing Global Wgc, even though there is a local Wgc. It seems to be looking for globals only.
Title: Re: Updating WZGUILib
Post by: Jim Bauwens on July 02, 2012, 06:21:30 pm
Try this in the string you load:
local Wself, Wgc=...
And this in your normal code:
painter(self, gc) (painter is loadstrings result)
Title: Re: Updating WZGUILib
Post by: jwalker on July 02, 2012, 07:10:15 pm
that works.
thanks jim
Title: Re: Updating WZGUILib
Post by: Jim Bauwens on July 03, 2012, 06:48:02 am
Glad that works. The problem why you can't access the local variables is because the chunk is different from a real function. Another solution would have been to define a function inside the string, and then call that function. But anyway, this is more clean.
Title: Re: Updating WZGUILib
Post by: jwalker on July 05, 2012, 11:13:02 pm
So just a general update.
First I am going to start changing WZGUILIB to use the new lib system.
Second I have started making the 'Programming with WZGUILIB' documentation. It will be written in HTML. I'm using web matrix, but I think as long as I dont do any asp.net stuff it should work on all of the other OS's
Title: Re: Updating WZGUILib
Post by: jwalker on July 09, 2012, 08:26:27 pm
Ive got some bugfixes for you.
I found them in the lable and dialog multiline drawing code.
Here is the file, it shows the work I have done so far, as you can see I have changed the looks of a few controls, mainly I just resized them.
Title: Re: Updating WZGUILib
Post by: Jim Bauwens on July 11, 2012, 04:24:57 am
Tried it, looks nice :)
However, maybe the graphics are a bit too small ?
Title: Re: Updating WZGUILib
Post by: jwalker on July 12, 2012, 12:29:12 am
They are, what Im trying to do is get them just right, so they arent to big, and they arent too small. They have to be just the right size so they can fit in areas other than just forms. I think if I make them just a little bit bigger it might be the right size.
Title: Re: Updating WZGUILib
Post by: jwalker on July 15, 2012, 12:13:37 pm
So I had a thought about something that I may do.
I havent realy been able to test out the style system that I proposed, although today I may get Time, but this idea could go hand in hand with it.
What I was thinking about doing was hidding the main events that drive WZ (on.click, on.paint, etc...), and do this instead:
Code: [Select]
  --create a window in on.create, which will still be 'visible' to the user
  window = form(...)
 
  --then after on.create we would have the new 'events'
  window_paint(gc)
  window_click(x, y)--where x and y is the location of the pixel in the forms body
  window_etc.....
all controls would also work similar, so it is kind of like VB.net, or C#.
I thought that this could be released in a WZGUILIB_EventDriven stylepack, or maybe it could be integrated into all WZ versions, although that would be a more radical aproach.
Title: Re: Updating WZGUILib
Post by: jwalker on July 15, 2012, 05:37:11 pm
Excuse my double post...
I am happy to announce that I hav successfully got the 'lib' system to work.
Currently, I have only moved the paint code to the lib, but I will move the rest later.
This is a proof of concept release, it is a v3 development version.
I tested these two files on both the computer and my old light blue greyscale nspire.
What this could allow is:
  Easily create styles for WZGUILIB.
  Easily switch styles durring execution.
  Editing how the GUI objects look and work on calc (great for me and style developers).
  Allow multiple styles on one calc without having to have several diffrent versions of WZGUILIB.
  *Allow to only have some class code loaded.

Questions and comments are definately welcome

**********************How to set up**********************
send both files to your calc
place WZ_ST_LIB.tns inot your MyLib folder
Refresh your libraries
execute WZ_LibTST

*I havnt yet implemented it.
Title: Re: Updating WZGUILib
Post by: jwalker on July 17, 2012, 08:28:20 pm
Does anyone know the best way to implement scroll bars? I was thinking about how to do it, but im not quite sure how to calculate when the scroll bars gets larger and smaller depending on what is in the scrollable area.
Also for those who tried the dev release/preview, what did you think about the toggle switch, if you noticed it?
Title: Re: Updating WZGUILib
Post by: Jim Bauwens on July 18, 2012, 10:05:25 am
Sorry for the late reply.

]
So I had a thought about something that I may do.
I havent realy been able to test out the style system that I proposed, although today I may get Time, but this idea could go hand in hand with it.
What I was thinking about doing was hidding the main events that drive WZ (on.click, on.paint, etc...), and do this instead:
Code: [Select]
 --create a window in on.create, which will still be 'visible' to the user
  window = form(...)
  
  --then after on.create we would have the new 'events'
  window_paint(gc)
  window_click(x, y)--where x and y is the location of the pixel in the forms body
  window_etc.....
all controls would also work similar, so it is kind of like VB.net, or C#.
I thought that this could be released in a WZGUILIB_EventDriven stylepack, or maybe it could be integrated into all WZ versions, although that would be a more radical aproach.

Well, I think you want is a 'screen manager' (well, that's what certain Lua coders call it).
Here is the code for a very simple one: (warning, not tested might contain a bug)
Code: [Select]

--Screen manager code

screens = {}

function current_screen()
    return screens[#screens]
end

function push_screen(screen)
    table.insert(screens, screen)
    platform.window:invalidate()
end

function pull_screen()
    platform.window:invalidate()
    return table.remove(screens)
end

Screen = class()

function Screen:paint() end
function Screen:arrowKey() end
function Screen:enterKey() end

function on.paint(gc)
    for _, screen in ipairs(screens) do
        screen:paint(gc)
    end
end

function on.arrowKey(arrow) current_screen():arrowKey(arrow) end
function on.enterKey() current_screen():enterKey() end

-- User code

main = Screen()

function main:paint(gc)
    gc:drawString("Hello World", 10, 10, "top")
end

function main:enterKey()
    push_screen(sub)
end

sub = Screen()

function sub:paint(gc)
    gc:fillRect(10,10,20,20)
end

function sub:enterKey()
    pull_screen()
end

push_screen(main)

Take a look at this tutorial too: http://www.inspired-lua.org/2012/02/how-to-create-a-screen-manager/
And if you want at https://github.com/adriweb/EEPro-for-Nspire/tree/master/Global%20Libraries (screen.lua and widgets.lua) for example of a real life implementation.

Does anyone know the best way to implement scroll bars? I was thinking about how to do it, but im not quite sure how to calculate when the scroll bars gets larger and smaller depending on what is in the scrollable area.
Also for those who tried the dev release/preview, what did you think about the toggle switch, if you noticed it?

Regarding the scrollbar, check out my implementation of it in widgets.lua (in the above link). Basically, I have three parameters for my scroll bar.
total: the amount of lines/whatever I need to scroll
visible: the amount of lines/whatever that you can see
top: the current line/whatever that you are on.

With this information I easily can calculate how to draw my scrollbar.

I haven'y noticed the toggle switch.
Title: Re: Updating WZGUILib
Post by: jwalker on July 18, 2012, 12:57:27 pm
I all ready implement a screen manager, it just looks a little diffrent from yours because it considers every form a screen, and has to switch between the forms.
What I mean is that say I have something like form:paint(gc), which is already there, everytime it is called to repaint the form, it would call something like form1_paint(gc), giving WZ its own 'events'.
The toggle switch is on the very bottom of the class definitions in the last file that I uploaded, I have some creation code commented out.
It looks like:
Code: [Select]
    --toggle test 0.1
    --t1 = toggle(50, 100, true, form1)
    --t2 = toggle(1, 1, false, Tabs.atab)

thanks for the link to your scrollbars class, I think it will help.
Title: Re: Updating WZGUILib
Post by: jwalker on July 21, 2012, 12:28:37 am
So today I came home after work and decided to take a look at what WZGUILIB might look like in C, for use on the prizm, and I definately think that porting it wont be that difficult. But I ran into a problem....
My Prizm emulator trial ran out and I dont want to ruin my prizm.
So as an effect of that, I will be writting out the first C version in Nspire C :), and once school starts I will download the prizm emulator on one of the schools computers and directly port WZ to the prizm. The WZ headers them selves will have barely any platform specific code in them, so I can easily port it.
The only problem right now is.... nRGBLib draws out its chars way to large, in the image, the title is bieng drawn out at a size of 1.
 I only drew out the body, frame and title of the form, as you can see. It will have the two circle buttons in the end.
Title: Re: Updating WZGUILib
Post by: Adriweb on July 21, 2012, 02:58:18 am
Well that's a very nice idea :D
Title: Re: Updating WZGUILib
Post by: jwalker on July 21, 2012, 09:41:12 pm
thank you
Title: Re: Updating WZGUILib
Post by: Nick on July 22, 2012, 05:18:49 am
imo the title isn't toooooo big, is it? i think it fits fine, it does not overflow the area, so that's good enough i think..

it's nice to see the progress, i just can't test your latest versions because i'm staying at OS 3.1 for  ndless reasons
Title: Re: Updating WZGUILib
Post by: jwalker on July 22, 2012, 12:38:53 pm
Thats what Im doing with my CX, and I added the files to the bottom :).
The WZ_ST_LIB should work on all versions.

Excuse my double post...
I am happy to announce that I hav successfully got the 'lib' system to work.
Currently, I have only moved the paint code to the lib, but I will move the rest later.
This is a proof of concept release, it is a v3 development version.
I tested these two files on both the computer and my old light blue greyscale nspire.
What this could allow is:
  Easily create styles for WZGUILIB.
  Easily switch styles durring execution.
  Editing how the GUI objects look and work on calc (great for me and style developers).
  Allow multiple styles on one calc without having to have several diffrent versions of WZGUILIB.
  *Allow to only have some class code loaded.

Questions and comments are definately welcome

**********************How to set up**********************
send both files to your calc
place WZ_ST_LIB.tns inot your MyLib folder
Refresh your libraries
execute WZ_LibTST

*I havnt yet implemented it.
the setup instructions are at the bottome
Title: Re: Updating WZGUILib
Post by: Nick on July 22, 2012, 05:23:06 pm
that's what i did, and it tells me this:

"You must update your software to the latest version to view this document.
WZ_LibTST.tns.
Visit education.ti.com to update."

so i guess that's because of the os
Title: Re: Updating WZGUILib
Post by: jwalker on July 22, 2012, 06:06:28 pm
ok, I know whats going on....
I think the problem is that it is trying to open the WZ_ST_LIB.tns file to read the variables, because the lua script that I just posted should work on all versions.
So here is what You will have to do, to have 'Styles' and the dynamicaly loaded strings.
Make a new file called WZ_ST_LIB.tns (this way you dont have to change anything in the WZ_LibTST lua file) and paste the code snipits into it from the file that I provided.

I divided each one out with: ------------------------------------------name of control----------------------------------------------

copy everything into the file and then press enter, this way the variable is created, and do the same for all variables.

This is also how it would work with any style that some one may develop, the variable names would remain the same but the drawing code may be diffrent and the name of the library may be diffrent.

Also feel free to mess around with the drawing code, in the future I will make sure to include this file, and a file that works with <=3.2 calcs.
Also in the future I will add all some of the event code, because if you made a rounded window, you cant check the click the same as you would with a standard window
Title: Re: Updating WZGUILib
Post by: DJ Omnimaga on July 22, 2012, 06:18:04 pm
So today I came home after work and decided to take a look at what WZGUILIB might look like in C, for use on the prizm, and I definately think that porting it wont be that difficult. But I ran into a problem....
My Prizm emulator trial ran out and I dont want to ruin my prizm.
So as an effect of that, I will be writting out the first C version in Nspire C :), and once school starts I will download the prizm emulator on one of the schools computers and directly port WZ to the prizm. The WZ headers them selves will have barely any platform specific code in them, so I can easily port it.
The only problem right now is.... nRGBLib draws out its chars way to large, in the image, the title is bieng drawn out at a size of 1.
 I only drew out the body, frame and title of the form, as you can see. It will have the two circle buttons in the end.
If you got Virtual PC you can actually run Windows XP mode on Windows 7 and you have unlimited PRIZM emulation there, since once your trial expires, you just need to start a new image and get rid of the previous one
Title: Re: Updating WZGUILib
Post by: jwalker on July 22, 2012, 07:47:19 pm
true, but I am using home premium...
Title: Re: Updating WZGUILib
Post by: DJ Omnimaga on July 22, 2012, 07:48:56 pm
Ah that sucks. I actually had Home too but upgraded.
Title: Re: Updating WZGUILib
Post by: jwalker on July 22, 2012, 08:14:40 pm
I thought about, but decided not to in the end (dont want to spend the money :P)
Title: Re: Updating WZGUILib
Post by: alberthrocks on July 22, 2012, 08:20:13 pm
I thought about, but decided not to in the end (dont want to spend the money :P)
I would suggest VirtualBox (https://www.virtualbox.org/), which is pretty nice. Once you install XP, just download the emulator and then shut down the VM. Copy the virtual HDD to a safe place, and then keep using (install and use). Once you're out, backup any progress from the current VM, delete said VM, and then use the old one to repeat. ;)

If you don't have an XP CD/image... be creative. :P
Title: Re: Updating WZGUILib
Post by: jwalker on July 22, 2012, 08:26:09 pm
I actualy have VirtualBox, I need to find an xp image though... cant be that hard
Title: Re: Updating WZGUILib
Post by: DJ Omnimaga on July 22, 2012, 08:48:52 pm
I guess it wouldn't be but my concern is the serial requirement at the start, if any. Although at this point I wouldn't be able to continue the discussion since it would be against Omni rules (piracy). :P
Title: Re: Updating WZGUILib
Post by: jwalker on July 22, 2012, 08:56:05 pm
yep, also im setting a git repo
Title: Re: Updating WZGUILib
Post by: jwalker on August 12, 2012, 03:03:54 pm
Ok just some general news and a question...
First I have found another way to make my code smaller by creating a control class that all controls can inherit from, and as of now I have been able to remove almost all of the control_name:checkClick() functions and replaced them with a generic one, which cut out about 5 lines of code per control, I also discovered some unecessary code in text boxes and removed it from there.
Today I will finaly be able to complete the transfer of major code(paint, click, etc) into the library system.
Today I also will make the WZLL (WZ Library Load) Table, which will control loading and unloading of unecessary libraries in order to conserve memory(hopefully). This way you only will load the libraries that you need, and if you arent using a library you will also be able to unload it. the format will be simple, it will look like this:
WZLL = {{"component_name", string comstring, bool loaded}}
**Notice, in the table it actualy wont have a 'string comstring' the element will just be comstring
The only part of that table you have to worry about is the string 'component' name and the boolean 'loaded'

Now my question is this... is there a way to only draw a certain part of anything stored in gc,
Why Im asking this is if I want to make the windows drag-resizeable or if the programmer makes a lable that goes outside of the realm of the body of the window, I dont want to draw that portion of the said image/string/geometric shape.
Title: Re: Updating WZGUILib
Post by: Jim Bauwens on August 12, 2012, 04:12:32 pm
Check out [lua]gc:clipRect[/lua] ;)
Title: Re: Updating WZGUILib
Post by: jwalker on August 12, 2012, 05:25:01 pm
thanks jim, that should help out alot.
Also as I said I would do, Dialogs now act almost exactly like forms... it even inherits from window :)
Dialogs still look like they used too, but they dont always stay on the top of the other windows/dialogs.
I also updated the color table so that it now includes almost all real color names, not made up ones.
I will post the new dev version soon, after I test it quit a bit more.
Also I noticed in 3.2 that how strings are drawn on the computer are drawn diffrently on the handheld... thanks TI  :banghead:
Title: Re: Updating WZGUILib
Post by: jwalker on August 13, 2012, 10:34:05 pm
First preliminary tests of gc:clipRect look great.
Second I will also start planning another new 'technology' that WZ will possibly use in the future if it works out... I will keep you posted
Title: Re: Updating WZGUILib
Post by: jwalker on August 15, 2012, 10:34:09 am
So I posted a picture of some of the new functionality of WZ, note this isnt the new tech I talked about....
(http://i47.tinypic.com/250441d.jpg)
currently tabcontrols dont follow the rules, but that wont be hard to fix
The input dialog is new, I havnt completed it yet.
also the forms use clipRect, as the pictureboxes lable says l1

The new functionality came because I made a control class to handle things like checkClick, so for some of the controls it shows that it was selected by drawing a dashed rectangle arround it, and it will remain until the user clicks another control
Title: Re: Updating WZGUILib
Post by: Jim Bauwens on August 15, 2012, 03:35:47 pm
Nifty :)
Title: Re: Updating WZGUILib
Post by: jwalker on August 15, 2012, 07:45:34 pm
thanks :)
Title: Re: Updating WZGUILib
Post by: jwalker on August 16, 2012, 10:45:00 am
So yesterday I implemented bieng able to switch between controls using the tab key, and the ability to move a window with the arrow keys
Title: Re: Updating WZGUILib
Post by: jwalker on August 17, 2012, 11:34:58 am
Yesterday I added using backtabKey to switch between windows, like how tab switches between controls.
I also made windows drag resizeable, and have it almost bug free.
Title: Re: Updating WZGUILib
Post by: CompSystems on August 17, 2012, 12:18:08 pm
As Texas Instruments does not incorporate dialog boxes in tinspire/CAS OS, a program in TIbasic could interact with WZGUILib? or any application written in LUA, ASM or C?
Title: Re: Updating WZGUILib
Post by: jwalker on August 17, 2012, 01:51:27 pm
A function in tibasic can be called from this lib, but you cant call any of the functions nessecary, or even interact with lua, from a ti basic program. This is because they wanted lua to be 'sandboxed'.

For a Lua program, all you have to do is copy the portions from the lua file I release into another file, or make a copy of that lua file and rename it. Then you just create the objects. Notice that if an object is a button, then you have to create the function that it calls and tell it its name when you create it.
examle:
Code: [Select]
  --Do not wory about anything befor this point unless you are using Nspire OS 3.1 or earlier, if so change platform.apilevel to 1.0
  --this is where you create objects
  function on.construction()
   form1 = form(60, 60, 150, 100, false, "Title", color.white, color.black, true, false, mycont, true, true, Icon1, true)
    --code for any previous objects, Any form(s) should be created before add creating controls, as they will be the parent of the control
    button1 = button("BTN1", 4, 4, btnClick, color.black, color.buttoncontrol, form1)
  end

  function btnClick()
  --your code here
  end
you could also write your own controls, but that is advanced and I need to release a dev guid first... which is comming  :)

For C and ASM, I believe for OS 3.1 there are functions in Ndless that can interact with lua, but to what extent I realy dont know.

Also this is for both you CompSystems and everyone else:
Since the example I provided above uses my dev version of WZGUILIB, I am posting it below, Go ahead and test out the new features
Notice** when drag resizing Forms there is a bug that occurs when you go below a specific point, but I almost have it fixed, It shouldnt crash the script

Also this dosnt require any external data, it dosnt use it because I am deving the base Items

***********************How to use the arrow keys to move a form, what the tabKey does, and what backtabKey does******************

tabKey scrolls through the controls in form_name_here.controls, and gives them selected status. When it reaches the end of the list it unselects all controls and allows you to use the arrow keys to move the window. All controls should be surrounded by a dotted rectangle when selected except textboxes, whos carrot appears.
backtabKey scrolls throug the windows in wndTbl giving them the focused status

Arrow Keys will move the focused window 4 pixels in the direction that the arrowKey points.

As always if you need more examples or just need help, Ask me by posting here or you can also PM me.

Also the tns file is form 3.2 and the lua file is for 3.1, but all code except on.create/on.construction and platform.apilevel are the same.


ALSO here are the paramaters for the controls


--~    --params----------
--~       window = --dont need
--~       form = x, y, width, height, fullscreen, title, titlecolor, bordercolor, isdrawn, contextmenu, cmtable, hassb, hasicon, iconimg, draggable
--~     dialog = x, y, text, title, backcolor, titlecolor, bodytextcolor, isdrawn
--~    button = text, x, y, action, txtcolor, bgcolor, parent
--~    lable = x, y, text, txtsize, color, parent
--~    textbox = x, y, width, text, textcolor, tbcolor, parent, selected
--~    radioButton = text, x, y, marked, backcolor, markcolor, txtcolor, parent
--~     contextm = --dont need
--~    checkbox = x, y, text, checked, backcolor, checkcolor, textcolor, parent
--~       pb = x, y, width, height, labeltbl, picturetable, txtcolor, index, lablename, parent, selected
--~       NumericUD = x, y, num, linecolor, maxnum, minnumber, textcolor, pmbcolor, parent, selected
--~     tabcontrol = x, y, width, height, tabtable, parent
--~     listbox = x, y, tabval, selected, scrollbars, parent
--~     toggle = x, y, state, parent
--~     inputDialog = x, y, text, title, backcolor, titlecolor, bodytextcolor, isdrawn, btnAction
--~     cant use: scrollbar, progressbar, statusbar
--~    --end params
paste this in where the current paramater list is

Also to resize forms by dragging, click the little box on the lower right hand corner and move the mouse
Title: Re: Updating WZGUILib
Post by: Jim Bauwens on August 17, 2012, 02:48:27 pm
It is possible to make something that allows TI-Basic programs to run Lua stuff. I've done it before, but haven't made any easy  tool for people to use.
But it's possible ;)
Title: Re: Updating WZGUILib
Post by: jwalker on August 17, 2012, 03:13:04 pm
Realy, was it through ndless though?
Title: Re: Updating WZGUILib
Post by: Jim Bauwens on August 17, 2012, 03:31:14 pm
No Ndless :D
Title: Re: Updating WZGUILib
Post by: jwalker on August 17, 2012, 03:36:00 pm
hmmmm, could you tell me how? This is pretty cool because I thought it was sandboxed
Title: Re: Updating WZGUILib
Post by: jwalker on August 18, 2012, 09:46:06 pm
So Here is a layout of what I plan to be doing in the next few weeks...
Testing... Lots of testing
finish scrollbars and remove dynaWidth from listboxes
Add multiline textboxes
add picture buttons
Add a forms graphics context for drawing primatives
And when jimbauwens tells me how he got lua code to run in a tibasic function, I will be testing that too.
That would be sweet if poeple could use it in ti-basic programs to make GUI Applications.
Title: Re: Updating WZGUILib
Post by: jwalker on August 19, 2012, 04:00:55 pm
Now just how to figure out the best way to make a graphics context for forms...
Title: Re: Updating WZGUILib
Post by: Levak on August 19, 2012, 04:09:28 pm
I think Jim was thinking of on.varChange and var.monitor...
Title: Re: Updating WZGUILib
Post by: jwalker on August 19, 2012, 04:11:35 pm
I think that may be it too, but maybe he found something we dont know about...
Title: Re: Updating WZGUILib
Post by: Adriweb on August 19, 2012, 05:09:35 pm
You mean, something like this ? ;-)

(http://i.imgur.com/VhkFZs.png) (http://i.imgur.com/VhkFZ.png)

I just created it for you :D


(edit : fixed a bug)
Title: Re: Updating WZGUILib
Post by: Jim Bauwens on August 19, 2012, 05:56:19 pm
Yup, something like that. Please note though that using loadstring is slow.
It would be better to limit it to predefined input, will be much faster.
(Sorry for replying so late, was busy)
Title: Re: Updating WZGUILib
Post by: Adriweb on August 19, 2012, 06:01:26 pm
(I edited my post with a new version, the first had a bug)
Title: Re: Updating WZGUILib
Post by: jwalker on August 19, 2012, 07:08:39 pm
Thanks :)
I see how that works...
This may be an interesting project...
Title: Re: Updating WZGUILib
Post by: jwalker on August 20, 2012, 01:55:14 pm
So here is where Im at, on using TI-Basic anyway...
Currently I allow it to create forms, make them go full screen, make them move and allow them to go from fullscreen back to normal.
But before I realy continue this Idea, I need to get an idea of what this could be used for...
Title: Re: Updating WZGUILib
Post by: jwalker on August 21, 2012, 12:44:32 pm
So today I realized that in about two months (the end of october) it will have been a year since I started Development on this project, and it has come a long way since then. :)
Title: Re: Updating WZGUILib
Post by: jwalker on August 24, 2012, 08:09:10 pm
I believe the bug when you resize the window is now squashed.
Here is the new versions of the file,
the .lua one is for 3.1, and the .tns is for 3.2.
This does not require the libs.
Also, does everyone think that the size of the text needs to be bigger, if so tell me.
The only reason I havent made it larger yet is because of space problems that I think exist.

Also if you do run the script there is a little utillity that tells you how much memory is being used by lua.

paramaters:
window = --dont need
form = x, y, width, height, fullscreen, title, titlecolor, bordercolor, isdrawn, contextmenu, cmtable, hassb, hasicon, iconimg, draggable
dialog = x, y, text, title, backcolor, titlecolor, bodytextcolor, isdrawn
button = text, x, y, action, txtcolor, bgcolor, parent
lable = x, y, text, txtsize, color, parent
textbox = x, y, width, text, textcolor, tbcolor, parent, selected
radioButton = text, x, y, marked, backcolor, markcolor, txtcolor, parent
contextm = --dont need
checkbox = x, y, text, checked, backcolor, checkcolor, textcolor, parent
pb = x, y, width, height, labeltbl, picturetable, txtcolor, index, lablename, parent, selected
NumericUD = x, y, num, linecolor, maxnum, minnumber, textcolor, pmbcolor, parent, selected
tabcontrol = x, y, width, height, tabtable, parent
listbox = x, y, tabval, selected, scrollbars, parent
toggle = x, y, state, parent
inputDialog = x, y, text, title, backcolor, titlecolor, bodytextcolor, isdrawn, btnAction
cant use: scrollbar, progressbar, statusbar


If there are any questions, please ask!
Title: Re: Updating WZGUILib
Post by: jwalker on August 25, 2012, 04:07:39 pm
Here is another update:
This version *should* be unicode compatible, I changed all of the string.sub's to string.usub, and I already used string.split.
This version also sees a change to buttons, they now send two arguments to the click callback function, the buttons handle and its parents handle.
I also added a form_name:removeControl function whos parameter is the controls handle.
All parameters are the same as the last release last night.
Title: Re: Updating WZGUILib
Post by: jwalker on August 26, 2012, 06:54:35 pm
TI Bug report:
So I was testing some form stuff that involved the fullscreen paramater. I made a form that would be fullscreen and visible to the user when they opened the script, when on.construction is called. I closed that script and came back later and reopened it and got an error stating that function 3 of drawRect had to be >= 0, it was located in the form drawing code. I tried it on the calculator only to have the same outcome! I also noticed that on the student software if you just set the script again right after the error it worked just fine. So I changed the fullscreen paramater to false and then closed and reopened the script only to find out that platform.window.width and platform.window.height returns a 0 when initialy running it. Initialy bieng when you open it, not when you reset the script on the student software.
Title: Re: Updating WZGUILib
Post by: Levak on August 27, 2012, 04:36:16 am
Did you meant fullscreen as the glitch I've discovered and used in NyanCat ?
If so, it is not a bug to report to TI since it is not supported officially by TI.

If not, I'm afraid I do not have understood your story =(
Title: Re: Updating WZGUILib
Post by: ElementCoder on August 27, 2012, 04:42:17 am
Did you meant fullscreen as the glitch I've discovered and used in NyanCat ?

How do you do that? It seems interesting to me :)

[edit] This is a nice lib! Now to see what projects I can use it for.
Title: Re: Updating WZGUILib
Post by: Levak on August 27, 2012, 05:12:21 am
Did you meant fullscreen as the glitch I've discovered and used in NyanCat ?

How do you do that? It seems interesting to me :)

http://tiplanet.org/forum/viewtopic.php?f=19&t=7271&p=114379
in 3.1, the bug was active only the first frame of focus. So you were not able to redraw on it.

In 3.2, setFocus forces the glitch to appear when you want.
Title: Re: Updating WZGUILib
Post by: Jim Bauwens on August 27, 2012, 06:17:00 am
The 'bug' is also used in EEPro to add an icon to the tab thing:
(http://i.imgur.com/Uxy5N.jpg)


Edit:
The issue you have with the height/width functions returning 0 in on.construction is normal. At that point the window isn't initialized yet (although it is when you reset the script).
The official doc mentions this IIRC. You should use the on.resize event handler to properly resize your stuff (on.resize will also get called at script startup, when the window is initialized).
Title: Re: Updating WZGUILib
Post by: jwalker on August 27, 2012, 07:39:53 am
IDK, I looked through the documentation, but maybe I missed something. Anyway good to know.

Also @ElementCoder, thanks. If you are looking to make games I am trying to add a foms graphics context. nvm, I will just make an overall graphics maganger.

@Levak, It dosent go fullscreen in that way. I thought about doing something like that, but then I realized that it wouldnt be OS <= 3.1 compatible.
Title: Re: Updating WZGUILib
Post by: jwalker on August 28, 2012, 07:52:31 pm
Here is the Beta that I am going to post onto TICalc in a few weeks. You may be wondering 'A few weeks? Why?'. The reason is because I am going to write some tutorials and release them with this beta.
**Notice: I added an on.resize function, so fullscreen works correctly again.

As always the TNS is for 3.2 and the Lua is for 3.1, although most code is compatible.

All strings currently in the TNS will draw DIFFRENTLY on a 3.1 handheld. Due to a TI Bug I had to change drawing code. All strings draw exactly one pixel off on the horizontle(y) part of the screen.
Title: Re: Updating WZGUILib
Post by: jwalker on September 03, 2012, 07:25:20 pm
Here is the somewhat completed start page and the forms referance.
It is all in HTML.
Title: Re: Updating WZGUILib
Post by: jwalker on September 24, 2012, 08:19:41 pm
Its been a while since I posted...
Anyway I finished the Dialog reference and I want to get buttons and textboxes done tonight, maybe even more than that
Title: Re: Updating WZGUILib
Post by: jwalker on October 18, 2012, 02:21:28 pm
Ok, so It has been super busy, but do to a teachers conference, I get a 4 day weekend. I should get all of the documentation done by sunday. Here is the latest version. Alot of the controls are done now.
Title: Re: Updating WZGUILib
Post by: jwalker on October 19, 2012, 08:20:38 pm
I would like to introduce a newer feature of WZGUILib: Events.
Currently there are 11 events. How it works is everytime an event fires, it calls the handler, WZ_E_THROW().
The events are: WND_CLOSE, WND_MAX, WND_REG, WND_PNT, TXTBOX_TXTCHNG, NUD_NCHGNGP, NUD_NCHGNGM, RDB_MCHNG, CHK_CHKCHNG, PB_NPIC, PB_PPIC.
How you analize events is through the table WZ_EVENT_ST. The members are WND_NAME, E_TYPE, CON_THROWER.
CON_THROWER is the name of the control that threw the event, and WND_NAME is that controls parent.
Im still working on the concept, but it looks good so far.
This version will be released with WZGUILib, but it will be named WZGUILib EV. I will be putting this version up soon.
Title: Re: Updating WZGUILib
Post by: DJ Omnimaga on October 20, 2012, 04:59:14 am
Nice to see this is still progressing. I hope eventually there are more Nspire developers that uses this.
Title: Re: Updating WZGUILib
Post by: jwalker on October 20, 2012, 08:44:08 pm
Im still plugging away. Anyway here is the version of WZGUILib that I talked about. Currently I have most of the events bieng thrown at the end of the code, but a few are called right away. Currently if the event thrower isnt a control (because it is a form), the paramater of WZ_EVENT_ST named CON_THROWER is set to nil.
Title: Re: Updating WZGUILib
Post by: jwalker on November 11, 2012, 11:50:34 am
So I haven't had a whole lot of time to work on this, but I'm still going. I've hit a 4 day weekend, and with only 3 controls to document, that should be done finally today, if something doesn't get in the way :p. I also decided that since I'm writing my documentation in HTML, why not rewrite my table generator in JavaScript instead of Java? So I'm in the process of doing that. I also have a few other controls I need to make, and I haven't gotten anywhere with scrollbars, due to my lack of time. So that is one more of the things I will be working on. I also need to add the ability to add graphics, so that brings along its own set of challenges.
So I have a question, Is there a way to totally delete an object from memory, not just from the table that contains the object?
I wonder this because table.remove only removes the object from the table, yet it still exists in memory.
Title: Re: Updating WZGUILib
Post by: Adriweb on November 11, 2012, 12:01:41 pm
So I have a question, Is there a way to totally delete an object from memory, not just from the table that contains the object?
I wonder this because table.remove only removes the object from the table, yet it still exists in memory.
try a garbage collection ?

See http://lua-users.org/wiki/GarbageCollectionTutorial
and here on how to use it : http://www.lua.org/manual/5.1/manual.html#pdf-collectgarbage
Title: Re: Updating WZGUILib
Post by: Jim Bauwens on November 11, 2012, 12:07:57 pm
So I have a question, Is there a way to totally delete an object from memory, not just from the table that contains the object?
I wonder this because table.remove only removes the object from the table, yet it still exists in memory.

Normally, if all references to an object are removed, the object will be destroyed. Lua will do this automatically, but you can force it. (see links Adriweb gave).
I'd suggest you to check if you really removed all the objects first, because forcing a garbage collection isn't the normal thing to do.
Title: Re: Updating WZGUILib
Post by: jwalker on November 11, 2012, 12:08:22 pm
I was wondering if that was what that was for, and I will have to test that out jim
Title: Re: Updating WZGUILib
Post by: jwalker on November 18, 2012, 04:11:54 pm
Today I added a working graphics class, GraphDev.
Currently there are 3 parameters: parent; bgColor; screenInf
screenInf has two different inputs, "fs" which stands for Full Screen and a table of points.
fs will set it to use the full body of a form.
The table of points looks like this: {x, y, width, height}.
Right now I'm not sure if I want to keep the last argument or not, as I think the graphics control should take up the full screen.
how you add objects is a little different also...
To add an object the format is: GraphDev_Name:add(object).

Important information: In fs mode, it will erase any controls beneath GraphDev control.
Title: Re: Updating WZGUILib
Post by: jwalker on November 19, 2012, 09:08:18 am
Yesterday, I finaly got unicode to work properly with textboxes.
I also ran into an issue...
What happens is, any control (such as the tabcontrol), cannot be clipped because even though I reset the clipping rectangle to the size of the body of the form, when I resize it the children of the control that is clipped can show up outside of the form!
Its kind of hard to explain so I will upload pics when I get home.
Title: Re: Updating WZGUILib
Post by: jwalker on November 19, 2012, 11:24:53 pm
In the first image, it shows a blue square, that is 15 width and 15 height.
The second image shows the same blue square, transposed so that most of the square is clipped.
The last image shows that sub-objects wont be cropped when out of the forms borders, like they are supposed to be. This is also the case for other controls that contain controls.
Title: Re: Updating WZGUILib
Post by: ElementCoder on November 20, 2012, 02:09:55 am
I hope it will be an easy fix. This project is becoming quite big now :o isn't it? I wish I could find some time to mess around with it and create something.
Title: Re: Updating WZGUILib
Post by: jwalker on November 20, 2012, 09:03:54 am
I hope so too. It is, so I think I'm going to have to make versions in order to keep it from getting too large, also I am working on tutorials to hopefully shorten the learning curve.
Title: Re: Updating WZGUILib
Post by: jwalker on November 22, 2012, 04:12:28 pm
I still am working on getting it to clip right without having to resort to if statements in order to get it to clip right, is there a way to clip two things at once?
Title: Re: Updating WZGUILib
Post by: jwalker on December 08, 2012, 03:20:26 pm
Here is a first look at the GraphDev control. I only have paint events routed to it right now, but it will be really simple to add the other ones in. I didnt fix the other issue I talked about earlier in my posts, but I will be implementing an if-then approach.
Title: Re: Updating WZGUILib
Post by: flyingfisch on December 08, 2012, 04:44:46 pm
Are you still planning on porting this to prizm?
Title: Re: Updating WZGUILib
Post by: jwalker on December 08, 2012, 05:09:10 pm
I am, but it will definately be some time because I barely have enough time to work on the Nspire version. I plan on starting the prizm port right after I release WZGUILib 3.0 (this release), but I have to add a few features before I do release it. WZGUILib Prizm 1.0 will actualy be just a port of WZGUILib 3.0, and the versions will be numbered from there.
Title: Re: Updating WZGUILib
Post by: jwalker on December 09, 2012, 03:02:07 pm
Today I routed most of the events to the control, I revised some old window related code that was oblolete with new functions I had added recently. I also added some new events like the timer and escapeKey.

*setup
Code: [Select]
--GraphDev setup
                      --form, bgcolor, fullscreen, function table
gd = GraphDev(fgd, color.white, "fs", {paint=WZ_Paint, click=cl, mouseMove=mm, enterKey=ek, timer=nil, arrowKey=ak, charIn=ci, escapeKey=esk}
I coppied and pasted this from the document that I uploaded below.

*how it works
Basicly every event that gets passed to this control is handled by the programmer instead of WZ.
Title: Re: Updating WZGUILib
Post by: jwalker on December 12, 2012, 07:40:12 pm
So it has been a few days, and this morning on the bus the light bulb went off and I now know how I will get scroll bars to work.
I also have been contemplating a few other things....
First, after I release WZGUILib 3.0, I want to start screwing around with coroutines, in order to (possibly) add multithreading to WZ.
Last, I have been running an idea through my head every once in a while. I have been thinking that perhaps I should make WZ into a "Desktop environment". Here is some of the reasons:
1. ability to minimize windows, have multiple windows "full screen" at once. This is could be possible now, because I implemented backtab to switch between windows.
2. It might take a while, but I would develop an app system. How it would work is every "app" would be in a document stored in the library, the user then would install it by opening a dialog that asks for the path of the document. The apps would be able to have icons and other data that then would be displayed to the user. It would be persistant and would have to be uninstalled when they want to remove the program.
3. It would be more stable because less would be left up to the end programmer. A lot of WZ now is left up to the programmer, so they have to check themselves to make sure it is running properly and everything so the user has a nice experience, a desktop environment needs to run even if one app crashes. Again as with #1 I could implement this, the reason I haven't implemented a strict error recovery system is because I want to make WZ as small as possible. I may release a "WZGUILib Secure" edition in the future that would have very good error recovery systems.

Reasons Why I may be against such a Ludacris thing:
1. Less flexible. Right now it is very flexible and the programmer has lots of choice.
2. A "Desktop" environment would be a lot larger.
3. An app system using the current loading scheme would be heavy, this is why the style system wont be in the standard WZ, but in a separate release instead.

Tell me what you think, I would like to know.
Title: Re: Updating WZGUILib
Post by: ElementCoder on December 13, 2012, 03:29:08 pm
I think it would be very nice but ,like you said, I think it would take a (large) nom out of flexibility. The apps sound nice, but wouldn't that make the document really huge?
I really need to find some time to play with this. Every time I see an update I'm like wow this looks great. But then I realise I have work to do, homework and suddenly all time is gone :( But there's a 2 week christmas holiday coming up so I hope I can do something in that time :D
Title: Re: Updating WZGUILib
Post by: jwalker on December 13, 2012, 09:58:30 pm
It wouldn't make the document size any bigger, it would use more memory because we have to use loadstring. I plan to do a lot of programming during Christmas vacation, especially on the days I don't work. I have to get a few more controls documented, then I will upload the documentation and the newest dev release(s).
Title: Re: Updating WZGUILib
Post by: jwalker on December 16, 2012, 04:30:16 pm
I am adding a password char feature to textboxes right now.
Also, wouldn't it be awesome if we could use lua to connect calc-calc?
Title: Re: Updating WZGUILib
Post by: ElementCoder on December 17, 2012, 04:10:17 am
I wonder if that's possible. Seeing how jimbauwens succeeded to control an LED display through Lua, shouldn't it be possible to do the same with calcs? Perhaps we could even use a splitter and go even further, 4 calcs at the same time :P
Title: Re: Updating WZGUILib
Post by: jwalker on December 17, 2012, 09:10:15 am
I think it would be useful if we could, I can think of a lot of things that could be done.
Title: Re: Updating WZGUILib
Post by: flyingfisch on December 17, 2012, 11:26:55 am
I am, but it will definately be some time because I barely have enough time to work on the Nspire version. I plan on starting the prizm port right after I release WZGUILib 3.0 (this release), but I have to add a few features before I do release it. WZGUILib Prizm 1.0 will actualy be just a port of WZGUILib 3.0, and the versions will be numbered from there.

Will it be in C or will it be in LuaZM?
Title: Re: Updating WZGUILib
Post by: jwalker on December 17, 2012, 05:45:31 pm
LuaZM, it will be much easier to port that way
Title: Re: Updating WZGUILib
Post by: flyingfisch on December 17, 2012, 06:24:07 pm
LuaZM, it will be much easier to port that way

You do know that LuaZM doesn't support modules yet, right?
Title: Re: Updating WZGUILib
Post by: Levak on December 17, 2012, 06:45:20 pm
LuaZM, it will be much easier to port that way

You do know that LuaZM doesn't support modules yet, right?
Neither TI' one

By the way, adapting a High level language script to a low level language (such as C) program is one of the most difficult thing to do : It is even easier to restart from scratch.
Title: Re: Updating WZGUILib
Post by: flyingfisch on December 17, 2012, 06:46:33 pm
LuaZM, it will be much easier to port that way

You do know that LuaZM doesn't support modules yet, right?
Neither TI' one

By the way, adapting a High level language script to a low level language (such as C) program is one of the most difficult thing to do : It is even easier to restart from scratch.


So you have to copy and paste the library into the beginning of the program?
Title: Re: Updating WZGUILib
Post by: Levak on December 17, 2012, 06:50:37 pm
So you have to copy and paste the library into the beginning of the program?

Hell yeah.

Edit : I found non-portable tricks with Make3D but this is another story
http://ourl.ca/10565/242834
Title: Re: Updating WZGUILib
Post by: flyingfisch on December 17, 2012, 06:53:21 pm
So you have to copy and paste the library into the beginning of the program?

Hell yeah.

Woah. Even luafx can do better than that.

So if multiple programs use the same libraries, isn't that a whole lot of wasted space?
Title: Re: Updating WZGUILib
Post by: Levak on December 17, 2012, 06:57:50 pm
So you have to copy and paste the library into the beginning of the program?

Hell yeah.

Woah. Even luafx can do better than that.

So if multiple programs use the same libraries, isn't that a whole lot of wasted space?
TNS files are zipped. This prevents us to see the crappy lack of space TI produces (that becomes LZW compressed).
Lua app is the best serialized app (it is simply not serialized). Other apps serialization is h-o-r-r-i-b-l-e.
Title: Re: Updating WZGUILib
Post by: jwalker on December 17, 2012, 09:43:26 pm
LuaZM, it will be much easier to port that way

You do know that LuaZM doesn't support modules yet, right?
Neither TI' one

By the way, adapting a High level language script to a low level language (such as C) program is one of the most difficult thing to do : It is even easier to restart from scratch.


Exactly, I may make a C version one day, but that one day could be years away
Title: Re: Updating WZGUILib
Post by: jwalker on December 28, 2012, 12:06:32 pm
I have not gotten as much done as I would have liked this week, but then again I worked everyday since Christmas. I should have time this weekend though and tonight to at least work on the documentation.
Title: Re: Updating WZGUILib
Post by: jwalker on December 31, 2012, 12:53:41 am
Alright, here is the newest version, all textboxes now support password char. In the .tns is an example.
Title: Re: Re: Updating WZGUILib
Post by: Nick on December 31, 2012, 02:22:56 am
Wow, you really put a lot of work into this. Glad you're still doing it, is it ok if I use parts of the code for a game of mine (with credits of course), because it would be a shame not to use it :)
Title: Re: Updating WZGUILib
Post by: jwalker on December 31, 2012, 10:49:05 am
sure, also if you would like me to modify it so you can use the controls on just the main screen, all I have to do is modify the manager a bit.
Title: Re: Re: Updating WZGUILib
Post by: Nick on January 01, 2013, 05:23:51 am
First i'll take a look into it myself, but i'll let you know, tahnks :) in facts it's only some textboxes, checkboxes and radiobuttons I need, so it won't be such a big work
Title: Re: Updating WZGUILib
Post by: jwalker on January 01, 2013, 12:04:54 pm
That sounds good, I am almost done with my documentation, so that might be a big help.
Title: Re: Updating WZGUILib
Post by: jwalker on January 02, 2013, 10:02:52 am
So yesterday I added a noresize paramater to forms, an addTab and removeTab functions to tabcontrolls, and a few other things. Then my computer decided to crash and those changes were lost. Fortunately I remember what I did so those updates will be released tonight.
Title: Re: Re: Updating WZGUILib
Post by: Nick on January 02, 2013, 02:46:09 pm
Where can I find the most recent version of the documentation? Since you said it was updated, I might take a look into that.

Also, nice you got those tab functions working, I made a GUI in C++ once, an that was the major PITA :)
Title: Re: Updating WZGUILib
Post by: jwalker on January 03, 2013, 12:11:37 am
Tomorrow I am going to upload the update and the updated documentation, currently there are only 3 or 4 controls left undocumented, and the last one I documented is the tabcontrol.
Note that I only have made the document that describes the controls: things like its member functions, how it is created etc.
I will be adding a lot more topics after I finish documenting the basic controls.
Also, what platform did you make the GUI for?
Title: Re: Re: Updating WZGUILib
Post by: Nick on January 03, 2013, 02:40:22 am
Great

Well, it wasn't for the Nspire either, it was for my arduino using a touch display. It was 320x240 too though. The problem there was the memory. It only has 2kB of memory, so I had to give every control the least possible variables (i forgot the name for class variables), since they all take memory.. I added buttons, checkboxes, radiobuttons, sliders, textboxes, switches, and a tabcontrol at last.
Title: Re: Updating WZGUILib
Post by: jwalker on January 05, 2013, 11:47:14 am
I have to postpone the release till tonight or tomorrow, life got in the way the past few days.
Title: Re: Updating WZGUILib
Post by: jwalker on January 07, 2013, 12:57:05 am
Here it is, documentation is up to tabcontrols and the tabcontrol class has been updated, along with the noresize parameter and I modified the setFull and Clicks function to make them smaller. Next up I have been working of clipping the controls rects properly and am almost there, but I did not include that in this release.
Title: Re: Updating WZGUILib
Post by: jwalker on January 17, 2013, 05:24:47 pm
This doesn't necessarily relate to WZGUILib, but I would like to know anyway, as I might want to use it later.

I have been looking around the internet for some time but I cant seem to find any good examples or information about using trigonometry functions for things like rotating a line. Would someone be able to give me an example?
Title: Re: Updating WZGUILib
Post by: jwalker on January 20, 2013, 05:46:18 pm
So I added a simple rounded-edge button.
Title: Re: Updating WZGUILib
Post by: ElementCoder on January 21, 2013, 01:47:08 pm
That's a nice looking button, was the colored window already there or is that a new feature as well?
Title: Re: Updating WZGUILib
Post by: jwalker on January 21, 2013, 06:21:30 pm
Custom Colored windows have been there since I added Dialogs to WZGUILib way back long ago. Actually most controls can be very customized when it comes to the colors you choose. If you really wanted to, you could change that picture to look like the image below.

Also I plan to upload either the code to the rounded button so you could implant it into the current version of indev WZ, or upload an entirely new dev version.

When I get the style system into place, the rounded style will be one of the styles I release.

EDIT: The picture looks better on the computer software...

Code for form:
f1 = form(10, 10, 170, 150, false, "Main", color.yellow, 0xFECA77, true, false, false, false, false, img1, true, false)
Title: Re: Updating WZGUILib
Post by: ElementCoder on January 22, 2013, 04:16:34 am
I'm very happy you keep developing this! I'm finally able to do some work on projects again so this is an excellent time to play around with this :D :thumbsup: for your hard work.
Title: Re: Updating WZGUILib
Post by: jwalker on January 22, 2013, 08:07:20 am
Thank you, I don't have a lot of time to develop, so when I start working on it I usually get quit a bit done in a small period of time. It almost seems like I develop in bursts....
Title: Re: Updating WZGUILib
Post by: flyingfisch on January 22, 2013, 09:23:11 am
This doesn't necessarily relate to WZGUILib, but I would like to know anyway, as I might want to use it later.

I have been looking around the internet for some time but I cant seem to find any good examples or information about using trigonometry functions for things like rotating a line. Would someone be able to give me an example?

Do you still need help with this or did you figure it out?
Title: Re: Updating WZGUILib
Post by: jwalker on January 22, 2013, 09:56:02 am
I still need some help, I just cant seem to be able to find the information that I need.
Title: Re: Updating WZGUILib
Post by: flyingfisch on January 22, 2013, 10:15:19 am
this helped me :)

http://www.helixsoft.nl/articles/circle/sincos.htm
Title: Re: Updating WZGUILib
Post by: jwalker on January 22, 2013, 01:51:32 pm
Thanks I will take a look at that!
Title: Re: Updating WZGUILib
Post by: jwalker on January 31, 2013, 05:29:31 pm
So, I have started on the tutorial section of WZGUILib. What I'm going to do here soon after writing the documentation is possibly release WZGUILib 2.5, basically it will fix the bugs I found with 2.1, it will contain all of the updates for the controls released in 2.1, but all new controls wont be released and the complete tutorial and documentation series will be released for the controls included in WZGUILib 2.5.
Title: Re: Updating WZGUILib
Post by: jwalker on February 03, 2013, 12:40:50 pm
I almost have progress bars finished, I just need to work a little bit on the equation which shows the progress.

EDIT: Finished, it looks kind of drab, so I will have to dress it up a little bit
Title: Re: Updating WZGUILib
Post by: jwalker on February 05, 2013, 12:28:22 am
I am almost done with a Class Framework creation tool. It will generate all of the code for the initialization function, and create add other necessary functions based on the input it receives.
Title: Re: Updating WZGUILib
Post by: jwalker on February 06, 2013, 01:23:30 pm
So Here is my question, should I add a mouseOver property to controls?

I would really like some input.
Title: Re: Updating WZGUILib
Post by: Jim Bauwens on February 06, 2013, 01:34:15 pm
So Here is my question, should I add a mouseOver property to controls?

I would really like some input.

You could add a mouseOver property, but would it really be useful? I don't think that on a calculator it would be used enough to be implemented by default, and it also would slow it down a bit (always need to check every control when you move the mouse ..).
Or you could add it, but disable it by default. This way the programmer could enable it if he wants it.
Title: Re: Updating WZGUILib
Post by: jwalker on February 06, 2013, 03:10:53 pm
That's what I was thinking. The reason I was asking was I kind of want to add a "tool tip", and things like highlighting the control when the mouse is over it.
Title: Re: Updating WZGUILib
Post by: jwalker on February 07, 2013, 12:18:20 am
Here is the class builder, the newest version of documentation and the newest WZ.

First the WZ Class Framework Generator is still very new, but works just fine. I am going to work on the interface a little bit, and also for some reason I had to run it from the command line with java - jar.

The newest version of WZ comes with a one time only class, smiley. I used it to test the CFG.

Enjoy!
Title: Re: Updating WZGUILib
Post by: jwalker on February 07, 2013, 11:50:47 pm
So I have been thinking, should I leave the toggle switch, replace it with a toggle button, or just add a toggle button. It would be similar to the android toggle button.
Title: Re: Updating WZGUILib
Post by: DJ Omnimaga on February 08, 2013, 09:40:12 am
I sadly didn't have time to check this much lately, but I'm glad this is still alive. As for the toggle button du you mean like a Checkbox? If so, just make sure that unlike Android, the check icon isn't visible at all when not checked (on my phone the icon becomes green when checked). Otherwise I often found myself thinking the box was already checked/enabled, but in fact it wasn't, because the unchecked state looked exactly like if it was checked on Windows/Mac.
Title: Re: Updating WZGUILib
Post by: jwalker on February 08, 2013, 09:47:04 am
That is odd, Ive been following the same system as windows/mac because that is what everyone knows. I recently started delving into android development, and the toggle button looks like a button, but it says on or off and there is a little line under the text that should turn green when on
Title: Re: Updating WZGUILib
Post by: Nick on February 08, 2013, 05:14:31 pm
Here's a pic of the Android ICS (4.0) switch:

(http://img.removedfromgame.com/imgs/0-Switch_ON.JPG) (http://img.removedfromgame.com/imgs/0-Switch_OFF.JPG)

and fyi, here's a pic of my entire gui I told you about some pages ago, it is based on that android ics gui, as you can see:
(http://img.removedfromgame.com/imgs/example.JPG)
Title: Re: Updating WZGUILib
Post by: jwalker on February 09, 2013, 01:17:51 am
wow, that is very nice, the on off switch is kind of like the one I currently have.
Title: Re: Updating WZGUILib
Post by: Nick on February 09, 2013, 05:39:12 am
Thanks :)
Oh, well I didn't really look into the latest versions yet (or I just looked over the switch), so I didn't see yours yet.
I would rather stay with a version that is similar to this one, than the one you told 2 posts ago (with the green 'light'), I've seen that one, and tbh I really don't like it, it looks weird imo, but that's completely personal
Title: Re: Re: Updating WZGUILib
Post by: DJ Omnimaga on February 09, 2013, 10:53:20 am
Oh you meant that button. that looks pretty fine. About the checkbox for me on Android if unchecked the box has a check icon in it regardless: It's just gray instead of green. It's annoying when used to computers, because sometimes I thought it was checked by default and I clicked OK to continue, only to be greeted with an error or a page loop. Pretty annoying when you have to "agree" with wi-fi hotspot TOSes or something.
Title: Re: Updating WZGUILib
Post by: jwalker on February 09, 2013, 12:17:38 pm
Yea, that would be confusing. Right now checkboxes just get filled in when checked, but I'm thinking about changing this to an actual check mark.
Title: Re: Updating WZGUILib
Post by: Nick on February 09, 2013, 01:30:28 pm
if you'd like to draw a check mark, you can use these line drawing codes, it draws the mark like on the image on the previous page:

Code: [Select]
if(isActive)
  {  
    //line 1 (upper)
    lcd->drawLine(x+2,y+6,x+6,y+10,COLOR_CHECK_PRESSED);
    lcd->drawLine(x+7,y+10,x+FONT_HEIGHT+2,y+3,COLOR_CHECK_PRESSED);
    //line 2 (middle)
    lcd->drawLine(x+2,y+5,x+6,y+9,COLOR_CHECK_PRESSED);
    lcd->drawLine(x+7,y+9,x+FONT_HEIGHT+2,y+2,COLOR_CHECK_PRESSED);
    //line 3 (middle)
    lcd->drawLine(x+3,y+5,x+6,y+8,COLOR_CHECK_PRESSED);
    lcd->drawLine(x+7,y+8,x+FONT_HEIGHT+1,y+2,COLOR_CHECK_PRESSED);
    //line 4 (lower)
    lcd->drawLine(x+3,y+4,x+6,y+7,COLOR_CHECK_PRESSED);
    lcd->drawLine(x+7,y+7,x+FONT_HEIGHT+1,y+1,COLOR_CHECK_PRESSED);
  }

edit: you'd have to change it a little of course :)
Title: Re: Updating WZGUILib
Post by: jwalker on February 09, 2013, 02:26:39 pm
I did something like that earlier:
Title: Re: Updating WZGUILib
Post by: jwalker on February 12, 2013, 09:58:19 am
So yesterday and some of today I will be working on a "console" that can be used for debugging, and maybe I will add an API for it so it can be used in projects
Title: Re: Updating WZGUILib
Post by: jwalker on February 15, 2013, 12:02:55 am
So right now the console can travers table very nicely, and I have a small command set. Right now I want to add the ability to call functions, create or destroy objects, and a few other things. There are a few other cosmetic things I am going to do too.
Title: Re: Updating WZGUILib
Post by: jwalker on February 18, 2013, 11:00:20 am
Would someone be able to tell me what the trick is to take control of the whole screen?
Title: Re: Updating WZGUILib
Post by: Adriweb on February 18, 2013, 11:26:18 am
Take a look at FormulaPro's source here, line 1938 :

https://github.com/adriweb/EEPro-for-Nspire/blob/488309ce5788116eed23b7ab65ee7dbfb2920efe/EEPro.big.lua#L1938 (https://github.com/adriweb/EEPro-for-Nspire/blob/488309ce5788116eed23b7ab65ee7dbfb2920efe/EEPro.big.lua#L1938)

The on.draw is called by on.paint here : https://github.com/adriweb/EEPro-for-Nspire/blob/488309ce5788116eed23b7ab65ee7dbfb2920efe/EEPro.big.lua#L2661 (https://github.com/adriweb/EEPro-for-Nspire/blob/488309ce5788116eed23b7ab65ee7dbfb2920efe/EEPro.big.lua#L2661)

All that is working on 3.2, and some code (https://github.com/adriweb/EEPro-for-Nspire/blob/488309ce5788116eed23b7ab65ee7dbfb2920efe/EEPro.big.lua#L1958) is supposed to make  it work on earlier, but looking at the whole thing code makes me wonder if it actually does. Anyway, mess around with that, it should work on everything with the 2 methods.

An example of early Full-screen hack, from Levak's Nyan Cat game : http://levak.free.fr/ftp/nspire/NyanCat/NyanCat.lua  (look at gc:begin())
Title: Re: Updating WZGUILib
Post by: ElementCoder on February 19, 2013, 04:31:57 am
Apparently there are a few GUI libs now. EEPro stuff, this one and Masterbox (http://www.ticalc.org/archives/files/fileinfo/451/45182.html). Off topic: what is this here:
Code: [Select]
--- <BOF> Jim Bauwens Sound Lib
TONE_LOW = "\001"
TONE_HIGH = "\127"
Title: Re: Updating WZGUILib
Post by: Adriweb on February 19, 2013, 05:41:02 am
This is part of the trick(s) from Jim Bauwens, in order to have simple sound output on Nspire 3.0.x (later OSes had print() removed....), with the RS232 port.
See here :


On Nyan Cat, Levak reused (& improved ?) Jim's code to have some background music (the Nyan Cat music :P)
See here : http://vimeo.com/27689207
Title: Re: Updating WZGUILib
Post by: jwalker on February 19, 2013, 09:34:01 am
There are a couple now. It provides a lot of choice, as they are all very different.
Title: Re: Updating WZGUILib
Post by: Jim Bauwens on February 19, 2013, 06:10:49 pm
Indeed, and choice is very good ;)
Title: Re: Updating WZGUILib
Post by: jwalker on February 20, 2013, 12:00:34 am
So here is where things are at. First I am going to finish up the console, add the API and get it into the documentation. Second I have started to crew around with coroutines and I am also working on a Window Manager class that would replace the strung out management system that is currently in place. I was working on this today, and I really wish there were private and public modifiers like in C++. I also wish there was USB support with lua, as that would be very interesting to work with.
Title: Re: Updating WZGUILib
Post by: jwalker on February 24, 2013, 10:43:51 am
Here is where I am at today. I finished all of the nice cosmetic stuff for the console and I just need to add some stuff so the programmer can interact with it. I also am going to add a table control, which will simply bind a table to the control to make a nice display out of it. On Numeric Up Downs I am going to add the editable property. I am going to add a multiline text box. I also am going to work on advanced editing features like clicking inside of a textbox and being able to modify the contents.
I also am going to implement scroll bars, how it will work is it will act like a tabcontrol, where it is the parent of a control like a multiline text box, and when it moves it will scroll the controls x or y. Before this I have to fix a bug in my code that clips rectangles, which will effect tab controls.
Title: Re: Updating WZGUILib
Post by: DJ Omnimaga on February 25, 2013, 12:46:16 am
good job so far :), also I tend to get confused about if it's Lua or C lol. (If it's Lua then I think you got some competition on ticalc.org , though :P)
Title: Re: Updating WZGUILib
Post by: jwalker on February 25, 2013, 08:10:46 am
Yea, there gets to be more every year. What's cool though is that none of them are the same.
Title: Re: Updating WZGUILib
Post by: jwalker on March 07, 2013, 12:23:23 am
Here is the first release version of the console control. It is very, very basic and there are a lot of things I am going to add. The first thing will be advanced editing features, the cursor only stays at the end of the text, and a few more commands.

Commands:
sp: Switch path---switches: -p=path ex=sp -p window1/controls/1; -w=wndTbl; -g=_G; ..=move back a level.
ls: Lists the contents of the table.
clear: Clears the screen.
inv: invokes a function-----switches: -a=args ex=inv -a myfunc arg1,arg2,arg3; -na=no args ex=inv -na myfunc.
help or ?: displays the command list.
set: sets a variable in the current directory-----------ex: set my_number 5; set my_string hello s; set my_bool true b

Set is a little different, switches go on the end, they are: s=string; b=bool. Numbers don't have a switch.

I will make a much nicer version of this later.
Title: Re: Updating WZGUILib
Post by: DJ Omnimaga on March 07, 2013, 01:28:52 am
Cool to hear :D. I really hope to see some programs using this in the future :)

You should post a screenshot for eye-candy :P
Title: Re: Updating WZGUILib
Post by: jwalker on March 07, 2013, 02:50:42 pm
Here are some screen captures.

Also, in some of the screen captures I used inv to spawn a lable and a window, You can do that to, just make sure that there is either no space between the commas. If you want the spaces to be captured in your arguments, use a "\" before the space.
Title: Re: Updating WZGUILib
Post by: DJ Omnimaga on March 09, 2013, 09:38:40 pm
Nice so far :D. I wonder how it would look like if windows and the small circles had outlines?
Title: Re: Updating WZGUILib
Post by: jwalker on March 09, 2013, 09:40:47 pm
I have been thinking about doing that, especially since everything looks kind of flat :P
Title: Re: Updating WZGUILib
Post by: DJ Omnimaga on March 09, 2013, 09:44:12 pm
Yeah that was kinda my thoughts as well, although of course it depends how it looks like, especially if the title bar is black or something.
Title: Re: Updating WZGUILib
Post by: jwalker on March 09, 2013, 09:46:56 pm
Hmm, I will have to play around with some stuff and see how it looks.
Title: Re: Updating WZGUILib
Post by: DJ Omnimaga on March 09, 2013, 11:37:51 pm
On an off-topic note, why are your screenshots 480x360 instead of 320x240? ???
Title: Re: Updating WZGUILib
Post by: Levak on March 09, 2013, 11:59:09 pm
On an off-topic note, why are your screenshots 480x360 instead of 320x240? ???
TI-Nspire Computer Software with zoom enable by factor 1.5 ? (right-bottom corner of the UI)
Title: Re: Updating WZGUILib
Post by: DJ Omnimaga on March 10, 2013, 12:02:39 am
Yeah I know. I just thought it was best to decrease it to 1.0, since screenshots aren't blurry that way :P
Title: Re: Updating WZGUILib
Post by: Levak on March 10, 2013, 12:03:40 am
Yeah I know. I just thought it was best to decrease it to 1.0, since screenshots aren't blurry that way :P
Oh, yeah, that's for sure. Sometimes it even displays differently with a bigger zoom : TI's logic..
Title: Re: Updating WZGUILib
Post by: DJ Omnimaga on March 10, 2013, 12:12:10 am
Yeah I know. I just thought it was best to decrease it to 1.0, since screenshots aren't blurry that way :P
Oh, yeah, that's for sure. Sometimes it even displays differently with a bigger zoom : TI's logic..
It reminds me of Internet Explorer 6. It zoomed the text, but not images, so the entire page was broken. Granted, pages break in newer browsers too, but usually only when it's too big for your computer resolution.
Title: Re: Updating WZGUILib
Post by: jwalker on March 10, 2013, 01:29:28 pm
So some things that have been on my mind:
1. I think I need to add padding to controls, to make them look less flat, right now WZ looks pretty flat.
2. Currently WZ is very flexible and customizable, but is it too flexible? Should I standardize some things, like the window title bar and title colors?
3. I also finished up the rounded button class last night.
Title: Re: Updating WZGUILib
Post by: jwalker on March 23, 2013, 04:27:44 pm
Here is a simple update, it fixed a minor issue in the console, which the example in the script shows. You can now use it for logging, a bug wouldn't let you before.
Title: Re: Updating WZGUILib
Post by: ElementCoder on April 09, 2013, 02:33:15 am
Flexibility is always a plus, but maybe you could incorporate some default things like a default window color as you proposed.
Title: Re: Updating WZGUILib
Post by: jwalker on April 09, 2013, 09:27:04 am
That is what I was thinking.
Also I have not gotten much work done as I have hit my busy season and it doesn't help that I graduate in like 28 days.
Title: Re: Updating WZGUILib
Post by: jwalker on April 20, 2013, 10:26:29 am
Could someone give me an example of an error handler? Mine never seems to get called, and I don't know what I'm doing wrong.
Title: Re: Updating WZGUILib
Post by: Adriweb on April 20, 2013, 01:21:59 pm
from line 4702 to 4718 for example :
https://github.com/adriweb/EEPro-for-Nspire/blob/master/EEPro.big.lua#L4702

It will only be called upon erroring.
Title: Re: Updating WZGUILib
Post by: jwalker on April 20, 2013, 02:37:47 pm
Wow, I just found out it works if you don't have breakpoints enabled...
Also I added the picture button.
Title: Re: Updating WZGUILib
Post by: jwalker on April 21, 2013, 09:31:56 am
I've also added a flashing cursor to textboxes, I also have done a few minor clean up things.
I'm planning to add more containers, such as group boxes and a grid control, the grid will not be drawn and will be there for cosmetic purposes. I also need to ad the table and work on scroll bars.
Title: Re: Updating WZGUILib
Post by: Dapianokid on April 21, 2013, 04:41:42 pm
This doesn't work on OS 3.1.0.192, does it?
Title: Re: Updating WZGUILib
Post by: jwalker on April 21, 2013, 09:04:20 pm
The most current one is for 3.2, but I do make a backward commatible version for 3.1.
Title: Re: Updating WZGUILib
Post by: Dapianokid on April 22, 2013, 05:43:34 pm
dooo want
Title: Re: Updating WZGUILib
Post by: jwalker on April 22, 2013, 09:32:57 pm
Go ahead and try it out sometime, I'm always able to answer questions.
Also I added a bindEvent function to dialogs, this is so you can re-rout say a close command back to a function that you define. I only have this so if you need to customize something like the close command. I will have an example of this as I am writing an example program and hope to have it up soon-ish.
Title: Re: Updating WZGUILib
Post by: jwalker on April 23, 2013, 09:29:01 am
Tonight Im going to add an ordered pair control.
Title: Re: Updating WZGUILib
Post by: Dapianokid on April 23, 2013, 07:38:56 pm
where is the newest backwards compatibile version?
Title: Re: Updating WZGUILib
Post by: jwalker on April 23, 2013, 07:41:35 pm
It hasn't even been made yet, but WZ 2.1 is still up at ticalc, which was released purely for OS 3.1, but that may change soon as most of these updates fix critical bugs.
Title: Re: Updating WZGUILib
Post by: jwalker on May 02, 2013, 09:37:10 am
So about three days ago I had to refresh Windows, thus loosing all of my programs. Fortunately all my files are fine and I reinstalled the student software. I am going to reinstall the PRIZM software and start porting WZ to the prizm
Title: Re: Updating WZGUILib
Post by: flyingfisch on May 02, 2013, 10:33:42 am
So about three days ago I had to refresh Windows, thus loosing all of my programs. Fortunately all my files are fine and I reinstalled the student software. I am going to reinstall the PRIZM software and start porting WZ to the prizm



Sounds great! what language, C or lua?
Title: Re: Updating WZGUILib
Post by: jwalker on May 02, 2013, 11:12:08 pm
It will be in lua for the time being, as it will be much easier to port. Although I am really looking at C as a viable option due to roadblocks I'm hitting.
Title: Re: Updating WZGUILib
Post by: jwalker on May 25, 2013, 10:28:14 am
So in the past few weeks I have done absolutely jack squat when it comes to this project, and that was due to lack of time. School has ended so I will be getting back to working on this.
Title: Re: Updating WZGUILib
Post by: jwalker on May 27, 2013, 06:31:07 pm
Here is an image of the new ordered pair control, it is not completely finished and I am going to go through and polish up my code a little.
I have also fixed several issues that caused instability.
Title: Re: Updating WZGUILib
Post by: jwalker on May 28, 2013, 02:31:14 pm
This is an example of the ordered pair control.
Currently it only works for x, y coordinates, but I will add a z coordinate option today and upload it.

constructor: x, y, sizeType, parent

sizeType can be 1, 2, or 3.
1: single number only
2: up to 3 numbers, or one negative sign and 2 numbers
3: up to 5 numbers, or one negative sign and 4 numbers
Title: Re: Updating WZGUILib
Post by: jwalker on May 29, 2013, 01:09:08 am
Here is an image of the control, just updated.
The new constructor is: x, y, sizeType, is3P, parent
Where is3P is a Boolean, true indicating a z option.

The reason I am not uploading the file is due to the fact that there are a few things I would like to tweak.
Title: Re: Updating WZGUILib
Post by: jwalker on June 03, 2013, 01:15:05 am
Finished ordered pair control, now working on slider
Title: Re: Updating WZGUILib
Post by: jwalker on June 04, 2013, 02:07:03 pm
I haven't decided between the rectangle in the picture, a circle or a triangle...
Maybe I will have all three as options.
Title: Re: Updating WZGUILib
Post by: ElementCoder on June 06, 2013, 02:26:07 am
The rectangle looks fine to me and a circle would work too. I don't know about a triangle, haven't used much triangular buttons lately :P
Title: Re: Updating WZGUILib
Post by: DJ Omnimaga on June 08, 2013, 12:45:06 am
So about three days ago I had to refresh Windows, thus loosing all of my programs. Fortunately all my files are fine and I reinstalled the student software. I am going to reinstall the PRIZM software and start porting WZ to the prizm

How did you re-install the student software on a new Windows install? I thought it was a one-time license... ???

Glad you didn't lose anything, though.

Also the control options looks very nice. I particularly like the slider thing. :)
Title: Re: Updating WZGUILib
Post by: jwalker on June 08, 2013, 10:14:09 am
Yeah I thought so too, but I tried it and my old license worked.
I think the slider will be nice when it is finished, its long awaited.
Title: Re: Updating WZGUILib
Post by: DJ Omnimaga on June 09, 2013, 01:14:44 am
It is possible that TI might have solved the whole one-time license issue, because they got many complaints about it from people who were switching computers or reformating.
Title: Re: Updating WZGUILib
Post by: jwalker on July 03, 2013, 07:58:43 pm
So recently I built a new computer and am currently migrating files, working etc. so I haven't had a whole lot of time to work on this. It has been over a year since my last actual release so I am going to put togeather all of my current documentation, utilities and complete several uncompleted controls and release them as Version 2.6. I should have it done in about 2 weeks. The main reason is there are a hell of a lot of bug fixes and optimizations in the current development version.
Title: Re: Updating WZGUILib
Post by: imath on July 06, 2013, 03:38:17 am
Perhaps we may as well write a Visual Lua based on C# and XML
Title: Re: Updating WZGUILib
Post by: jwalker on July 06, 2013, 10:52:15 am
Like an IDE, or a new language?
Title: Re: Updating WZGUILib
Post by: imath on July 07, 2013, 01:37:05 am
IDE.
like Visual Studio
Title: Re: Updating WZGUILib
Post by: imath on July 07, 2013, 01:53:44 am
I have seen your this project.It's wonderful and signficant.
If we have a IDE such as visual studio,we can draw the Object with our mouse insead of our codes.
Title: Re: Updating WZGUILib
Post by: DJ Omnimaga on July 07, 2013, 02:06:52 am
Good luck jwalker. By the way will you release it on all big sites?
Title: Re: Updating WZGUILib
Post by: imath on July 07, 2013, 07:07:26 am
such as this visual lua
Title: Re: Updating WZGUILib
Post by: jwalker on July 07, 2013, 11:49:21 am
@ imath: I have been thinking about maybe starting a project like this because it would greatly simplify the design and coding process.
@ DJ_O: I am going to release it on Omnimaga, Cemetech, TI-Calc. The file on TI-Planet is linked to the one on Omnimaga I believe, and I know of a copy at Inspired-lua, but I am not sure how that one is updated.
Title: Re: Updating WZGUILib
Post by: DJ Omnimaga on July 08, 2013, 12:07:42 am
Ok cool to hear. If you link to Omnimaga, though, make sure to link to the file info page instead of the direct download, in case you replace the file and the download link gives a 404 on TI-Planet.
Title: Re: Updating WZGUILib
Post by: Levak on July 08, 2013, 06:09:49 am
in case you replace the file and the download link gives a 404 on TI-Planet.
I don't understand your remark ?
You can update the archive details such as reupload the file on TI-Planet ... where is the problem ?
Title: Re: Updating WZGUILib
Post by: jwalker on July 08, 2013, 11:08:29 am
I was not the one who uploaded the file on TI-Planet
Title: Re: Re: Re: Updating WZGUILib
Post by: DJ Omnimaga on July 08, 2013, 12:06:40 pm
in case you replace the file and the download link gives a 404 on TI-Planet.
I don't understand your remark ?
You can update the archive details such as reupload the file on TI-Planet ... where is the problem ?
i was simply making sure that he doesn't forget to do that.
Title: Re: Updating WZGUILib
Post by: jwalker on July 20, 2013, 01:00:45 pm
Im working on a few extera tools. I probably will make a "Form Designer", but it would be included with a different release as Im approching the time limit I set for myself.
Title: Re: Updating WZGUILib
Post by: jwalker on July 25, 2013, 11:51:26 pm
Here is the tool used to create menu bars.
When you are typing in list items, type the name or action of a menu, press enter to go to a new line and then type another name or action.
Title: Re: Updating WZGUILib
Post by: jwalker on August 04, 2013, 12:01:29 pm
So the reason I didn't release WZ yet is because I found bugs caused by breaking the call system. This mainly effected the tabcontrol, but just in case there is a larger problem I decided to test every control.
I added the page control, and it is pretty much done. I just need to rout the rest of the functions its way.
I added a 'tag' member to radio buttons. This means that you can have certain radio buttons grouped together and clicking one of those wont effect other groups.
Title: Re: Updating WZGUILib
Post by: blauemauritius on August 04, 2013, 03:17:04 pm
you have added a jar-file. Do I need java or how can i use the file without java?
Title: Re: Updating WZGUILib
Post by: Levak on August 04, 2013, 03:20:01 pm
you have added a jar-file. Do I need java or how can i use the file without java?
Yes, you do need Java to run the Windows Builder.


On an other topic :
I was not the one who uploaded the file on TI-Planet
You may create an account so that I can attach it with the archive : you will then be able to update it when you want.
Title: Re: Updating WZGUILib
Post by: blauemauritius on August 04, 2013, 03:24:18 pm
thank you...

i don't know how can i use the jar-file in LUA for NSPIRE? I have inserted the jar-file in a java project, but i see only class files.

Is it possible to get the lua script?

Thank you in advance.
Title: Re: Updating WZGUILib
Post by: jwalker on August 04, 2013, 04:51:12 pm
The jar file is basically like an exe, except for java. On Windows you should be able to double click the .jar file and it will run. You can also use the java command from a command line.

Also here is the newest toolset and the most recent version (as in the one I am working on right now) of WZGUILIB.

Some changes:
Fixed a tabcontrol bug, fixed a bug in the Clicks function.
Changed what happens when you hit the titlebar of an unfocused form. Instead of it becoming focused and movable, it is now just focused and you have to click it again to make it moveable.
Added the page control. Similar to windows, and in fact inherits from window. It is basically like a window in the way it contains controls, but it is immobile and only one page can be displayed at a time.
I modified the way tabcontrols are drawn.

WZ should be a lot more stable too as I added lots of check code.

I added an error handler, and if you have a wzCons window it will print the error message to it.
I added code to the wzCons so that if the message is too large to fit into the window, it sets it to a new line.

I would expect another upload by tonight as I have a lot of development time.
Title: Re: Updating WZGUILib
Post by: blauemauritius on August 04, 2013, 04:58:22 pm
Thank you.

Double click doesn't work on my system. I don't know why.

With the java command from command line i got an error. I used cmd. I changed in the folder where i saved the jar file. And i tried "java -jar <file> . I think this should be fine or?
Title: Re: Updating WZGUILib
Post by: jwalker on August 04, 2013, 05:26:26 pm
This worked for me: java -jar "WZ_TAB_TOOL.jar"
You have to have quotation marks.
Title: Re: Updating WZGUILib
Post by: Adriweb on August 04, 2013, 08:15:23 pm
yep, both worked for me, be sure to have the latest JVM installed.
( http://www.java.com/fr/download/ )
Title: Re: Updating WZGUILib
Post by: jwalker on August 04, 2013, 09:53:59 pm
So, like I said here is another upload.
There is one major change. I used a modified version of the event distributer from inspired-lua and replaced all of the on events. Also, if you ever look back a couple of pages on this topic, you will notice an attached file that is called WZGUILIB_EV. The purpose of that file was to be able to take a WZ event, such as a window closing, and be able to run your own code in a callback function. This implements something similar, just with out all of the coding overhead. It is very simple,
form_or_dialog_name:bindEvent(string event, function callback). There is a catch though; at the end of your function before you return you must call the original handler code. This is possible because the first argument passed to your callback is the window that is supposed to receive the function. so if you had a form named winForm and a callback called closeCallback you can do this:
Code: [Select]
winform:bindEvent("close", closeCallback)

You closeCallback function then looks like this:
Code: [Select]
function closeCallback(window)
   print("Caught the close event")
   form.close(window)
end

This takes away a lot of coding and excess code from the original way that it was supposed to be done.
Title: Re: Updating WZGUILib
Post by: jwalker on August 06, 2013, 01:58:17 am
Here is a kind of test application. It uses several of the new concepts presented in the new WZ, such as function binding and that page control. I also added something special. I wrote it just today. I am introducing the new styled dialog. Currently there are three styles: OK, OK_CANCEL, and OK_CANCEL_TRYAGAIN. All you have to do is provide the callback. There is currently 3 things passed as arguments to your callback function:
callback(code, buttonObj, buttonObj_Parent).

the code is a 1, 2, or 3; They represent the button that were pressed.

I am not done with them, design wise. For functional purposes they are releasable.
Title: Re: Updating WZGUILib
Post by: jwalker on August 06, 2013, 09:20:56 pm
Does anyone know a good way to figure out an index of a string based on a pixel value?
Title: Re: Updating WZGUILib
Post by: DJ Omnimaga on August 07, 2013, 12:36:46 am
Sadly I don't D:, but glad to see a test application above. I'm gonna give it a try when I get some time :)
Title: Re: Updating WZGUILib
Post by: jwalker on August 07, 2013, 01:26:51 pm
That would be great. I am going to make several test applications in the near future, to release with WZ 2.5 in order to demonstrate several of the things that can be done with it.
Also I noticed that on Windows 8.1 the Nspire software dosent close properly, the window closes but it still runs in the background and wont let you open a new instance of it untill you kill the previous process.
Title: Re: Updating WZGUILib
Post by: jwalker on August 08, 2013, 12:43:47 pm
I've been working on the statusbar recently, and I have made significant progress. It should be finished or almost finished by the end of the day.
Title: Re: Updating WZGUILib
Post by: jwalker on August 12, 2013, 09:09:13 pm
Is there a way to get the value returned by a chunk loaded with loadstring?
I have tried:
pcall
xpcall
I also tried to set the environment with setfenv, but to no avail.
Title: Re: Updating WZGUILib
Post by: jwalker on August 15, 2013, 12:47:34 pm
I'm ready to say that there is a bug in TI's Lua. When you call a function created by loadstring, you are supposed to get any of the values returned by the function. That is not happening.
Title: Re: Updating WZGUILib
Post by: Jim Bauwens on August 16, 2013, 02:56:00 am
Can you post your code? So far I never have had a problem with it.
Title: Re: Updating WZGUILib
Post by: Adriweb on August 16, 2013, 08:00:38 am
Indeed http://www.wowwiki.com/API_loadstring#Returning_values (among other) suggests there is no problem getting returned values.
Title: Re: Updating WZGUILib
Post by: jwalker on August 16, 2013, 09:43:11 am
Basically when you press the enter key while using the console, it packages everything sent into a table. In this case the third value in the table will be the function name, and the fourth value in the table will be the other arguments.
Code: [Select]
           
for i = 5, #bt do
   bt[4] = bt[4]..", "..bt[i]
end
local fCall = assert(loadstring(bt[3].."("..bt[4]..")"))
a, b = fCall()
self:addHistoryEntry("Returned: "..tostring(a).." and "..tostring(b))
Title: Re: Updating WZGUILib
Post by: Jim Bauwens on August 16, 2013, 10:52:59 am
Let us analyse your code a bit to identify the problem. First let's replace bt[3] by 'myfunc' and bt[4] by 'params'.
That would give us the following code:

Code: [Select]
local fCall = assert(loadstring(myfunc.."("..params..")"))
a, b = fCall()
self:addHistoryEntry("Returned: "..tostring(a).." and "..tostring(b))

Now, what does loadstring do? Create a chunk from the given data. Basically, create a function with the contents that you pass to loadstring. So if we evaluate what actually happens, we get something like this:
Code: [Select]
function fCall()
   myfunc(params)
end

As you can see, the function will never return anything because it doesn't contain a return statement. So there is your problem ;)

Now, about the code itself, do not use loadstring for this. It will significantly slow down your script. Rather do something like this:
Code: [Select]
local params = {}
for i = 4, #bt do
   table.insert(params, bt[i])
end
local myfunc = _G[bt[3]] -- if it's a global function that is
a, b = myfunc(unpack(params))
self:addHistoryEntry("Returned: "..tostring(a).." and "..tostring(b))

Now, this is code for the situation that you have now. If possible, just pass the function as a reference, not as a string. Then put all the parameters in a table so that you don't need to copy them in a new one. Something like this:
{data, data, functionreference, {param1, param2}}
Then you could do a, b = bt[3](unpack(bt[4]))
Title: Re: Updating WZGUILib
Post by: jwalker on September 26, 2013, 08:20:36 am
Sorry for my silence for the last month, I just started college and it has been hectic! I haven't gotten a lot done, but I have been working on this project periodically.
Title: Re: Updating WZGUILib
Post by: jwalker on September 28, 2013, 11:22:27 pm
With this update, I corrected the call system on the console.
Title: Re: Updating WZGUILib
Post by: DJ Omnimaga on September 28, 2013, 11:22:57 pm
Glad to see you are still working on this :)
Title: Re: Updating WZGUILib
Post by: jwalker on October 16, 2013, 10:24:02 pm
Here is a partial example program that I was working on for physics, but unfortunately never finished before the test  :P
It displays several important things that can be done with WZ such as encapsulating forms with all of their objects into classes and event binding.
It also shows my bad graphics drawing abilities  :P
Title: Re: Updating WZGUILib
Post by: jwalker on November 20, 2013, 12:05:44 pm
So I upgraded from 8.1 preview to 8.1 and am working on getting a new license, should be back up and developing soon.
Title: Re: Updating WZGUILib
Post by: jwalker on January 05, 2014, 01:25:12 pm
I got my license and will be resuming development. During my break I have been working on improving my C skills and am really considering porting everything to C. By keeping all of the WZ definitions abstract this project would be very portable and would allow way more flexibility. I guess we will see what happens when the time comes. Until then I need to finish up my documentation before classes resume so maybe expect something by the end of next week? I am a slave to my schedule so I will see how it goes.
Title: Re: Re: Updating WZGUILib
Post by: DJ Omnimaga on January 05, 2014, 01:57:11 pm
Glad to hear. Hopefully you can have more free time soon, too. :)
Title: Re: Updating WZGUILib
Post by: flyingfisch on January 05, 2014, 03:33:23 pm
can't wait for the PRIZM version, I have a project I would like to do but I need WZGUILIB. ;)
Title: Re: Updating WZGUILib
Post by: jwalker on January 06, 2014, 11:00:43 am
I really want to make a prizm version, but has anything happened with LuaZM? I think it was stable enough to port WZ so It will be the next thing on my list.
Title: Re: Re: Updating WZGUILib
Post by: DJ Omnimaga on January 06, 2014, 11:45:09 am
I think. LuaZM should be fine enough, but I guess Flyingfisch and Kerm would need to confirm.
Title: Re: Updating WZGUILib
Post by: jwalker on January 06, 2014, 01:07:15 pm
I think when I looked into it, I thought it was also fine. I will have to do so again soon.
Title: Re: Updating WZGUILib
Post by: jwalker on January 07, 2014, 09:49:22 am
So Last night I did a little bit of messing around with the button drawing code and came up with this. Which of the three do you like better?
Title: Re: Updating WZGUILib
Post by: DJ Omnimaga on January 07, 2014, 11:21:01 am
I prefer the New 1 button.
Title: Re: Updating WZGUILib
Post by: Sorunome on January 07, 2014, 11:57:42 am
Me too, i like New 1 most.
Title: Re: Updating WZGUILib
Post by: flyingfisch on January 07, 2014, 12:41:57 pm
I think. LuaZM should be fine enough, but I guess Flyingfisch and Kerm would need to confirm.

LuaZM should be OK, though there are issues with loading libraries.

I would like it in both C and LuaZM, don't know how hard that would be.
Title: Re: Updating WZGUILib
Post by: Levak on January 07, 2014, 01:20:22 pm
I would like it in both C and LuaZM, don't know how hard that would be.
As f**ing hard as porting SDL in both C and Lua, and this, just for you ? IMHO of course.
Feel free to downgrade this post, but I hate the way "can't wait a PRIZM version" and "I want it in both C and LuaZM" are formulated, so demanding ...
Title: Re: Updating WZGUILib
Post by: DJ Omnimaga on January 07, 2014, 02:48:10 pm
In a nicer way, I would also add that it can be hard to develop for a calculator that we don't own. It is far worse with the PRIZM, because the simulator has a 90 day trial period that is very hard to get around and the full version is $200. On top of that, LuaZM is an interpreter written in C, and C/ASM doesn't run properly in the emulator (either too slow, too fast or freezing).
Title: Re: Updating WZGUILib
Post by: jwalker on January 07, 2014, 03:00:49 pm
Well, I do want to port it to the PRIZM, and the hardest part is just changing around the drawing code/hardware things, everything else is platform independent. Like DJ said its hard to work with the PRIZM because the emulator is $200. What I want to do is get this version released and then download the emulator and get this ported over to the PRIZM. The C versions are possible, just I need to get the lua versions completed first, so I don't end up working on 2 projects at once. The C version will start out being PRIZM only, and as I have time I will port it over to the Nspire. The porting process of the C version also wont be that hard because almost everything but the drawing code and other hardware related aspects will be platform independent.
Title: Re: Updating WZGUILib
Post by: DJ Omnimaga on January 07, 2014, 05:17:37 pm
Actually, looking at your profile, I notice that you actually have a PRIZM. I guess it wouldn't be as hard, then. Developing for a calc you don't own can be extremely annoying, since you need to rely on testers to make sure your program works. This can be annoying with timezones and different schedules.
Title: Re: Updating WZGUILib
Post by: flyingfisch on January 14, 2014, 01:44:58 pm
I would like it in both C and LuaZM, don't know how hard that would be.
As f**ing hard as porting SDL in both C and Lua, and this, just for you ? IMHO of course.
Feel free to downgrade this post, but I hate the way "can't wait a PRIZM version" and "I want it in both C and LuaZM" are formulated, so demanding ...

In a nicer way, I would also add that it can be hard to develop for a calculator that we don't own. It is far worse with the PRIZM, because the simulator has a 90 day trial period that is very hard to get around and the full version is $200. On top of that, LuaZM is an interpreter written in C, and C/ASM doesn't run properly in the emulator (either too slow, too fast or freezing).

Umm, firstly, he already said he wanted to port to C:
I got my license and will be resuming development. During my break I have been working on improving my C skills and am really considering porting everything to C. By keeping all of the WZ definitions abstract this project would be very portable and would allow way more flexibility. I guess we will see what happens when the time comes. Until then I need to finish up my documentation before classes resume so maybe expect something by the end of next week? I am a slave to my schedule so I will see how it goes.

Secondly, he has been saying he is going to port to prizm for quite a while. And as DJ said, he also owns a prizm.

So I really don't see why I got a downvote.
Title: Re: Updating WZGUILib
Post by: Levak on January 14, 2014, 02:02:03 pm
So I really don't see why I got a downvote.

The real problem is on the form, as I said it in my previous post, even if he has the will to port it.
Also, if he already said he has the will to do it, why demanding it again ? (yes, your post looks like a demand).
Title: Re: Updating WZGUILib
Post by: flyingfisch on January 14, 2014, 08:39:48 pm
The real problem is on the form, as I said it in my previous post, even if he has the will to port it.
Also, if he already said he has the will to do it, why demanding it again ? (yes, your post looks like a demand).
LuaZM should be OK, though there are issues with loading libraries.

I would like it in both C and LuaZM, don't know how hard that would be.

I am sorry about asking in that form. I was in a hurry and that was how it came to me. On another note, I think maybe it would have been better to use the report to moderator link or let jwalker himself complain about my form.

And the form of the rebuke you made to my post sounded a bit insulting, just so you know. ;)

Also, as a developer myself, I know very well how hard it is to port things from lua to C and vice versa. I also know how hard it is to port from other platforms to PRIZM. And I know that a demanding community can be an issue, but as I said, I don't think I was really being overly demanding.
Title: Re: Updating WZGUILib
Post by: jwalker on January 30, 2014, 11:57:23 pm
Here is a version with the new button style, fixed clipping on tab controls and a newly styled checkbox to go along with the new button style. Over time I will be restyling and fixing issues with controls and releases like these will be more common. To view the new checkbox, just uncomment ncheckbox and comment out tabcontrol in the on.construction method.
Title: Re: Updating WZGUILib
Post by: DJ Omnimaga on January 31, 2014, 01:36:30 am
Good to see a new update :D
Title: Re: Updating WZGUILib
Post by: jwalker on March 04, 2014, 08:21:43 pm
Here is the newest update. Shows the new look of buttons and checkboxes. There will be more to come as I update the looks of the controls.
This also fixes the tab control yet again. I tested it thoroughly and all drawing problems should be fixed.
I plan to add a way to scroll through the tabs.
Title: Re: Updating WZGUILib
Post by: DJ Omnimaga on March 05, 2014, 02:54:18 am
Pretty nice, as always. :D By the way, I wonder if gradients in title bars would look nice?
Title: Re: Updating WZGUILib
Post by: jwalker on June 22, 2014, 08:51:07 am
So I have been working off and on when I get time, I think I will round off what I have done once I rewrite textboxes and make an actual release, but that may not be for a while as it depends on the time that I have. I have done some optimizations and I would like to do more if it is possible so that this library will be sped up.
Title: Re: Updating WZGUILib
Post by: DJ Omnimaga on September 22, 2014, 01:52:59 am
You are finally getting your front page mention for this program. I don't know if it's still being worked on, but I finally cleared the 2 years long utility feature pending queue and the news will appear as soon as staff approves it. :)
Title: Re: Updating WZGUILib
Post by: jwalker on October 01, 2014, 11:16:21 pm
I am still working on it off and on, but I actually have started a rewriting process recently to make necessary changes that could have been made with the current code base. I may upload an image of some of the newly reworked stuff soon.
Title: Re: Updating WZGUILib
Post by: DJ Omnimaga on October 02, 2014, 11:26:46 am
Ah ok good to hear. :) WIll you keep the same graphics?
Title: Re: Updating WZGUILib
Post by: jwalker on October 02, 2014, 12:32:33 pm
As of right now I'm still using the "flat", single color graphics like in the old lib, but I have tested out some gradients when it comes to window title bars. Everything will look very familiar with those acquainted with the previous lib. In fact all controls can be ported to the new lib by removing a parameter and one line of code from the controls constructor. One big difference is Forms are now called "Windows" and controls are added to Windows by using the Window:addControl() method.
Title: Re: Updating WZGUILib
Post by: DJ Omnimaga on October 02, 2014, 01:03:50 pm
Maybe you could have multiple theme supports ^^ (and perhaps custom ones?)
Title: Re: Updating WZGUILib
Post by: jwalker on October 02, 2014, 06:37:20 pm
Themes are something I am definitely interested in, and I may try and implement it as I get farther down the road.
Here is the first view:
Title: Re: Updating WZGUILib
Post by: DJ Omnimaga on October 03, 2014, 12:54:05 am
That looks nice, although I would probably make the button icons bold or something so they're more visible. Perhaps a different shade too?


By the way do you plan to retain OS 3.1 compatibility? I notice that many Lua programmers have dropped OS 3.1 (and even 3.6) compatibility now.
Title: Re: Updating WZGUILib
Post by: jwalker on October 04, 2014, 03:34:38 pm
It's hard to say what will be supported, right now everything is at least 3.6 compliant. I think that previously it could be make apileve 1.0 compliant by changing on.construction to on.create. If anything 3.6 will be supported.
Title: Re: Updating WZGUILib
Post by: Adriweb on October 04, 2014, 07:42:43 pm
supporting 3.1 is annoying, but from 3.2+ it's not a problem.
Title: Re: Updating WZGUILib
Post by: DJ Omnimaga on October 04, 2014, 07:45:24 pm
The main issue by not supporting 3.1 is that some Ndless users still use it because even without nLaunchy installed Ndless will still remain installed after reboots. That said, it's more an issue about being too lazy (including myself :P) to learn how to install nLaunch and OS 3.6 and people being concerned about 3.6 taking more memory than 3.1. Lua has been drastically improved after OS 3.1.
Title: Re: Updating WZGUILib
Post by: jwalker on October 05, 2014, 10:56:02 am
There will be support for at least 3.6. Like Adriweb has said it is a pain to support 3.1. It may not take many changes to make the Lib 3.1 compatible though because the bulk of my code is drawing and event handling.
Title: Re: Updating WZGUILib
Post by: jwalker on October 17, 2014, 12:16:56 pm
I am kind of stuck on the TextBox Control once again. It currently acts like the previous textbox control but that is not acceptable as it had no way to edit the text other than backspacing and rewriting it. Does anyone know of any good example of textboxes and how the are rendered? Ive been doing google searches but have been having a tough time finding source code examples.
Title: Re: Updating WZGUILib
Post by: DJ Omnimaga on November 03, 2014, 01:21:25 am
Sorry I missed your post. You might need to ask in the Lua sub-forum so that people see it, else people who only check help topics will miss your question. I can't help sadly, though. Have you checked the Nspire-Lua wiki?
Title: Re: Updating WZGUILib
Post by: jwalker on November 03, 2015, 06:13:32 pm
It has been a while.... I want to get back into working on this again, but I want to know: whats new? I noticed there still isn't a lot of activity when it comes to Lua development on the TI-Nspire platform. Has anything important been added to TI-Nspire Lua?