Jump to content

Closing a window


Yazir

Recommended Posts

Hello! I'm getting a grip on Event system and I can't make "onClientGuiClick" work. I'd be very grateful if anyone could help me.

addEventHandler( "onClientResourceStart", getResourceRootElement( getThisResource( ) ), function()
    marketwindow = guiCreateWindow(428, 238, 1046, 562, "Overload Market", false)
    guiWindowSetSizable(marketwindow, false)
    guiSetAlpha(marketwindow, 0.85)

    listMarket = guiCreateGridList(538, 42, 492, 397, false, marketwindow)
    guiGridListAddColumn(listMarket, "Item", 0.3)
    guiGridListAddColumn(listMarket, "Owner", 0.3)
    guiGridListAddColumn(listMarket, "Cost", 0.3)
    listEq = guiCreateGridList(10, 42, 492, 397, false, marketwindow)
    guiGridListAddColumn(listEq, "Item", 0.9)
    placeItemButton = guiCreateButton(10, 504, 185, 48, "Place item on market", false, marketwindow)
    buyItemButton = guiCreateButton(845, 449, 185, 48, "Buy item from market", false, marketwindow)
    priceMemo = guiCreateMemo(75, 456, 120, 38, "", false, marketwindow)
    priteLabel = guiCreateLabel(10, 456, 185, 38, "Set price", false, marketwindow)
    guiSetFont(priteLabel, "default-bold-small")
    guiSetProperty(priteLabel, "Size", "w:0.176864 h:0.067616")
    guiLabelSetVerticalAlign(priteLabel, "center")
    closeButton = guiCreateButton(970, 524, 60, 28, "Close", false, marketwindow)  
    --guiSetVisible( marketwindow, false )
    showCursor( true, true )

    addEventHandler ( "onClientGuiClick", closeButton, onClientGuiClickHandler)
end)

function toggleMarket()
    if guiGetVisible(marketwindow) == false then 
        showCursor( true, true )
        guiSetVisible( marketwindow, true )  
    else
        showCursor( false, false )
        guiSetVisible( marketwindow, false )  
    end
end
addCommandHandler( "market", toggleMarket)

function onClientGuiClickHandler( button )
    outputChatBox( "hoi" ) -- this doesn't even run
end

 

Edited by Yazir
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...