
-----------------------------------
unknowngiver
Mon May 29, 2006 9:10 pm

Widgit ID problem
-----------------------------------
Hey
I am getting a WIDGIT ID PROBLEM when i use hte command 

GUI.DISABLE[BUTTON]


it opens another file  
process "whatpage": Assert condition is false


and it puts this on the PROGRAM SCREEN too:

Disable: Widgit ID number "449' not found 

but when i remove the GUI.DISABLE button it works fine...

here is the code for what page:


% -------------------------------------------
% Checks to see what page should be displayed
% -------------------------------------------
process whatpage
    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")
            page_reg := false
        end if

    end loop
end whatpage

and here is where i put the DISABLE thing:


    procedure check_register
        % -------------------
        % Gets all the Input
        % -------------------
        new_user := GUI.GetText (name_field)
        new_pass := GUI.GetText (password_field)
        conf_pass := GUI.GetText (passwordconfirm_field)
        new_email := GUI.GetText (emailid_field)

        if length (new_user) not= 0 and length (new_email) not= 0 and length (conf_pass) not= 0 and length (new_pass) not= 0 then
            if new_pass = conf_pass then
                put "Registration is complete"
              GUI.Disable(x_register)
            else
                put "Passwords dont match"
            end if
        else
            put "Please fill all fields"
        end if
    end check_register


    procedure register_fields

        render.bg

        var registerButton := GUI.CreateButton (x_register - 50, 200, 200, "Register", check_register)
        name_field := GUI.CreateTextFieldFull (x_register, 400, 150, "",
            NameEntered, GUI.INDENT, 0, 0)

        emailid_field := GUI.CreateTextFieldFull (x_register, 370, 130, "",
            emailEntered, GUI.INDENT, 0, 0)

        password_field := GUI.CreateTextFieldFull (x_register, 340, 120, "",
            passwordEntered, GUI.INDENT, 0, 0)
        GUI.SetEchoChar (password_field, '*')

        passwordconfirm_field := GUI.CreateTextFieldFull (x_register, 310, 120, "",
            password2Entered, GUI.INDENT, 0, 0)
        GUI.SetEchoChar (passwordconfirm_field, '*')

        var nameLabel := GUI.CreateLabelFull (x_register - 50, 400, "User Name:", 0, 0,
            GUI.RIGHT, 0)
        var addressLabel := GUI.CreateLabelFull (x_register - 50, 370, "Email:", 0, 0,
            GUI.RIGHT, font_register)
        var passlabel := GUI.CreateLabelFull (x_register - 50, 340, "Password:", 0, 0,
            GUI.RIGHT, font_register)
        var pass2label := GUI.CreateLabelFull (x_register - 50, 310, " Confirm Password:", 0, 0,
            GUI.RIGHT, font_register)


        loop
            exit when GUI.ProcessEvent
        end loop



    end register_fields


-----------------------------------
Clayton
Mon May 29, 2006 9:14 pm


-----------------------------------
what is x_register? is it a button or other GUI widget that you have declared? if not, there is nothing for the Disable proc to disable, hence the ID problem if youre not sure the syntax for GUI.Disable is as such

GUI.Disable(widgetID)


-----------------------------------
unknowngiver
Mon May 29, 2006 9:19 pm


-----------------------------------
       var registerButton := GUI.CreateButton (x_register - 50, 200, 200, "Register", check_register)
how do i find the WIDGET ID for this? i thought "x_register" is what i have to put in/

-----------------------------------
Clayton
Mon May 29, 2006 9:24 pm


-----------------------------------
the widget ID for that is the variable name (in your case registerButton), in other cases, if you need to disable a widget depending on what was used you can use GUI.GetEventWidgetID to determine what widget was used  :P

-----------------------------------
unknowngiver
Mon May 29, 2006 9:32 pm


-----------------------------------
hm
well i m kinda stuck here then

if i put hte proces check :

    procedure check_register
        % -------------------
        % Gets all the Input
        % -------------------
        new_user := GUI.GetText (name_field)
        new_pass := GUI.GetText (password_field)
        conf_pass := GUI.GetText (passwordconfirm_field)
        new_email := GUI.GetText (emailid_field)

        if length (new_user) not= 0 and length (new_email) not= 0 and length (conf_pass) not= 0 and length (new_pass) not= 0 then
            if new_pass = conf_pass then
                put "Registration is complete"
                GUI.Disable (registerButton)
            else
                put "Passwords dont match"
            end if
        else
            put "Please fill all fields"
        end if
    end check_register


before the procedure where it draws it all...then it says registerButton has not been decleared before...if i put it AFTER the procedure that draws the form..then it says that the "check_registeR" has not been declared :(

-----------------------------------
Clayton
Mon May 29, 2006 9:34 pm


-----------------------------------
what exactly is it that you are trying to disable, if it is the register button then you cant disable it outside of the proc it was created in because registerButton is local to that proc, if it is one of the text fields you are trying to disable, put in the text fields respective identifier

-----------------------------------
unknowngiver
Mon May 29, 2006 9:45 pm


-----------------------------------
hm well i m trying to disable the button after it checks 2 make sure that everything is correct

-----------------------------------
Clayton
Mon May 29, 2006 10:11 pm


-----------------------------------
then make sure that you have your button created in the proc with your textfields

-----------------------------------
Clayton
Mon May 29, 2006 10:13 pm


-----------------------------------
also you could create the button globally if you cant do it inside the proc

-----------------------------------
unknowngiver
Mon May 29, 2006 10:19 pm


-----------------------------------
hm i still cant get it 2 work:(
i have to have the button in a process because the main program just inteprets the procedures...and i have to disable it AFTEr running the check procedure :(

-----------------------------------
Clayton
Mon May 29, 2006 10:20 pm


-----------------------------------
could you post or PM me the code so i could look it over plz?
