AnDReJ98 Posted November 28, 2011 Share Posted November 28, 2011 (edited) hi guys i have a question how to make the button to copy memo's data? client.lua GUIEditor_Window = {} GUIEditor_Button = {} GUIEditor_Memo = {} GUIEditor_Window[1] = guiCreateWindow(188,173,427,273,"",false) GUIEditor_Memo[1] = guiCreateMemo(34,18,366,140,"funnction scriptCreateTank ( commandName ) \n local luckyBugger = getLocalPlayer() -- get the local player \n local x, y, z = getElementPosition ( luckyBugger ) -- retrive the player's position \n createVehicle ( 432, x, y, z + 10 ) -- create te tank 10 units above them \n outputChatBox ( \"You got Tank'd!\", 255, 0, 0) \nend \n addCommandHandle( \"tank\", scriptCreateTank )",false,GUIEditor_Window[1]) GUIEditor_Button[1] = guiCreateButton(71,182,266,59,"copy all ",false,GUIEditor_Window[1]) Edited November 29, 2011 by Guest Link to comment
12p Posted November 28, 2011 Share Posted November 28, 2011 guiGetText If you meant to copy data to clipboard, well, I don't know if that can be done via scripting. But the user can apply Ctrl + C. Link to comment
AnDReJ98 Posted November 28, 2011 Author Share Posted November 28, 2011 Benxamix2 (The Kid) thanks i just wanna the user if he pressed the button will copying memo's data Link to comment
unknooooown Posted November 28, 2011 Share Posted November 28, 2011 @ AnDReJ98 - Doesn't look like it's possible to do what you want. Tbh, I am a bit surprised that there isn't a function for that in lua, since it exists in other languages. But I haven't been able to find a solution for your problem. CTRL+C is probably the only way. Link to comment
Castillo Posted November 28, 2011 Share Posted November 28, 2011 guiGetText If you meant to copy data to clipboard, well, I don't know if that can be done via scripting. But the user can apply Ctrl + C. It is possible, never seen this function: setClipboard? Wiki quote:This function sets the players clipboard text (what appears when you paste with CTRL + V) Note that there is no getClipBoard function for safety reasons. GUIEditor_Window = {} GUIEditor_Button = {} GUIEditor_Memo = {} GUIEditor_Window[1] = guiCreateWindow(188,173,427,273,"",false) GUIEditor_Memo[1] = guiCreateMemo(34,18,366,140,"funnction scriptCreateTank ( commandName ) \n local luckyBugger = getLocalPlayer() -- get the local player \n local x, y, z = getElementPosition ( luckyBugger ) -- retrive the player's position \n createVehicle ( 432, x, y, z + 10 ) -- create te tank 10 units above them \n outputChatBox ( \"You got Tank'd!\", 255, 0, 0) \nend \n addCommandHandle( \"tank\", scriptCreateTank )",false,GUIEditor_Window[1]) GUIEditor_Button[1] = guiCreateButton(71,182,266,59,"copy all ",false,GUIEditor_Window[1]) addEventHandler("onClientGUIClick",GUIEditor_Button[1], function () setClipboard(tostring(guiGetText(GUIEditor_Memo[1]))) outputChatBox("Data copied to clipboard.",0,255,0) end, false) Should work. Link to comment
AnDReJ98 Posted November 28, 2011 Author Share Posted November 28, 2011 thanks it's work's good Link to comment
AnDReJ98 Posted November 29, 2011 Author Share Posted November 29, 2011 Is it possible to make the button to paste ??? Link to comment
TAPL Posted November 29, 2011 Share Posted November 29, 2011 No. https://wiki.multitheftauto.com/wiki/SetClipboard This function sets the players clipboard text (what appears when you paste with CTRL + V) Note that there is no getClipBoard function for safety reasons. Link to comment
Jaysds1 Posted November 29, 2011 Share Posted November 29, 2011 Can't you use setElementData and getElementData for this to? Link to comment
Castillo Posted November 29, 2011 Share Posted November 29, 2011 Into MTA you could, but outside, no. Link to comment
AnDReJ98 Posted November 30, 2011 Author Share Posted November 30, 2011 Into MTA you could, but outside, no. GUIEditor_Window = {} GUIEditor_Button = {} GUIEditor_Memo = {} GUIEditor_Window[1] = guiCreateWindow(188,173,427,273,"",false) GUIEditor_Memo[1] = guiCreateMemo(34,18,366,140,"funnction scriptCreateTank ( commandName ) \n local luckyBugger = getLocalPlayer() -- get the local player \n local x, y, z = getElementPosition ( luckyBugger ) -- retrive the player's position \n createVehicle ( 432, x, y, z + 10 ) -- create te tank 10 units above them \n outputChatBox ( \"You got Tank'd!\", 255, 0, 0) \nend \n addCommandHandle( \"tank\", scriptCreateTank )",false,GUIEditor_Window[1]) GUIEditor_Button[1] = guiCreateButton(71,182,266,59,"copy",false,GUIEditor_Window[1]) addEventHandler("onClientGUIClick",GUIEditor_Button[1], function () setClipboard(tostring(guiGetText(GUIEditor_Memo[1]))) outputChatBox("Data copied.",0,255,0) end, false) -----2----- GUIEditor_Window = {} GUIEditor_Button = {} GUIEditor_Memo = {} GUIEditor_Window[1] = guiCreateWindow(188,173,427,273,"",false) data = guiCreateMemo(34,18,366,140,"",false,GUIEditor_Window[1]) paste = guiCreateButton(71,182,266,59,"paste",false,GUIEditor_Window[1]) i need make another gui (2) when i click the butoon paste its paste tha data how to make this? Link to comment
Castillo Posted November 30, 2011 Share Posted November 30, 2011 You can't, for this you must use element data, when click "Copy" use: setElementData(localPlayer,"text",guiGetText(GUIEditor_Memo[1])) When you click "Paste" do: local text = getElementData(localPlayer,"text") if (text and text ~= "") then guiSetText(data, tostring(text)) end Link to comment
Jaysds1 Posted December 1, 2011 Share Posted December 1, 2011 your welcome for bringing the idea up... :) Link to comment
AnDReJ98 Posted December 1, 2011 Author Share Posted December 1, 2011 You can't, for this you must use element data, when click "Copy" use:setElementData(localPlayer,"text",guiGetText(GUIEditor_Memo[1])) When you click "Paste" do: local text = getElementData(localPlayer,"text") if (text and text ~= "") then guiSetText(data, tostring(text)) end thanks you so much Link to comment
AnDReJ98 Posted December 1, 2011 Author Share Posted December 1, 2011 your welcome for bringing the idea up... :) thanks 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