Mann56 Posted February 15, 2016 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
tosfera Posted February 15, 2016 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.
Mann56 Posted February 15, 2016 Author 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 ?
Dealman Posted February 15, 2016 Posted February 15, 2016 onClientClick already returns what you need, no need to use getCursorPosition. Also do yourself a favor and use isMouseInPosition.
Mann56 Posted February 15, 2016 Author 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
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