Author Topic: Updating WZGUILib  (Read 156057 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 #135 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?
<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 #136 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.
« Last Edit: July 18, 2012, 10:06:06 am by jimbauwens »

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 #137 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.
« Last Edit: July 18, 2012, 12:59:07 pm 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 #138 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.
<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 #139 on: July 21, 2012, 02:58:18 am »
Well that's a very nice idea :D
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 #140 on: July 21, 2012, 09:41:12 pm »
thank you
<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 #141 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

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 #142 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
<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 #143 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

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 #144 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
<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 DJ Omnimaga

  • Clacualters are teh gr33t
  • CoT Emeritus
  • LV15 Omnimagician (Next: --)
  • *
  • Posts: 55943
  • Rating: +3154/-232
  • CodeWalrus founder & retired Omnimaga founder
    • View Profile
    • Dream of Omnimaga Music
Re: Updating WZGUILib
« Reply #145 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

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 #146 on: July 22, 2012, 07:47:19 pm »
true, but I am using home premium...
<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 DJ Omnimaga

  • Clacualters are teh gr33t
  • CoT Emeritus
  • LV15 Omnimagician (Next: --)
  • *
  • Posts: 55943
  • Rating: +3154/-232
  • CodeWalrus founder & retired Omnimaga founder
    • View Profile
    • Dream of Omnimaga Music
Re: Updating WZGUILib
« Reply #147 on: July 22, 2012, 07:48:56 pm »
Ah that sucks. I actually had Home too but upgraded.

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 #148 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)
« Last Edit: July 22, 2012, 08:14:47 pm 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 alberthrocks

  • Moderator
  • LV8 Addict (Next: 1000)
  • ********
  • Posts: 876
  • Rating: +103/-10
    • View Profile
Re: Updating WZGUILib
« Reply #149 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, 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
Withgusto Networks Founder and Administrator
Main Server Status: http://withg.org/status/
Backup Server Status: Not available
Backup 2/MC Server Status: http://mc.withg.org/status/


Proud member of ClrHome!

Miss my old signature? Here it is!
Spoiler For Signature:
Alternate "New" IRC post notification bot (Newy) down? Go here to reset it! http://withg.org/albert/cpuhero/

Withgusto Networks Founder and Administrator
Main Server Status: http://withg.org/status/
Backup Server Status: Not available
Backup 2/MC Server Status: http://mc.withg.org/status/

Activity remains limited due to busyness from school et al. Sorry! :( Feel free to PM, email, or if you know me well enough, FB me if you have a question/concern. :)

Don't expect me to be online 24/7 until summer. Contact me via FB if you feel it's urgent.


Proud member of ClrHome!

Spoiler For "My Projects! :D":
Projects:

Computer/Web/IRC Projects:
C______c: 0% done (Doing planning and trying to not forget it :P)
A_____m: 40% done (Need to develop a sophisticated process queue, and a pretty web GUI)
AtomBot v3.0: 0% done (Planning stage, may do a litmus test of developer wants in the future)
IdeaFrenzy: 0% done (Planning and trying to not forget it :P)
wxWabbitemu: 40% done (NEED MOAR FEATURES :P)

Calculator Projects:
M__ C_____ (an A____ _____ clone): 0% done (Need to figure out physics and Axe)
C2I: 0% done (planning, checking the demand for it, and dreaming :P)