Author Topic: Updating WZGUILib  (Read 156334 times)

0 Members and 1 Guest are viewing this topic.

Offline jwalker

  • LV7 Elite (Next: 700)
  • *******
  • Posts: 660
  • Rating: +13/-0
  • Almost everything I have released includes a 'WZ'
    • View Profile
Re: Updating WZGUILib
« Reply #90 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)
<a href="http://www.nerdtests.com/ft_cg.php?im">
<img src="http://www.nerdtests.com/images/ft/cg.php?val=9612" alt="My computer geek score is greater than 41% of all people in the world! How do you compare? Click here to find out!"> </a>

Support Casio-Scene against the attacks of matt @ matpac.co.uk ! For more information: Casio-Scene shuts down & Matt actions threads

Offline jwalker

  • LV7 Elite (Next: 700)
  • *******
  • Posts: 660
  • Rating: +13/-0
  • Almost everything I have released includes a 'WZ'
    • View Profile
Re: Updating WZGUILib
« Reply #91 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.
<a href="http://www.nerdtests.com/ft_cg.php?im">
<img src="http://www.nerdtests.com/images/ft/cg.php?val=9612" alt="My computer geek score is greater than 41% of all people in the world! How do you compare? Click here to find out!"> </a>

Support Casio-Scene against the attacks of matt @ matpac.co.uk ! For more information: Casio-Scene shuts down & Matt actions threads

Offline jwalker

  • LV7 Elite (Next: 700)
  • *******
  • Posts: 660
  • Rating: +13/-0
  • Almost everything I have released includes a 'WZ'
    • View Profile
Re: Updating WZGUILib
« Reply #92 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
« Last Edit: May 30, 2012, 12:12:22 am by jwalker »
<a href="http://www.nerdtests.com/ft_cg.php?im">
<img src="http://www.nerdtests.com/images/ft/cg.php?val=9612" alt="My computer geek score is greater than 41% of all people in the world! How do you compare? Click here to find out!"> </a>

Support Casio-Scene against the attacks of matt @ matpac.co.uk ! For more information: Casio-Scene shuts down & Matt actions threads

Offline jwalker

  • LV7 Elite (Next: 700)
  • *******
  • Posts: 660
  • Rating: +13/-0
  • Almost everything I have released includes a 'WZ'
    • View Profile
Re: Updating WZGUILib
« Reply #93 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
<a href="http://www.nerdtests.com/ft_cg.php?im">
<img src="http://www.nerdtests.com/images/ft/cg.php?val=9612" alt="My computer geek score is greater than 41% of all people in the world! How do you compare? Click here to find out!"> </a>

Support Casio-Scene against the attacks of matt @ matpac.co.uk ! For more information: Casio-Scene shuts down & Matt actions threads

Offline Jim Bauwens

  • Lua! Nspire! Linux!
  • Editor
  • LV10 31337 u53r (Next: 2000)
  • **********
  • Posts: 1881
  • Rating: +206/-7
  • Linux!
    • View Profile
    • nothing...
Re: Updating WZGUILib
« Reply #94 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.

Offline jwalker

  • LV7 Elite (Next: 700)
  • *******
  • Posts: 660
  • Rating: +13/-0
  • Almost everything I have released includes a 'WZ'
    • View Profile
Re: Updating WZGUILib
« Reply #95 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
<a href="http://www.nerdtests.com/ft_cg.php?im">
<img src="http://www.nerdtests.com/images/ft/cg.php?val=9612" alt="My computer geek score is greater than 41% of all people in the world! How do you compare? Click here to find out!"> </a>

Support Casio-Scene against the attacks of matt @ matpac.co.uk ! For more information: Casio-Scene shuts down & Matt actions threads

Offline jwalker

  • LV7 Elite (Next: 700)
  • *******
  • Posts: 660
  • Rating: +13/-0
  • Almost everything I have released includes a 'WZ'
    • View Profile
Re: Updating WZGUILib
« Reply #96 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(.....))
<a href="http://www.nerdtests.com/ft_cg.php?im">
<img src="http://www.nerdtests.com/images/ft/cg.php?val=9612" alt="My computer geek score is greater than 41% of all people in the world! How do you compare? Click here to find out!"> </a>

Support Casio-Scene against the attacks of matt @ matpac.co.uk ! For more information: Casio-Scene shuts down & Matt actions threads

