Jump to content

Problem in guiCreateEdit


AlvarO

Recommended Posts

Posted

Hello guys, today I was making a login panel to my clan but I got a problem that when I want to write inside of the edit, it dosn't work and I don't know what to do, the code is the following one:

userBox = guiCreateEdit(476, 361, 334, 29, "", false) 

Whats bad with that? Can you explain me it pls? Thanks you guys so much :D

Posted

But im not making it GUI, I have a dx panel with all created, buttons and whatever (buttons are dx), but when I create the edit and I want to write inside them I can't

Posted

This is the full dxDrawing code:

function drawLoginConcept() 
    --Camera 
    setCameraMatrix(358.822265625, -2066.345703125, 28.744483947754, 1500, 500, -850) 
    --Dx 
    --Variables: 
    anim = 0 
    animacion = anim + 150 
     
    --Panel 
     dxDrawRectangle(sX * 0.3570, sY * 0.2676, sX * 0.2867, sY * 0.4961, tocolor(0, 0, 0, login_alpha), false) 
    dxDrawLine(sX * 0.3563, sY * 0.2617, sX * 0.3563, sY * 0.7627, tocolor(255, 60, 50, login_alpha), 2, false) 
    dxDrawLine(sX * 0.3563, sY * 0.7637, sX * 0.6459, sY * 0.7637, tocolor(255, 60, 50, login_alpha), 2, false) 
    dxDrawLine(sX * 0.6445, sY * 0.2607, sX * 0.6445, sY * 0.7630, tocolor(255, 60, 50, login_alpha), 2, false) 
    dxDrawLine(sX * 0.3563, sY * 0.2617, sX * 0.6453, sY * 0.261, tocolor(255, 60, 50, login_alpha), 2, false) 
    --Botones 
    dxDrawRectangle (sX*0.375, sY*0.665, 150, 40,rectanglecchanger1, true) 
    dxDrawRectangle (sX*0.51, sY*0.665, 150, 40, rectanglecchanger2, true) 
    dxDrawRectangle (sX*0.375, sY*0.71, 323, 40, rectanglecchanger3, true) 
    dxDrawRectangle (sX*0.356, sY*0.26, 370, 30, tocolor (255, 60, 50, 255), true) 
    dxDrawRectangle(sX * 0.3575, sY * 0.6426, sX * 0.2859, sY * 0.0117, tocolor(255, 60, 50, 255), false) 
    --Textos 
    dxDrawText ("Register", sX*0.52, sY*0.60, sX/2-300/2+160+140, sY*0.73+40, tocolor (0, 0, 0, login_alpha), 2, "default-bold", "center", "center", false, false, true, true, false) 
    dxDrawText ("Login", sX*0.25, sY*0.60, sX/2-300/2+160+140, sY*0.73+40, tocolor (0, 0, 0, login_alpha), 2, "default-bold", "center", "center", false, false, true, true, false) 
    dxDrawText ("Play as guest", sX*0.385, sY*0.69, sX/2-300/2+160+140, sY*0.73+40, tocolor (0, 0, 0, login_alpha), 2, "default-bold", "center", "center", false, false, true, true, false) 
    dxDrawText ("Login Panel", sX*0.385, sY*(-0.22), sX/2-300/2+160+140, sY*0.73+40, tocolor (0, 0, 0, login_alpha), 2, "default-bold", "center", "center", false, false, true, true, false) 
    dxDrawText ("Username", sX*0.385, sY*(-0.11), sX/2-300/2+160+140, sY*0.73+40, tocolor (255, 60, 50, login_alpha), 2, "default-bold", "center", "center", false, false, true, true, false) 
    dxDrawText ("Password", sX*0.385, sY*(0.111), sX/2-300/2+160+140, sY*0.73+40, tocolor (255, 60, 50, login_alpha), 2, "default-bold", "center", "center", false, false, true, true, false) 
    --Edits boxes and checkbox 
    userBox = guiCreateEdit(476, 361, 334, 29, "", true) 
    passBox = guiCreateEdit(476, 479, 334, 29, "", true) 
    guiEditSetMasked(passBox, true)     
    guiSetEnabled(userBox,true) 
    guiSetEnabled(passBox,true) 
    --Varios 
    showChat(true) 
    showCursor(true) 
