Master_MTA Posted August 3, 2017 Posted August 3, 2017 hello all i have gonna to create my own dxlib so i am trying to do something if it wasn't possible you should take look of my code first it's work fine without wrong but i wanna do something better function gsplit(text, pattern, plain) local splitStart, length = 1, #text return function () if splitStart then local sepStart, sepEnd = string.find(text, pattern, splitStart, plain) local ret if not sepStart then ret = string.sub(text, splitStart) splitStart = nil elseif sepEnd < sepStart then -- Empty separator! ret = string.sub(text, splitStart, sepStart) if sepStart < length then splitStart = sepStart + 1 else splitStart = nil end else ret = sepStart > splitStart and string.sub(text, splitStart, sepStart - 1) or '' splitStart = sepEnd + 1 end return ret end end end function split(text, pattern, plain) local ret = {} for match in gsplit(text, pattern, plain) do table.insert(ret, match) end return ret end addEventHandler('onClientCharacter',root,function(key) for k,v in ipairs(getElementsByType('dxEditBox',resourceRoot))do if getElementData(v,'line')==true and dxGetVisible(v)==true then local data=getElementData(v,'info') local text=data.text..key setElementData(v,'info',{ text=text, id=data.id, x=data.x, y=data.y, x1=data.x1, y1=data.y1, color=data.color, postgui=data.postgui, textcolor=data.textcolor, dxWindow=data.dxWindow }) break end end end) addEventHandler('onClientKey',root,function(button,press) if press then if button=='backspace' then for k,v in ipairs(getElementsByType('dxEditBox',resourceRoot))do if dxGetVisible(v)==true and getElementData(v,'line') and getElementData(v,'line')==true then local data=getElementData(v,'info') text='' for k,v in ipairs(split(data.text,''))do if k==#split(data.text,'') then break end text=text..v end setElementData(v,'info',{ text=text, id=data.id, x=data.x, y=data.y, x1=data.x1, y1=data.y1, color=data.color, postgui=data.postgui, textcolor=data.textcolor, dxWindow=data.dxWindow }) break end end end end end) my problem is in onClientKey event i wanna to create editbox look like guiEditbox so when i press backspace button it's work but only delete 1 letter i wanna when player press backspace and player didn't left he is finger it will delete all letters in dxeditbox Skype : 01100001 01101100 01101001 01011111 01101101 01110100 00110001 00111001 00111001 00111001 every thing is gonna be alright every thing is gonna be okay it's gonna be a good good life that's what my therapist say
Simple0x47 Posted August 3, 2017 Posted August 3, 2017 Thats just about using the getKeyState function into a renderer using tickCounts to differentiate the situations ( delete one 500ms or delete more less than 100ms ). 1 "Keep making it simplex."
Master_MTA Posted August 3, 2017 Author Posted August 3, 2017 thx all Skype : 01100001 01101100 01101001 01011111 01101101 01110100 00110001 00111001 00111001 00111001 every thing is gonna be alright every thing is gonna be okay it's gonna be a good good life that's what my therapist say
Recommended Posts
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 accountSign in
Already have an account? Sign in here.
Sign In Now