Jump to content

GUI Button handling


SjoerdPSV

Recommended Posts

Hello

I was scripting a GUI and for the button handling I made this function:

function buttonHandling() 
    outputDebugString("test1") 
    local input = guiGetText(GUIEditor.edit[1]) 
    if (source == GUIEditor.button[1]) then 
        guiSetText(GUIEditor.edit[1], input.."1") 
        outputDebugString("test2") 
    elseif (source == GUIeditor.button[9]) then     
        guiSetText(GUIEditor.edit[1], input.."2") 
    elseif (source == GUIeditor.button[8]) then     
        guiSetText(GUIEditor.edit[1], input.."3") 
    elseif (source == GUIeditor.button[8]) then     
        guiSetText(GUIEditor.edit[1], input.."4") 
    elseif (source == GUIeditor.button[7]) then     
        guiSetText(GUIEditor.edit[1], input.."5")  
    elseif (source == GUIeditor.button[6]) then     
        guiSetText(GUIEditor.edit[1], input.."6") 
    elseif (source == GUIeditor.button[5]) then     
        guiSetText(GUIEditor.edit[1], input.."7") 
    elseif (source == GUIeditor.button[4]) then     
        guiSetText(GUIEditor.edit[1], input.."8") 
    elseif (source == GUIeditor.button[3]) then     
        guiSetText(GUIEditor.edit[1], input.."9") 
    elseif (source == GUIeditor.button[2]) then     
        guiSetText(GUIEditor.edit[1], input.."0")     
    end 
end     
addEventHandler("OnClientGUIClick", root, buttonHandling) 

But it doesn't work, the outputDebugString are not popping up in my /debugscript. I can't find out what's wrong with this and I'm 100% sure that all GUIelements are the right ones (the ones after source ==)

Is it becuase I set it on read only? Or shouldn't that be a problem?

Link to comment

Me4ever has the solution, event names are case sensitive and starts with a lowercase char always, at least default events does that. Don't worry, this is a common error, except for that it looks well. Debug script won't output anything because the event is never triggered, it's nothing wrong in it tho.

Link to comment

Create an account or sign in to comment

You need to be a member in order to leave a comment

Create an account

Sign up for a new account in our community. It's easy!

Register a new account

Sign in

Already have an account? Sign in here.

Sign In Now
  • Recently Browsing   0 members

    • No registered users viewing this page.
×
×
  • Create New...