AW: GUI Problem....

Previous Topic Next Topic
 
classic Classic list List threaded Threaded
2 messages Options
Reply | Threaded
Open this post in threaded view
|

AW: GUI Problem....

Emil Tchekov-3

Hi,

you should not call screen.clear() after creating the label... Thats why you can not see it - created and mikroseconds later destroyed (overdrawn) again.

very best regards

Emil

P.S. Just put screen.clear() directly after gui.destroy()...

--- jimmy joe jack <[hidden email]> schrieb am Do, 9.7.2009:

> Von: jimmy joe jack <[hidden email]>
> Betreff: [plua] GUI Problem....
> An: [hidden email]
> Datum: Donnerstag, 9. Juli 2009, 7:30
> Hey, I was wondering about something.
> I'm a little tired and a bit hazy about what to do with this
> myself, so hopefully this is clear.
>
> Basically, for giggles, I'm building like a budget
> calculator. I want it to have tabs for four pages at the
> top, so I switch to one screen I can total up my bills,
> another one my food...etc.
>
> Not being an experienced programmer (at all), my method of
> creating "new screens" was to do a gui.destroy within a
> function and build a whole new page within a function, when
> a certain button is pressed. But after I put gui.destroy(),
> it seems like it won't let me put any new GUI stuff after.
> Like my "FOOD" label. Here's the code (so far). Hope this
> makes sense.
>
>
> function page2()
> gui.destroy()
> screen.clear()
> screen.moveto(0,40)
> gui.label("FOOD")
>
>
> screen.clear()
> gui.title("Budget Calculator")
> gui.menu({"exit"})
> screen.moveto(220,0)
> p1=gui.pbutton("1",1)
> p2=gui.pbutton("2",1)
> p3=gui.pbutton("3",1)
> p4=gui.pbutton("4",1)
>
> screen.moveto(0, 40)
> gui.label("BILLS:")
> screen.moveto(0,80)
> gui.label("Car Insurance")
> screen.moveto(150,80)
> gui.label("$")
> field1=gui.field(1,6,6,e)
>
> gui.inserttext(field1,"hello")
>
> screen.moveto(0,100)
> gui.label("House Payment")
> screen.moveto(150,100)
> gui.label("$")
> field2=gui.field(1,6,6,e)
>
> screen.moveto(0,120)
> gui.label("Gas")
> screen.moveto(150,120)
> gui.label("$")
> field3=gui.field(1,6,6,e)
>
> screen.moveto(0,140)
> gui.label("Electric")
> screen.moveto(150,140)
> gui.label("$")
> field4=gui.field(1,6,6,e)
>
> screen.moveto(0,160)
> gui.label("Water")
> screen.moveto(150,160)
> gui.label("$")
> field5=gui.field(1,6,6,e)
>
> screen.moveto(0,180)
> gui.label("Garbage")
> screen.moveto(150,180)
> gui.label("$")
> field6=gui.field(1,6,6,e)
>
> screen.moveto(0,200)
> gui.label("Association Fee")
> screen.moveto(150,200)
> gui.label("$")
> field7=gui.field(1,6,6,e)
>
> screen.moveto(0,220)
> gui.label("Internet")
> screen.moveto(150,220)
> gui.label("$")
> field8=gui.field(1,6,6,e)
>
> screen.moveto(0,240)
> gui.label("Car Gas")
> screen.moveto(150,240)
> gui.label("$")
> field9=gui.field(1,6,6,e)
>
>
> while true do
> ev,id=gui.event()
> if ev==appStop then break end
> if ev==menuSelect and id==1 then os.exit() end
> if ev==ctlSelect and id==p2 then  page2() end
> end
>
> gui.main()
>
>
>
>
> ------------------------------------
>
> Yahoo! Groups Links
>
>
>     mailto:[hidden email]
>
>
>


     
Reply | Threaded
Open this post in threaded view
|

Re: GUI Problem....

jimmy joe jack
uuuuuuy... yah, duh. I think I see what's going on. Thanks for the tip. I also forgot to put my end statement on my function, (although it's correct in the program, and of course wasn't the problem). So I've fixed that for your viewing pleasure.


