Jump to content

Scroll label


Tekken

Recommended Posts

  • Moderators
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 by IIYAMA
Link to comment
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
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 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
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
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 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...