end 
addEventHandler("onClientRender", root, drawLoginConcept) 
addEventHandler("onClientResourceStart", resourceRoot, drawLoginConcept) 

Posted

Of course. Never put GUI elements into onClientRender event.

  
  
    --Edits boxes and checkbox 
    userBox = guiCreateEdit(476, 361, 334, 29, "", true) 
    passBox = guiCreateEdit(476, 479, 334, 29, "", true) 
    guiEditSetMasked(passBox, true)     
    guiSetEnabled(userBox,true) 
    guiSetEnabled(passBox,true) 
  
function drawLoginConcept() 
    --Camera 
    setCameraMatrix(358.822265625, -2066.345703125, 28.744483947754, 1500, 500, -850) 
    --Dx 
    --Variables: 
    anim = 0 
    animacion = anim + 150 
    
    --Panel 
     dxDrawRectangle(sX * 0.3570, sY * 0.2676, sX * 0.2867, sY * 0.4961, tocolor(0, 0, 0, login_alpha), false) 
    dxDrawLine(sX * 0.3563, sY * 0.2617, sX * 0.3563, sY * 0.7627, tocolor(255, 60, 50, login_alpha), 2, false) 
    dxDrawLine(sX * 0.3563, sY * 0.7637, sX * 0.6459, sY * 0.7637, tocolor(255, 60, 50, login_alpha), 2, false) 
    dxDrawLine(sX * 0.6445, sY * 0.2607, sX * 0.6445, sY * 0.7630, tocolor(255, 60, 50, login_alpha), 2, false) 
    dxDrawLine(sX * 0.3563, sY * 0.2617, sX * 0.6453, sY * 0.261, tocolor(255, 60, 50, login_alpha), 2, false) 
    --Botones 
    dxDrawRectangle (sX*0.375, sY*0.665, 150, 40,rectanglecchanger1, true) 
    dxDrawRectangle (sX*0.51, sY*0.665, 150, 40, rectanglecchanger2, true) 
    dxDrawRectangle (sX*0.375, sY*0.71, 323, 40, rectanglecchanger3, true) 
    dxDrawRectangle (sX*0.356, sY*0.26, 370, 30, tocolor (255, 60, 50, 255), true) 
    dxDrawRectangle(sX * 0.3575, sY * 0.6426, sX * 0.2859, sY * 0.0117, tocolor(255, 60, 50, 255), false) 
    --Textos 
    dxDrawText ("Register", sX*0.52, sY*0.60, sX/2-300/2+160+140, sY*0.73+40, tocolor (0, 0, 0, login_alpha), 2, "default-bold", "center", "center", false, false, true, true, false) 
    dxDrawText ("Login", sX*0.25, sY*0.60, sX/2-300/2+160+140, sY*0.73+40, tocolor (0, 0, 0, login_alpha), 2, "default-bold", "center", "center", false, false, true, true, false) 
    dxDrawText ("Play as guest", sX*0.385, sY*0.69, sX/2-300/2+160+140, sY*0.73+40, tocolor (0, 0, 0, login_alpha), 2, "default-bold", "center", "center", false, false, true, true, false) 
    dxDrawText ("Login Panel", sX*0.385, sY*(-0.22), sX/2-300/2+160+140, sY*0.73+40, tocolor (0, 0, 0, login_alpha), 2, "default-bold", "center", "center", false, false, true, true, false) 
    dxDrawText ("Username", sX*0.385, sY*(-0.11), sX/2-300/2+160+140, sY*0.73+40, tocolor (255, 60, 50, login_alpha), 2, "default-bold", "center", "center", false, false, true, true, false) 
    dxDrawText ("Password", sX*0.385, sY*(0.111), sX/2-300/2+160+140, sY*0.73+40, tocolor (255, 60, 50, login_alpha), 2, "default-bold", "center", "center", false, false, true, true, false) 
    --Varios 
    showChat(true) 
    showCursor(true) 
end 
addEventHandler("onClientRender", root, drawLoginConcept) 

Posted

Because you set edits to use relative position but you're actually using absolute positions.

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