Mann56 Posted February 15, 2016 Share Posted February 15, 2016 Hey guys, I was making a dxButton for my resource, but i have no idea how to get it clicked. I mean : I have a dxRectangle, then i can change the colour of the rectangle a bit when a players hovers his mouse over it, but how can i get his click on the dxButton, i want the button to function as a normal gui button works... Thanks for reading, Regards, Mann Link to comment
tosfera Posted February 15, 2016 Share Posted February 15, 2016 either hide a MTA GUI button under there with an alpha of 0, or just add an eventhandler; onClientClick, and add a "hoverButton = " in your render. If the hoverButton equals something, it clicks a button. Link to comment
Mann56 Posted February 15, 2016 Author Share Posted February 15, 2016 either hide a MTA GUI button under there with an alpha of 0, or just add an eventhandler; onClientClick, and add a "hoverButton = " in your render. If the hoverButton equals something, it clicks a button. Thanks, So if i am right, i can use a onClientClick and check if the cursor was clicked in the designated area and so output the function? EDIT: Can you explain the second method of ahover button to me? I made a onClientClick and got the position of cursor using getCursorPosition, but how'd i check if the cursor is in a particular space without using gui buttons ? Link to comment
Dealman Posted February 15, 2016 Share Posted February 15, 2016 onClientClick already returns what you need, no need to use getCursorPosition. Also do yourself a favor and use isMouseInPosition. Link to comment
Mann56 Posted February 15, 2016 Author Share Posted February 15, 2016 onClientClick already returns what you need, no need to use getCursorPosition. Also do yourself a favor and use isMouseInPosition. Ah, Thanks a lot , it works!!!! didn't knew about isMouseInPosition.... Thanks for it Regards, Mann 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