SC2Mapster Forums

Development > Triggers

Dialog List - Scroll

  • 9 posts
    #1 Jan 29, 2013 at 23:14 UTC - 0 likes

    Is there a way to make a list box automatically scroll to the bottom when a new item is added? I have tried automatically selecting the newest entry for all players, but that just scrolls it down to the second newest entry instead of the newest one (how does this making any friggin sense?)

    I also want to change the scroll bar image of the list box.

    I would appreciate any help.

    #2 Jan 30, 2013 at 15:08 UTC - 0 likes

    You could try to save the current selection of the player, add the new entry, add an additional entry, select the last one, remove it and reselect the previously saved entry.

    To change the scroll bar image you have to script your UI through XML files directly, I guess. In "StandardTemplates.SC2Layout" you'll find a list box template. Change its scroll bar. You may ask for further details if you are new to those XML files ;)

    #3 Jan 30, 2013 at 17:10 UTC - 0 likes
    Quote from rtschutter: Go

    Is there a way to make a list box automatically scroll to the bottom when a new item is added? I have tried automatically selecting the newest entry for all players, but that just scrolls it down to the second newest entry instead of the newest one (how does this making any friggin sense?)

    I also want to change the scroll bar image of the list box.

    I would appreciate any help.

    I ran into this problem with Malum Ruina and Xeno Crisis. My solution was to remove the old list items so the newest ones were always visible, eliminating the scroll bar completely.

    My Projects:
    Malum Ruina: SC2Mapster
    Eternal Exile: SC2Mapster
    Spine Crawler Madness: SC2Mapster
    Xeno Crisis: SC2Mapster

    #4 Jan 30, 2013 at 19:28 UTC - 0 likes

    @Sanktoras: Go

    I actually tried that, all it does is scroll to the second newest entry (even after deleting the newest it still goes back one further, so there is always one entry that isn't shown).

    @BasharTeg: Go

    I considered that...but since I am using it as a chat I really want people to be able to go back through it.

    #5 Jan 31, 2013 at 12:11 UTC - 0 likes
    Quote from rtschutter: Go

    @Sanktoras: Go

    I actually tried that, all it does is scroll to the second newest entry (even after deleting the newest it still goes back one further, so there is always one entry that isn't shown).

    @BasharTeg: Go

    I considered that...but since I am using it as a chat I really want people to be able to go back through it.

    Well you could create another dialog to act as a chat log. In that case, the player could click a button to bring up the log and peruse through it at his leisure.

    The other consideration is to scrap the idea of using a list for chat and instead use a system which generates labels from chat messages.

    Last edited Jan 31, 2013 by BasharTeg
    #6 Jan 31, 2013 at 15:32 UTC - 0 likes

    you could also make an edit box at the bottom of the chat area which has the most recent message in it.or make a blank message at the bottom which remove each time it updates and the add the message and the blank back in, that way it always shows the most recent message. you could even have the blank be something like "Gameheart Overlay by rtschutter"

    Last edited Jan 31, 2013 by willuwontu
    #7 Jan 31, 2013 at 16:21 UTC - 0 likes

    Thank you guys very much for all of your suggestions. I am considering all of them.

    I eventually came to the same idea that Willuwontu has suggested and it works okay, the main problem with it is that the scrollbar of course still shows that it isn't quite at the bottom yet (which will drive any OCD player like me up the wall).

    The other problem with using a list box system is that if someone types too many characters it just cuts them off with a "..." at the end instead of dropping down to a new line and continuing. A dialog label system might be the right way to do it, but creating a scroll bar from scratch is not an idea that excites me to be honest.

    #8 Jan 31, 2013 at 16:45 UTC - 0 likes
    Quote from rtschutter: Go

    The other problem with using a list box system is that if someone types too many characters it just cuts them off with a "..." at the end instead of dropping down to a new line and continuing. A dialog label system might be the right way to do it, but creating a scroll bar from scratch is not an idea that excites me to be honest.

    Even with a label system you would run into the problem of text being cut off. Unless you have a font where every character is the same width, it's impossible to tell exactly how long each line will be. The system I used was to break the entered chat line into separate strings and create multiple list items. For example, if the entered chat line was between 20 and 40 characters, I would break the entered chat line into two substrings, the first being 20 characters long and the next being as long as the number of characters remaining in the chat line. It's certainly not ideal, but it worked well about 85% of the time.

    #9 Mar 22, 2013 at 19:03 UTC - 0 likes

    @BasharTeg: Go

    that method will not work if you are putting the players name in which since it is a chat system it will not work

  • 9 posts

You must login to post a comment. Don't have an account? Register to get one!