+ Reply to Thread
Results 1 to 9 of 9

Thread: Centering text: Harder than it seems.

  1. #1
    RIFT Community Ambassador the_real_seebs's Avatar
    Join Date
    Jan 2011
    Posts
    16,859

    Default Centering text: Harder than it seems.

    So, long story short: I have a stack of frames, and I want some to be centered, and I want them to fit within a larger frame.

    If I just setpoint them to the larger frame, text is all left-justified.

    If I setpoint them using BOTTOMCENTER and don't specify a width, they grow larger than the frame rather than wordwrapping.

    If I specify a width, we're back to left-justified again.

    So it seems to me that some kind of alignment-within-field settings would be awfully useful. In particular, in at least some cases, I might want something to remain centered when it's more than one line, and I can't see any sane way to get there.

    So I'm posting this here because if I asked for advice I'd never get it, but if I make the claim, and I'm wrong, someone will correct me.

    EDIT: Come to think of it, everything I want could probably be satisfied by a :SetMaxWidth(), except for the case of wanting multi-line centering.
    Last edited by the_real_seebs; 03-30-2012 at 07:22 PM.
    You can play WoW in any MMO. You don't have to play WoW in RIFT. Oh, and no, RIFT is not a WoW clone. Not having fun any more? Learn to play, noob! I don't speak for Riftui, but I moderate stuff there. Just came back? Welcome back! Here's what's changed. (Updated for 2.5!)

  2. #2
    Sword of Telara Semele's Avatar
    Join Date
    Mar 2011
    Posts
    872

    Default

    I think I would prefer any text frame to have the following method.

    :SetJustification("left"|"right"|"center")

    I know it's entirely possible to do it ourselves with a bunch of frames etc, but yeah. Completeness and all. Plus the fact that multi-line text will default to left (if I remember correctly).
    Rank 76 Guardian Mage

  3. #3
    RIFT Community Ambassador the_real_seebs's Avatar
    Join Date
    Jan 2011
    Posts
    16,859

    Default

    Strongly agreed. That, plus wrapping on RiftTextfield, and I could have my RP addons pretty much done.

    ... Trion's slipping. I posted about this like three hours ago, and it's not in PTS changelog yet.
    You can play WoW in any MMO. You don't have to play WoW in RIFT. Oh, and no, RIFT is not a WoW clone. Not having fun any more? Learn to play, noob! I don't speak for Riftui, but I moderate stuff there. Just came back? Welcome back! Here's what's changed. (Updated for 2.5!)

  4. #4
    Plane Touched Verea's Avatar
    Join Date
    Feb 2011
    Location
    Netherlands
    Posts
    200

    Default

    Maybe I misunderstand but:

    local text = UI.CreateFrame("Text", "My Text", myaddon.frame)
    text:SetPoint("CENTER", myaddon.frame, "CENTER")

    Would do exactly what you want? Or?
    Verae, level 60 Cleric @ Blightweald, Guild Master of Tea Club
    I want to fly like an eagle, to the sea.
    I want to fly like an eagle, let my spirit carry me.

  5. #5
    Sword of Telara Semele's Avatar
    Join Date
    Mar 2011
    Posts
    872

    Default

    Quote Originally Posted by Verea View Post
    Maybe I misunderstand but:

    local text = UI.CreateFrame("Text", "My Text", myaddon.frame)
    text:SetPoint("CENTER", myaddon.frame, "CENTER")

    Would do exactly what you want? Or?
    The works just fine for single line text (as does "RIGHT"), but any multi-line text will only center/right justify the longest/first line. Everything else will be left justified to the side of the text frame.

    It's one thing that's stopped me from implementing a width limited alert text system for KBM. And, to boot, would love escape codes for font color also :P
    Rank 76 Guardian Mage

  6. #6
    Plane Touched Verea's Avatar
    Join Date
    Feb 2011
    Location
    Netherlands
    Posts
    200

    Default

    I see, I only ever use a single line of text for each text frame, so that might explain a lot.
    Verae, level 60 Cleric @ Blightweald, Guild Master of Tea Club
    I want to fly like an eagle, to the sea.
    I want to fly like an eagle, let my spirit carry me.

  7. #7
    RIFT Community Ambassador the_real_seebs's Avatar
    Join Date
    Jan 2011
    Posts
    16,859

    Default

    Yeah. The other thing is, that only works if the single line of text isn't too wide. The moment you :SetWidth() it, it has a fixed width and it is left-aligned in its box.
    You can play WoW in any MMO. You don't have to play WoW in RIFT. Oh, and no, RIFT is not a WoW clone. Not having fun any more? Learn to play, noob! I don't speak for Riftui, but I moderate stuff there. Just came back? Welcome back! Here's what's changed. (Updated for 2.5!)

  8. #8
    Rift Disciple Galuhad's Avatar
    Join Date
    Feb 2011
    Location
    London, UK
    Posts
    130

    Default

    Was a solution to this ever implemented? I'm trying to find a way of centralising multiple lines of text within a text frame, but can't see any obvious methods.

    Thanks.
    GALUHAD
    CSTM - Faeblight (RP - NA)
    Dimensions: Elven Retreat | Floods of Isengard (PvP)
    Twitter | Twitch | YouTube

  9. #9
    RIFT Community Ambassador the_real_seebs's Avatar
    Join Date
    Jan 2011
    Posts
    16,859

    Default

    Never found one.
    You can play WoW in any MMO. You don't have to play WoW in RIFT. Oh, and no, RIFT is not a WoW clone. Not having fun any more? Learn to play, noob! I don't speak for Riftui, but I moderate stuff there. Just came back? Welcome back! Here's what's changed. (Updated for 2.5!)

+ Reply to Thread

Bookmarks

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts