XJMLN Posted May 25, 2016 Share Posted May 25, 2016 Hi, i create panel login all works fine but is one small bug i cant insert any word to editbox. But if i'll keep LMB then i can entry word. Someone have that bug and fix it? function displayLoginPanel() showCursor(true) showChat(false) showPlayerHudComponent("all",false) guiSetInputMode("no_binds_when_editing") g_e_login = guiCreateEdit(sw*99/mw,sh*215/mh,sw*250/mw,sh*27/mh,"",false) end Link to comment
XJMLN Posted May 25, 2016 Author Share Posted May 25, 2016 Still the same with guiSetInputEnabled. Link to comment
Moderators IIYAMA Posted May 25, 2016 Moderators Share Posted May 25, 2016 You have to focus on the element before you can edit it. That is just how it is suppose to be, it is not a bug. There are afaik no functions to change the element focus manually. Although there are some workarounds like: https://wiki.multitheftauto.com/wiki/OnClientKey Link to comment
XJMLN Posted May 25, 2016 Author Share Posted May 25, 2016 On gif you can see what is doing when i click on edit, i think is bug or something block insert text to edit. ;( Edit: In GUIEditor editbox work fine, only in my code something is bad. Link to comment
Moderators IIYAMA Posted May 26, 2016 Moderators Share Posted May 26, 2016 Probably some code. Link to comment
Anubhav Posted May 26, 2016 Share Posted May 26, 2016 You have to focus on the element before you can edit it. That is just how it is suppose to be, it is not a bug.There are afaik no functions to change the element focus manually. Although there are some workarounds like: https://wiki.multitheftauto.com/wiki/OnClientKey You mean guiBringToFront? Link to comment
Moderators IIYAMA Posted May 26, 2016 Moderators Share Posted May 26, 2016 You have to focus on the element before you can edit it. That is just how it is suppose to be, it is not a bug.There are afaik no functions to change the element focus manually. Although there are some workarounds like: https://wiki.multitheftauto.com/wiki/OnClientKey You mean guiBringToFront? No, check this. Link to comment
XJMLN Posted May 26, 2016 Author Share Posted May 26, 2016 function isMouseIn(psx,psy,pssx,pssy,abx,aby) if not isCursorShowing() then return end cx,cy=getCursorPosition() cx,cy=cx*sx,cy*sy if cx >= psx and cx <= psx+pssx and cy >= psy and cy <= psy+pssy then return true,cx,cy else return false end end if isMouseIn(here code from guiCreateEdit,"",true) then guiEditSetCaretIndex(g_e_login,1) end That be good? Or better idea is eventHandler onClientClick and then code from up? EDIT: I create that code, but when i click on editbox nothing happen ;/. addEventHandler("onClientGUIClicked",g_e_login,setIndexInput, false) addEventHandler("onClientGUIClicked",g_e_password,setIndexInput, false) function setIndexInput() local tlogin = guiGetText(g_e_login) local plogin = guiGetText(g_e_password) if source == g_e_login then local textLength = string.len(tlogin) if (textLength) > 0 then guiEditSetCaretIndex(source,textLength+1) outputChatBox("1") else setTimer(function() guiEditSetCaretIndex(source,1) end,500,1) end end if source == g_e_password then local textLength = string.len(plogin) if (textLength) > 0 then guiEditSetCaretIndex(source,textLength+1) outputChatBox("1") else guiEditSetCaretIndex(source,1) outputChatBox("1") end end end Link to comment
XJMLN Posted May 28, 2016 Author Share Posted May 28, 2016 Okey, its work end code: addEventHandler("onClientGUIClick",g_e_login,test, true) function test () setTimer(setIndexInput,2000,1) end function setIndexInput(akcja) local tlogin = guiGetText(g_e_login) local plogin = guiGetText(g_e_password) local textLength = string.len(tlogin) if (textLength) > 0 then guiEditSetCaretIndex(g_e_login,textLength+1) else guiEditSetCaretIndex(g_e_login,1) end end Close. Link to comment
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