Jump to content

Editbox - cant type anything


XJMLN

Recommended Posts

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

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

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