Dice Posted March 3, 2013 Share Posted March 3, 2013 Hello again, I am currently using an image as a template and I am curious how to make a image movable, pretty much treat it like if it were a window. Link to comment
Jaysds1 Posted March 3, 2013 Share Posted March 3, 2013 just use this function: guiSetPosition--moves the image getCursorPosition --gets the cursor position Link to comment
Dice Posted March 3, 2013 Author Share Posted March 3, 2013 I tried that but it keeps pissing me off Link to comment
Tete omar Posted March 4, 2013 Share Posted March 4, 2013 just use this function: guiSetPosition--moves the image getCursorPosition --gets the cursor position He'll also need these events onClientGUIClick and onClientRender Link to comment
Dice Posted March 4, 2013 Author Share Posted March 4, 2013 I can't move it around like a window becuase it says the down STATE is not working Link to comment
Castillo Posted March 4, 2013 Share Posted March 4, 2013 What about this event? https://wiki.multitheftauto.com/wiki/On ... IMouseDown It even has an example related to what you are doing, with this and some basic maths, you can turn your image into something like a window. Link to comment
Dice Posted March 4, 2013 Author Share Posted March 4, 2013 addEventHandler ( "onClientGUIMouseDown", root, dragDown ) -- < that is embedded within onClientResourceStart because that is where GUI variables are function dragDown ( button, x, y ) if button == "left" then if source == main then outputChatBox ( "124" ) wX, wY = guiGetPosition ( maun, false ) z = x - wX s = y - wY addEventHandler ( "onClientCursorMove", root, function(_,_,a,b) if ftamainp then guiSetPosition ( main, a - z, b - s, false ) end end ) end end end It works, but I can't figure out how to remove the onClientCursorMove when onClientGUIMouseUp Link to comment
Moderators IIYAMA Posted March 4, 2013 Moderators Share Posted March 4, 2013 https://wiki.multitheftauto.com/wiki/RemoveEventHandler Link to comment
Dice Posted March 4, 2013 Author Share Posted March 4, 2013 @ IIYAMA You can't do that when the function is embedded....but thanks you gave me another idea. Snake I didn't even know that function existed so thanks lol. figured it out. Link to comment
Castillo Posted March 4, 2013 Share Posted March 4, 2013 Is an event, not a function. You're welcome. 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