Fist Posted March 19, 2017 Share Posted March 19, 2017 how can i clip text/image in scrollpane that if it's too long it doesn't go further than scrollpane width but instead it goes down in height? Link to comment
Fist Posted March 19, 2017 Author Share Posted March 19, 2017 (edited) 5 minutes ago, Mr.Loki said: dxCreateRenderTarget If i wasn't clear enough sorry, but i mean't that i'm using guiCreateScrollPane and i want text/image that is bigger in width than actual scroll pane go down instead, like clip them. Edited March 19, 2017 by Fist Link to comment
Mr.Loki Posted March 19, 2017 Share Posted March 19, 2017 guiSetProperty(guiElement,"ClippedByParent","true") Link to comment
Fist Posted March 19, 2017 Author Share Posted March 19, 2017 1 minute ago, Mr.Loki said: guiSetProperty(guiElement,"ClippedByParent","true") yet again, you didn't understand me. hehe Here is what my problem is in pic. http://prntscr.com/elvxmd but i want them to go like this http://prntscr.com/elvyt8 Link to comment
Mr.Loki Posted March 19, 2017 Share Posted March 19, 2017 (edited) Oh, you want to wrap the GUI elements not clip. Try using the size of the scrollpane to decide whether the element should be placed under. Edited March 19, 2017 by Mr.Loki Link to comment
Fist Posted March 19, 2017 Author Share Posted March 19, 2017 1 minute ago, Mr.Loki said: Oh, you want to wrap the GUI elements not clip. try using the size off the scrollpane to decide whether the element should be placed under. any examples? Link to comment
Mr.Loki Posted March 19, 2017 Share Posted March 19, 2017 Oh wait you are using cegui lol use the scrollpane properties here there should be something to sort them. Link to comment
Fist Posted March 19, 2017 Author Share Posted March 19, 2017 8 minutes ago, Mr.Loki said: Oh wait you are using cegui lol use the scrollpane properties here there should be something to sort them. can't find any, i don't think there is such property as that or i can't find it. Link to comment
NeXuS™ Posted March 19, 2017 Share Posted March 19, 2017 You should just calculate the X and Y positions of the elements. local scrollPane = guiCreateScrollPane(500, 200, 500, 300, false) local things = { {"Test Test Test Test", "text"}, {"test.png", "image", 100, 50} } function drawThings() local x, y = 0, 0 local nextY = 0 for i, k in ipairs(things) do if k[2] == "text" then if x + dxGetTextWidth(k[1]) > 300 then x = 0 y = nextY end guiCreateLabel(x, y, dxGetTextWidth(k[1]), 15, false, scrollPane) if nextY < y + 15 then nextY = nextY + 15 end elseif k[2] == "image" then if x + k[3] > 300 then x = 0 y = nextY end guiCreateStaticImage(x, y, k[3], k[4], k[1], false, scrollPane) if nextY < y + k[4] then nextY = y + k[4] end end end end Should work, not tested tho. Link to comment
Fist Posted March 19, 2017 Author Share Posted March 19, 2017 10 minutes ago, NeXuS™ said: You should just calculate the X and Y positions of the elements. local scrollPane = guiCreateScrollPane(500, 200, 500, 300, false) local things = { {"Test Test Test Test", "text"}, {"test.png", "image", 100, 50} } function drawThings() local x, y = 0, 0 local nextY = 0 for i, k in ipairs(things) do if k[2] == "text" then if x + dxGetTextWidth(k[1]) > 300 then x = 0 y = nextY end guiCreateLabel(x, y, dxGetTextWidth(k[1]), 15, false, scrollPane) if nextY < y + 15 then nextY = nextY + 15 end elseif k[2] == "image" then if x + k[3] > 300 then x = 0 y = nextY end guiCreateStaticImage(x, y, k[3], k[4], k[1], false, scrollPane) if nextY < y + k[4] then nextY = y + k[4] end end end end Should work, not tested tho. doesn't work Link to comment
NeXuS™ Posted March 19, 2017 Share Posted March 19, 2017 local guiWindow = guiCreateWindow(500, 200, 500, 300, "Test panel", false) local scrollPane = guiCreateScrollPane(0, 20, 500, 300, false, guiWindow) local things = { {"Test Test Test Test", "text"}, {"Test2 Test2 Test2 Test2", "text"}, {"Test3 Test3 Test3 Test3", "text"}, {"Test4 Test4 Test4 Test4", "text"} } function drawThings() local x, y = 0, 0 local nextY = 0 for i, k in ipairs(things) do if k[2] == "text" then if x + dxGetTextWidth(k[1]) > 500 then x = 0 y = nextY end guiCreateLabel(x, y, dxGetTextWidth(k[1]), 15, k[1], false, scrollPane) if nextY < y + 15 then nextY = nextY + 15 end x = x + dxGetTextWidth(k[1]) + 10 elseif k[2] == "image" then if x + k[3] > 500 then x = 0 y = nextY end guiCreateStaticImage(x, y, k[3], k[4], k[1], false, scrollPane) if nextY < y + k[4] then nextY = y + k[4] end x = x + k[3] + 10 end end end drawThings() This one is tested with texts, and worked. Can ya test it with pictures? 1 Link to comment
Fist Posted March 19, 2017 Author Share Posted March 19, 2017 3 minutes ago, NeXuS™ said: local guiWindow = guiCreateWindow(500, 200, 500, 300, "Test panel", false) local scrollPane = guiCreateScrollPane(0, 20, 500, 300, false, guiWindow) local things = { {"Test Test Test Test", "text"}, {"Test2 Test2 Test2 Test2", "text"}, {"Test3 Test3 Test3 Test3", "text"}, {"Test4 Test4 Test4 Test4", "text"} } function drawThings() local x, y = 0, 0 local nextY = 0 for i, k in ipairs(things) do if k[2] == "text" then if x + dxGetTextWidth(k[1]) > 500 then x = 0 y = nextY end guiCreateLabel(x, y, dxGetTextWidth(k[1]), 15, k[1], false, scrollPane) if nextY < y + 15 then nextY = nextY + 15 end x = x + dxGetTextWidth(k[1]) + 10 elseif k[2] == "image" then if x + k[3] > 500 then x = 0 y = nextY end guiCreateStaticImage(x, y, k[3], k[4], k[1], false, scrollPane) if nextY < y + k[4] then nextY = y + k[4] end x = x + k[3] + 10 end end end drawThings() This one is tested with texts, and worked. Can ya test it with pictures? Yup works!!! Thank you man alot. 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