Jump to content

return getElementData(source,"function")


kevenvz

Recommended Posts

Hey i got this code and it wont return the function. Can anybody help?

addEventHandler("onClientClick",root, 
  function(button,state) 
    if (button ~= "left") or (state ~= "down") then return end 
    for _,dxElement in pairs(getElementsByType("dxButton")) do 
      local posX,posY = getCursorPosition() 
      local screenWidth,screenHeight = guiGetScreenSize() 
      local mouseX, mouseY = posX * screenWidth, posY * screenHeight 
      if (mouseX >= AbsoluteToRelativX(getElementData(dxElement,"x"))) and (mouseX <= AbsoluteToRelativX(getElementData(dxElement,"x") + getElementData(dxElement,"width"))) and (mouseY >= AbsoluteToRelativX(getElementData(dxElement,"y"))) and (mouseY <= AbsoluteToRelativX(getElementData(dxElement,"y") + getElementData(dxElement,"height"))) then 
        return getElementData(dxElement,"handledFunction") 
      end 
    end 
  end) 

setElementData(dxElement,"handledFunction",testFunction) 
function testFunction() 
  outputDebugString("TEST DONE!") 
end 

Link to comment

Its 2 different codes, actually it is:

statsButton = dxCreateButton(10, 910, 130, 130, "files/stats.png", "Stats", tocolor(255, 255, 255, 255), 1, "bankgothic", "center", "bottom", false, true, testFunction, botBar) 

I am working on my own dx library but it sets all the elements data then it renders it and then it should trigger which it won't!

Edit: I can give yoy the source but please dont leak it! I will release it soon so :P

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