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) On 03/11/2020 at 12:34, Tekken said: Hmm Hello, as the title says what will be a good way to scroll a gui label ? Thank you. Expand 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 On 03/11/2020 at 13:38, Hydra said: I think he wants to scroll the gui-label like gui-memo or gui-edit. Expand Exactly Link to comment
Hydra Posted November 3, 2020 Share Posted November 3, 2020 (edited) On 03/11/2020 at 13:39, Tekken said: Exactly Expand 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) On 03/11/2020 at 14:05, 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) Expand 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 On 03/11/2020 at 14:07, Tekken said: I haven’t tried tho, the scrollpane may work with just one label. Thank you tho. Expand 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 On 03/11/2020 at 16:43, Hydra said: change i*0.36 with something smaller, maybe i*0.14 idk i just put a random value Expand 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 On 03/11/2020 at 16:45, 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 Expand 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) On 03/11/2020 at 19:08, Tekken said: Not sure as I also need to know how many lines etch label have. Expand 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