SC2Mapster Forums

Development > Triggers

Center Dialog Label Text

  • 8 posts
    #1 Apr 14, 2011 at 00:07 UTC - 0 likes

    I have made a dialog window with a label in it but I cannot seem to find a way to center the text inside the label. I thought it would be something easy to do but I can't find any way to do it. Is there something I am missing or do I have to keep moving the label depending on the text size?

    #2 Apr 14, 2011 at 00:12 UTC - 0 likes

    @Demon4231: Go

    You can't do this specifically, but there's a nice work-around tutorial from FuzzYD here.

    -You cannot step in the same river twice.
    #3 Apr 14, 2011 at 00:33 UTC - 0 likes

    @deathtorn: Go

    Actually you can!
    Somewhat.

    See.. text can have a lot of different text styles.
    Some text styles are center-aligned.

    Not all of them however, to find out which texts are center-aligned download this file:
    http://www.mediafire.com/?th850qg99egcaqc

    You can open it with the normal notepad.
    Look for those styles with the
    vjustify="Middle"
    attribute.
    Those work.

    #4 Apr 14, 2011 at 00:46 UTC - 0 likes

    @s3rius: Go

    That's pretty cool, but it comes with the issue of not being able to chose what you want your text to look like, so the work-around is better if you don't like the style, at least until we learn how to make our own styles.

    Last edited Apr 14, 2011 by deathtorn
    #5 Apr 14, 2011 at 00:54 UTC - 1 like

    Huh? Text alignment is impossible? When did that happen?

    align

    Last edited Apr 14, 2011 by Tolkfan
    Name Size MD5
    text_align.SC2Map 52.7 KiB f23047090f73...
    • text_align.jpg
    #7 Apr 14, 2011 at 01:18 UTC - 0 likes

    @Tolkfan: Go

    Nice! I guess I could've received some knowledge for going through all the trash that is know as styles.

    Last edited Apr 14, 2011 by deathtorn
    #8 Apr 14, 2011 at 01:34 UTC - 0 likes

    Ugh, something's wrong with editing posts, kept getting 404 errors :S

    Anyway, there's a built-in set of styles that begin with "Mod" and they have every combination of size, align and weight possible. Examples of combinations:

    • ModCenterSize32Bold
    • ModLeftSize20
    • ModRightSize40

    Possible font sizes: 12 16 20 24 28 32 36 40 52 64

    The only things you can't change are font family and vertical alignment.

    For text align to work, you have to use Set Dialog Item Style to set the style for the whole block/label, not just wrap the text in style tags. It's like trying to set alignment to an inline element in HTML, wont work.

    #9 Apr 15, 2011 at 19:16 UTC - 0 likes

    Centering dialog item text is definitely possible. You have to use "Set Dialog Item Style". "Text with Style" or using inline style tags does not work; the dialog item will ignore the alignment.

    You'll also need a font style with a center alignment. I recommend setting up a custom style.

    I've covered all of this in quite some detail here: http://forums.sc2mapster.com/resources/tutorials/17978-dialogs-really-great-looking-dialogs-part-2/

    Pocket Warriors - A pokemon-style game with SC2 units and full banking. New demo coming soon!

  • 8 posts

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