Jump to content

[GUI] Edit Field question


MatXpl

Recommended Posts

Posted
function checkEdit(edit) 
    local text = guiGetText(edit) 
    if not tonumber(text) then return false end 
    local text = tonumber(text) 
    if text < 1 or text < 10 then return true else return false end 
end 

Should work.

Posted

iirc cancelEvent() does nothing onClientGUIChanged. it doesnt prevent the editbox value from changing.

moreover, editbox already has it's value changed when it's called.

  
local edit = guiCreateEdit(0, 0, 1, 0.1, "", true) -- your editbox 
addEventHandler("onClientGUIChanged", edit, function()  
  guiSetText(source, guiGetText(source):gsub("[^0-9]","")) 
end) 
  

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...