Author Topic: Updating WZGUILib  (Read 156211 times)

0 Members and 3 Guests are viewing this topic.

Offline Nick

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

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 #31 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?
<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 #32 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
« Last Edit: January 04, 2012, 09:34:51 am by Nick »

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 #33 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
<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 #34 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?

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 #35 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
<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 #36 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 :)
« Last Edit: January 08, 2012, 10:02:44 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 flyingfisch

  • I'm 1337 now!
  • Members
  • LV10 31337 u53r (Next: 2000)
  • **********
  • Posts: 1620
  • Rating: +94/-17
  • Testing, testing, 1...2...3...4...5...6...7...8..9
    • View Profile
    • Top Page Website Design
Re: Updating WZGUILib
« Reply #37 on: January 06, 2012, 09:18:17 am »
I'm going to take a look at that code :)



Quote from: my dad
"welcome to the world of computers, where everything seems to be based on random number generators"



The Game V. 2.0

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 #38 on: January 06, 2012, 09:20:33 am »
sounds good
<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 #39 on: January 06, 2012, 09:55:43 am »
oh, great, a realease.. i'll check it

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 #40 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
<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 #41 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 :)
« Last Edit: January 06, 2012, 10:14:37 am by Nick »

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 #42 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!!
<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 #43 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

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 #44 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..
<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