Dice Posted March 3, 2013 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.
Jaysds1 Posted March 3, 2013 Posted March 3, 2013 just use this function: guiSetPosition--moves the image getCursorPosition --gets the cursor position
Tete omar Posted March 4, 2013 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
Dice Posted March 4, 2013 Author Posted March 4, 2013 I can't move it around like a window becuase it says the down STATE is not working
Castillo Posted March 4, 2013 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.
Dice Posted March 4, 2013 Author 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
Moderators IIYAMA Posted March 4, 2013 Moderators Posted March 4, 2013 https://wiki.multitheftauto.com/wiki/RemoveEventHandler
Dice Posted March 4, 2013 Author 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.
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