XeRo Posted August 4, 2015 Share Posted August 4, 2015 Hi Guys Help Me. addEventHandler("onClientRender", root, function() dxDrawRectangle(255, 191, 561, 237, tocolor(0, 0, 0, 172), false) -- BackGround dxDrawRectangle(795, 211, 21, 191, tocolor(185, 0, 0, 172), false) --Scroll BackGround dxDrawRectangle(795, 215, 21, 30, tocolor(255, 255, 255, 255), false) --Scroll end ) Link to comment
GTX Posted August 4, 2015 Share Posted August 4, 2015 https://wiki.multitheftauto.com/wiki/OnClientKey - To detect mouse_wheel_up and mouse_wheel_down, add specific value + 1 and then add that value to rectangles as Y. Link to comment
XeRo Posted August 4, 2015 Author Share Posted August 4, 2015 https://wiki.multitheftauto.com/wiki/OnClientKey - To detect mouse_wheel_up and mouse_wheel_down, add specific value + 1 and then add that value to rectangles as Y. Do not know I did, addEventHandler("onClientKey", root, function(Button, state, x, y) if Button == "mouse_wheel_up" and state == "mouse_wheel_down" then if x >= screenW * 0.2109 and y >= screenH * 0.2760 and x <= screenW * 0.2109+screenW * 0.5586 and y <= screenH * 0.2760+screenH * 0.4089 then end end end ) Link to comment
GTX Posted August 4, 2015 Share Posted August 4, 2015 Your code makes no sense. If you don't know anything, don't even try, but use GUI. viewtopic.php?f=91&t=83977&p=762733&hilit=dx+scroll#p762780 Link to comment
XeRo Posted August 4, 2015 Author Share Posted August 4, 2015 Your code makes no sense. If you don't know anything, don't even try, but use GUI. viewtopic.php?f=91&t=83977&p=762733&hilit=dx+scroll#p762780 Code; local x, y = guiGetScreenSize() local myRenderTarget = dxCreateRenderTarget(20, 20, true) local offset = 0 function lobby() if myRenderTarget then ---Start using render target.... dxSetRenderTarget( myRenderTarget ) ---Start drawing on it. dxSetRenderTarget() --Stop Drawing on it. dxDrawRectangle(252, 205, 532, 291, tocolor(0, 0, 0, 155), false) dxDrawRectangle(759, 205, 19, 291, tocolor(255, 255, 255, 123), false) dxDrawRectangle(262, 205, 19, 291, tocolor(255, 255, 255, 123), false) dxDrawText("TEST", 291, 213+offset, 749, 486, tocolor(255, 255, 255, 255), 1.00, "sans", "left", "top", false, false, false, false, false) --//Scrolling bar.... dxDrawRectangle(262, 205+offset, 19, 35, tocolor(240, 98, 4, 251), false) end end addEventHandler("onClientRender", root, lobby) function scrollUP() offset = offset - 20 end function scrollDOWN() offset = offset + 20 end bindKey("mouse_wheel_up","down",scrollUP) bindKey("mouse_wheel_down","down",scrollDOWN) DxDrawRectangle It brings the field. Link to comment
GTX Posted August 4, 2015 Share Posted August 4, 2015 Calculate max width, substract it by scroll's height and then if offset is more than that, simply don't go on. Or use math.min. offset = math.min(offset+20, windowHeight-scrollHeight) Link to comment
XeRo Posted August 4, 2015 Author Share Posted August 4, 2015 XeRo:HELP ME GTX Still going down , from the field Exiting the I do not want function scrollUP() offset = math.min(offset+20, windowHeight-scrollHeight) end function scrollDOWN() offset = offset - 20 end bindKey("mouse_wheel_up","down",scrollUP) bindKey("mouse_wheel_down","down",scrollDOWN) 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