derailed Posted November 7, 2019 Posted November 7, 2019 Hi. I'm new to MTA scripting community. I created a login screen with two edit boxes and a label on top to create a custom input fields. Now, when I type in the letters, the black vertical line stays behind as I insert text. Thank you for your help in advance on how to fix this issue. Code: loginLabels = { }; function updateLabels( ) guiSetText( loginLabels[ source ], guiGetText( source ) ); end local loginBackground = guiCreateStaticImage(0, 0, guiGetScreenSize(), guiGetScreenSize(), loginSettings[0], false) local loginWindow = guiCreateStaticImage(0, 0, guiGetScreenSize(), guiGetScreenSize(), loginSettings[1], false, loginBackground) loginUser = guiCreateEdit( 0.292, 0.411, 0.155, 0.03, " ", true, loginWindow ) guiSetAlpha ( loginUser, 0 ) loginLabels[loginUser] = guiCreateLabel( 0.298, 0.418, 0.155, 0.03,"",true, loginWindow) guiMoveToBack( loginLabels[loginUser] ); local loginFont = guiCreateFont(loginSettings[4], 14) guiSetFont ( loginLabels[loginUser], loginFont ) guiLabelSetColor ( loginLabels[loginUser], 0, 0, 0) guiBringToFront( loginUser ) loginPassword = guiCreateEdit( 0.292, 0.477, 0.155, 0.03, " ", true, loginWindow ) guiSetAlpha ( loginPassword, 0 ) loginLabels[loginPassword] = guiCreateLabel( 0.298, 0.483, 0.155, 0.03,"",true, loginWindow) guiMoveToBack( loginLabels[loginPassword] ); guiSetFont ( loginLabels[loginPassword], loginFont ) guiLabelSetColor ( loginLabels[loginPassword], 0, 0, 0) guiBringToFront( loginPassword ) guiBringToFront( loginUser ) addEventHandler( "onClientGUIChanged", loginUser, updateLabels, false ); addEventHandler( "onClientGUIChanged", loginPassword, updateLabels, false );
MIKI785 Posted November 8, 2019 Posted November 8, 2019 I think the problem is that the font size used by the actual input boxes (that you have hidden) is smaller than that of the labels used to show the input. So the text width doesn't match. 1
derailed Posted November 8, 2019 Author Posted November 8, 2019 1 hour ago, MIKI785 said: I think the problem is that the font size used by the actual input boxes (that you have hidden) is smaller than that of the labels used to show the input. So the text width doesn't match. Can one possibly set custom font on the text input as well?
MIKI785 Posted November 8, 2019 Posted November 8, 2019 Well, guiSetFont works for any GUI element, it's not limited to labels, so you can try that. But I really don't know if it will work.
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