Jump to content

problems with gui


Enargy,

Recommended Posts

Posted

I have problems with doing this help panel, When I write something in the text box below and I press the button 'send' does not send the text to the memo, can anyone solve the problem?

addEventHandler("onClientResourceStart", resourceRoot, 
    function() 
        window = guiCreateWindow(0.26, 0.13, 0.48, 0.65, "SUPPORT", true) 
        guiWindowSetMovable(window, false) 
        guiWindowSetSizable(window, false) 
        guiSetVisible(window, false) 
  
        edit_writer = guiCreateEdit(0.03, 0.91, 0.75, 0.06, "", true, window) 
        btn_send = guiCreateButton(0.83, 0.91, 0.14, 0.06, "Send", true, window) 
        guiSetProperty(btn_send, "NormalTextColour", "FFAAAAAA") 
        memo_help = guiCreateMemo(0.02, 0.06, 0.95, 0.83, "", true, window) 
        guiMemoSetReadOnly(memo_help, true)     
    end) 
     
    function toggleWindow() 
    guiSetVisible (window, not guiGetVisible ( window ) ) 
    showCursor(guiGetVisible(window)) 
    end 
    bindKey("F6", "down", toggleWindow) 
     
    function sendMessage() 
    if isElement(window) then 
        local newText = guiGetText(edit_writer) 
        if newText and string.len(newText) > 0 then 
            local oldText = guiGetText(memo_help) 
            if not oldText then oldText = "" end 
            oldText = oldText .. getPlayerName(localPlayer) .. ": " .. newText .. "\n" 
            guiSetText(memo_help, oldText) 
            guiSetText(edit_writer, "") 
            guiMemoSetCaretIndex(edit_writer, string.len(oldText)) 
  
        end  
    end 
end 
  
function sendMSG() 
if (source == btn_send ) then 
local localP = getPlayerFromName(guiGetText(memo_help)) 
if localP then 
    sendMessage(localP) 
    end 
end 
end 
addEventHandler("onClientGUIClick", root, sendMSG) 
  

Posted
And how would that work...? isn't that the memo containing all the messages?

I want people to write your text on the bottom bar, click the button to 'send' the written text in the bottom bar is displayed in the memo

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