--- In [hidden email], Emil Tchekov <etchekov@...> wrote:

>
>
> Hi,
>
> you should not call screen.clear() after creating the label... Thats why you can not see it - created and mikroseconds later destroyed (overdrawn) again.
>
> very best regards
>
> Emil
>
> P.S. Just put screen.clear() directly after gui.destroy()...
>
> --- jimmy joe jack <wildcard_seven@...> schrieb am Do, 9.7.2009:
>
> > Von: jimmy joe jack <wildcard_seven@...>
> > Betreff: [plua] GUI Problem....
> > An: [hidden email]
> > Datum: Donnerstag, 9. Juli 2009, 7:30
> > Hey, I was wondering about something.
> > I'm a little tired and a bit hazy about what to do with this
> > myself, so hopefully this is clear.
> >
> > Basically, for giggles, I'm building like a budget
> > calculator. I want it to have tabs for four pages at the
> > top, so I switch to one screen I can total up my bills,
> > another one my food...etc.
> >
> > Not being an experienced programmer (at all), my method of
> > creating "new screens" was to do a gui.destroy within a
> > function and build a whole new page within a function, when
> > a certain button is pressed. But after I put gui.destroy(),
> > it seems like it won't let me put any new GUI stuff after.
> > Like my "FOOD" label. Here's the code (so far). Hope this
> > makes sense.
> >
> > CODE EDITED:

> > function page2()
> > gui.destroy()
> > screen.clear()
> > screen.moveto(0,40)
> > gui.label("FOOD")
    end

> >
> >
> > screen.clear()
> > gui.title("Budget Calculator")
> > gui.menu({"exit"})
> > screen.moveto(220,0)
> > p1=gui.pbutton("1",1)
> > p2=gui.pbutton("2",1)
> > p3=gui.pbutton("3",1)
> > p4=gui.pbutton("4",1)
> >
> > screen.moveto(0, 40)
> > gui.label("BILLS:")
> > screen.moveto(0,80)
> > gui.label("Car Insurance")
> > screen.moveto(150,80)
> > gui.label("$")
> > field1=gui.field(1,6,6,e)
> >
> > gui.inserttext(field1,"hello")
> >
> > screen.moveto(0,100)
> > gui.label("House Payment")
> > screen.moveto(150,100)
> > gui.label("$")
> > field2=gui.field(1,6,6,e)
> >
> > screen.moveto(0,120)
> > gui.label("Gas")
> > screen.moveto(150,120)
> > gui.label("$")
> > field3=gui.field(1,6,6,e)
> >
> > screen.moveto(0,140)
> > gui.label("Electric")
> > screen.moveto(150,140)
> > gui.label("$")
> > field4=gui.field(1,6,6,e)
> >
> > screen.moveto(0,160)
> > gui.label("Water")
> > screen.moveto(150,160)
> > gui.label("$")
> > field5=gui.field(1,6,6,e)
> >
> > screen.moveto(0,180)
> > gui.label("Garbage")
> > screen.moveto(150,180)
> > gui.label("$")
> > field6=gui.field(1,6,6,e)
> >
> > screen.moveto(0,200)
> > gui.label("Association Fee")
> > screen.moveto(150,200)
> > gui.label("$")
> > field7=gui.field(1,6,6,e)
> >
> > screen.moveto(0,220)
> > gui.label("Internet")
> > screen.moveto(150,220)
> > gui.label("$")
> > field8=gui.field(1,6,6,e)
> >
> > screen.moveto(0,240)
> > gui.label("Car Gas")
> > screen.moveto(150,240)
> > gui.label("$")
> > field9=gui.field(1,6,6,e)
> >
> >
> > while true do
> > ev,id=gui.event()
> > if ev==appStop then break end
> > if ev==menuSelect and id==1 then os.exit() end
> > if ev==ctlSelect and id==p2 then  page2() end
> > end
> >
> > gui.main()
> >
   end

> >
> >
> >
> > ------------------------------------
> >
> > Yahoo! Groups Links
> >
> >
> >     mailto:[hidden email]
> >
> >
> >
>