Calculator Community > Lua

Updating WZGUILib

<< < (2/78) > >>

Jim Bauwens:
Just check ticalc.org :)

epic7:
So... Whats wsguilib? A GUI library?

Nick:
yes it is a set of radiobuttons, checkboxes, screens, textboxes etc

here's a pic of it:

jwalker:
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: ---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
--- End code ---
i probably would have worked on it way more, but i found a bug in the picture box function

Nick:
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

Navigation

[0] Message Index

[#] Next page

[*] Previous page

Go to full version