
-----------------------------------
unknowngiver
Thu May 25, 2006 4:35 pm

better way to do this?
-----------------------------------
Hey
is there a better way to do this?
i have a navigation bar and i want to check what button is clicked and then display that stuff
this is wt my teacher told me to do but i dont like it..as when i have more buttons it will be really crappy


if page_main = true then

    GameServer.main_content (serverAddress + "maincontent.txt")
end if

loop

    if page_reg = true then
        cls
        render.bg
        GameServer.reg (serverAddress + "register.php")
        exit
    end if

end loop

that is to check what page is clicked and then to display that content
and then i have to do this everytime someone clicks a button


                page_main := false
                page_reg := true

thats if the registertaion button is clicked
 but when i have alot of buttons i will have a HUGE program
since i will have to define everything false n only the button that is clicked true for every button..and so on...is there is a better way of doing this? both checking what page is on and also putting it on the screen/
thanks

-----------------------------------
Remm
Thu May 25, 2006 6:24 pm


-----------------------------------
Erm, so you mean like when you click a button, what code should be used to go to a different page? / how to manage it?

-----------------------------------
Tony
Thu May 25, 2006 6:42 pm


-----------------------------------
you could have an array of boolean values. This way you can reset the entire group to false inside a forloop, and then use index to set the flags/buttons you want to true.

-----------------------------------
unknowngiver
Thu May 25, 2006 7:19 pm


-----------------------------------
Tony: i understood the array of boolean part...but not the index part...can u please explain it? maybe give an example or something
thanks :D

-----------------------------------
unknowngiver
Mon May 29, 2006 9:49 am


-----------------------------------
still waiting

-----------------------------------
wtd
Mon May 29, 2006 12:35 pm


-----------------------------------
A small note:

if page_main = true then

Is exactly the same as:

if page_main then

You should use words like "is" in boolean variable names.
