Xeno Posted February 15, 2012 Share Posted February 15, 2012 local screenWidth, screenHeight = guiGetScreenSize() function news(clickedElement) cx,cy = getCursorPosition() if cx >= 050 and cx <= 530 and cy >= screenWidth and screenHeight <= endY then addEventHandler("onClientRender",rootElement, serverBoxDesign) end end addEventHandler ( "onClientClick", getRootElement(), news ) Would something like this work? I'm trying to make a dxDraw clickable. What I don't understand is how i'm meant to get the parts of the screen?? Thanks Xeno Link to comment
Aibo Posted February 18, 2012 Share Posted February 18, 2012 simplest way to provide click (and other) events for dx stuff is to create underlying gui-element with the same size/position and 0 opacity, and catch the events from it. other (proper?) way is screen click detection, but you'll have to script everything yourself. basically in onClick event you check if the coordinates of the click are within the bounding box of your dxDraw. which is what you're doing here (as it seems, though i dont know what endY is). Link to comment
Xeno Posted February 18, 2012 Author Share Posted February 18, 2012 The example I used is from a friend. Could I say, make a gui element like a label, and make the size's as big at the dx draw? Wouldn't it go behind the dxDraw and be un-clickalbe? Link to comment
Castillo Posted February 18, 2012 Share Posted February 18, 2012 Nope, it would still be clickable. P.S: DX drawing functions has the parameter postGUI. Link to comment
Aibo Posted February 18, 2012 Share Posted February 18, 2012 The example I used is from a friend. Could I say, make a gui element like a label, and make the size's as big at the dx draw? Wouldn't it go behind the dxDraw and be un-clickalbe? whatever the rendering mode is, dx stuff is "click-through". Link to comment
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