Jump to content

Scroll label


Tekken

Recommended Posts

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 by Hydra
  • Like 1
Link to comment
  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 by Tekken
Link to comment

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
  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 by RocKyz
Link to comment

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 account

Sign in

Already have an account? Sign in here.

Sign In Now
  • Recently Browsing   0 members

    • No registered users viewing this page.
×
×
  • Create New...