Jump to content

Caret bug


Piorun

Recommended Posts

Hi

i have code

for id , element in ipairs ( login.edit ) do 
    addEventHandler ( "onClientGUIFocus" , element ,  
        function ( ) 
            CURRENT_EDIT = id 
        end, 
    false ) 
end 
  
addEventHandler( "onClientGUIBlur", root,  
    function() 
        CURRENT_EDIT = 0 
    end 
) 
  
addEventHandler( "onClientKey", root, 
    function ( btn , pressed ) 
        if btn == "tab" and pressed == false then 
            if CURRENT_EDIT > 0 then 
                CURRENT_EDIT = CURRENT_EDIT % 2 + 1 
                local text = guiGetText ( login.edit [ CURRENT_EDIT ] ) 
                local textLength = 0 
                if string.len ( text ) == 0 then 
                    textLength = 1 
                else 
                    textLength = string.len ( text ) 
                end 
                outputChatBox(getElementType(login.edit[CURRENT_EDIT]) .. CURRENT_EDIT) 
                outputChatBox(textLength) 
                guiEditSetCaretIndex( login.edit [ CURRENT_EDIT ], textLength ) 
            end 
        end 
    end 
) 

And it doesnt switch caret to another edit (there are 2 edits in table).

Btw. why Lua tag doesnt work ??

Yea well ok i know why :D

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