Tekken Posted November 3, 2020 Share Posted November 3, 2020 Hmm Hello, as the title says what will be a good way to scroll a gui label ? Thank you. Link to comment
Moderators IIYAMA Posted November 3, 2020 Moderators Share Posted November 3, 2020 (edited) 55 minutes ago, Tekken said: Hmm Hello, as the title says what will be a good way to scroll a gui label ? Thank you. Not sure what you want to achieve. But you could add a DX effect, that shows the whole label when hovering. Edited November 3, 2020 by IIYAMA Link to comment
Hydra Posted November 3, 2020 Share Posted November 3, 2020 I think he wants to scroll the gui-label like gui-memo or gui-edit. Link to comment
Tekken Posted November 3, 2020 Author Share Posted November 3, 2020 Just now, Hydra said: I think he wants to scroll the gui-label like gui-memo or gui-edit. Exactly Link to comment
Hydra Posted November 3, 2020 Share Posted November 3, 2020 (edited) 2 minutes ago, Tekken said: Exactly Use guiCreateScrollPane https://wiki.multitheftauto.com/wiki/GuiCreateScrollPane Edited November 3, 2020 by Hydra Link to comment
Tekken Posted November 3, 2020 Author Share Posted November 3, 2020 Bit will this work with a single label? Link to comment
Hydra Posted November 3, 2020 Share Posted November 3, 2020 I'm not sure because i haven't tested it but on the wiki it appears to work. Link to comment
Tekken Posted November 3, 2020 Author Share Posted November 3, 2020 On wiki it haze an label per example Link to comment
Hydra Posted November 3, 2020 Share Posted November 3, 2020 (edited) Words = { {"ASD"}, {"Aqs"}, {"fasa"}, {"dasg"}, {"agaga"}, {"rwrqrq"}, {"agasgdas"}, {"gagasda"}, {"qwr2141"}, {"41251251"}, {"251251"}, {"16171718"}, {"ffasfagaha"}, {"asdasdasfa"} } test = { window = {}, scrollpane = {}, label = {} } test.scrollpane[1] = guiCreateScrollPane(0.55, 0.36, 0.12, 0.50, true) for i, v in ipairs(Words) do test.label[1] = guiCreateLabel(0.42, i*0.36, 0.12, 0.04, v[1], true, test.scrollpane[1]) end guiSetVisible(test.scrollpane[1], false) guiSetVisible(test.label[1], false) function t() if not d then d = true guiSetVisible(test.scrollpane[1], true) guiSetVisible(test.label[1], true) else d = false guiSetVisible(test.scrollpane[1], false) guiSetVisible(test.label[1], false) end end bindKey("f2", "down", t) Images: https://imgur.com/a/q1pRB07 Edited November 3, 2020 by Hydra 1 Link to comment
Tekken Posted November 3, 2020 Author Share Posted November 3, 2020 (edited) 1 minute ago, Hydra said: Words = { {"ASD"}, {"Aqs"}, {"fasa"}, {"dasg"}, {"agaga"}, {"rwrqrq"}, {"agasgdas"}, {"gagasda"}, {"qwr2141"}, {"41251251"}, {"251251"}, {"16171718"}, {"ffasfagaha"}, {"asdasdasfa"} } test = { window = {}, scrollpane = {}, label = {} } test.scrollpane[1] = guiCreateScrollPane(0.55, 0.36, 0.12, 0.50, true) for i, v in ipairs(Words) do test.label[1] = guiCreateLabel(0.42, i*0.36, 0.12, 0.04, v[1], true, test.scrollpane[1]) end guiSetVisible(test.scrollpane[1], false) guiSetVisible(test.label[1], false) function t() if not d then d = true guiSetVisible(test.scrollpane[1], true) guiSetVisible(test.label[1], true) else d = false guiSetVisible(test.scrollpane[1], false) guiSetVisible(test.label[1], false) end end bindKey("f2", "down", t) I haven’t tried tho, the scrollpane may work with just one label. Thank you tho. Edited November 3, 2020 by Tekken Link to comment
Hydra Posted November 3, 2020 Share Posted November 3, 2020 2 minutes ago, Tekken said: I haven’t tried tho, the scrollpane may work with just one label. Thank you tho. With pleasure Link to comment
Tekken Posted November 3, 2020 Author Share Posted November 3, 2020 Hello again, I have tried with one single label but unfortunately it does not work, I have tried your way also @Hydra but I have another problem, it's the spacing between labels are either to big either to small, so now I'm searching a way of detecting the size of the past label so I can create the next one from where the last one left Link to comment
Hydra Posted November 3, 2020 Share Posted November 3, 2020 change i*0.36 with something smaller, maybe i*0.14 idk i just put a random value Link to comment
Tekken Posted November 3, 2020 Author Share Posted November 3, 2020 Just now, Hydra said: change i*0.36 with something smaller, maybe i*0.14 idk i just put a random value The problem is that I have different size strings so that's a matter of knowing the exact spot, I think I will stay with the memo for now Link to comment
Rockyz Posted November 3, 2020 Share Posted November 3, 2020 2 hours ago, Tekken said: The problem is that I have different size strings so that's a matter of knowing the exact spot, I think I will stay with the memo for now That might help you guiLabelGetFontHeight Link to comment
Tekken Posted November 3, 2020 Author Share Posted November 3, 2020 Not sure as I also need to know how many lines etch label have. Link to comment
Rockyz Posted November 4, 2020 Share Posted November 4, 2020 (edited) 13 hours ago, Tekken said: Not sure as I also need to know how many lines etch label have. Then what about that function guiLabelGetTextHeight(label) local text = guiGetText(label) local height = guiLabelGetFontHeight(label) return ((text:len()-text:gsub("\n", ""):len())*height)+height end I haven't test it tho Edited November 4, 2020 by RocKyz 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