Offline Nick

  • LV9 Veteran (Next: 1337)
  • *********
  • Posts: 1166
  • Rating: +161/-3
  • You just got omnom'd
    • View Profile
    • Nick Steen
Re: Updating WZGUILib
« Reply #97 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

Offline jwalker

  • LV7 Elite (Next: 700)
  • *******
  • Posts: 660
  • Rating: +13/-0
  • Almost everything I have released includes a 'WZ'
    • View Profile
Re: Updating WZGUILib
« Reply #98 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.
<a href="http://www.nerdtests.com/ft_cg.php?im">
<img src="http://www.nerdtests.com/images/ft/cg.php?val=9612" alt="My computer geek score is greater than 41% of all people in the world! How do you compare? Click here to find out!"> </a>

Support Casio-Scene against the attacks of matt @ matpac.co.uk ! For more information: Casio-Scene shuts down & Matt actions threads

Offline jwalker

  • LV7 Elite (Next: 700)
  • *******
  • Posts: 660
  • Rating: +13/-0
  • Almost everything I have released includes a 'WZ'
    • View Profile
Re: Updating WZGUILib
« Reply #99 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
<a href="http://www.nerdtests.com/ft_cg.php?im">
<img src="http://www.nerdtests.com/images/ft/cg.php?val=9612" alt="My computer geek score is greater than 41% of all people in the world! How do you compare? Click here to find out!"> </a>

Support Casio-Scene against the attacks of matt @ matpac.co.uk ! For more information: Casio-Scene shuts down & Matt actions threads

Offline jwalker

  • LV7 Elite (Next: 700)
  • *******
  • Posts: 660
  • Rating: +13/-0
  • Almost everything I have released includes a 'WZ'
    • View Profile
Re: Updating WZGUILib
« Reply #100 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.
<a href="http://www.nerdtests.com/ft_cg.php?im">
<img src="http://www.nerdtests.com/images/ft/cg.php?val=9612" alt="My computer geek score is greater than 41% of all people in the world! How do you compare? Click here to find out!"> </a>

Support Casio-Scene against the attacks of matt @ matpac.co.uk ! For more information: Casio-Scene shuts down & Matt actions threads

Offline Adriweb

  • Editor
  • LV10 31337 u53r (Next: 2000)
  • **********
  • Posts: 1708
  • Rating: +229/-17
    • View Profile
    • TI-Planet.org
Re: Updating WZGUILib
« Reply #101 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 ?
My calculator programs
TI-Planet.org co-admin.
TI-Nspire Lua programming : Tutorials  |  API Documentation

Offline jwalker

  • LV7 Elite (Next: 700)
  • *******
  • Posts: 660
  • Rating: +13/-0
  • Almost everything I have released includes a 'WZ'
    • View Profile
Re: Updating WZGUILib
« Reply #102 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.
<a href="http://www.nerdtests.com/ft_cg.php?im">
<img src="http://www.nerdtests.com/images/ft/cg.php?val=9612" alt="My computer geek score is greater than 41% of all people in the world! How do you compare? Click here to find out!"> </a>

Support Casio-Scene against the attacks of matt @ matpac.co.uk ! For more information: Casio-Scene shuts down & Matt actions threads

Offline Adriweb

  • Editor
  • LV10 31337 u53r (Next: 2000)
  • **********
  • Posts: 1708
  • Rating: +229/-17
    • View Profile
    • TI-Planet.org
Re: Updating WZGUILib
« Reply #103 on: June 12, 2012, 08:06:51 pm »
OK, well if you have any issue, tell us :P
My calculator programs
TI-Planet.org co-admin.
TI-Nspire Lua programming : Tutorials  |  API Documentation

Offline jwalker

  • LV7 Elite (Next: 700)
  • *******
  • Posts: 660
  • Rating: +13/-0
  • Almost everything I have released includes a 'WZ'
    • View Profile
Re: Updating WZGUILib
« Reply #104 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
<a href="http://www.nerdtests.com/ft_cg.php?im">
<img src="http://www.nerdtests.com/images/ft/cg.php?val=9612" alt="My computer geek score is greater than 41% of all people in the world! How do you compare? Click here to find out!"> </a>

Support Casio-Scene against the attacks of matt @ matpac.co.uk ! For more information: Casio-Scene shuts down & Matt actions threads