+ Reply to Thread
Results 1 to 7 of 7

Thread: Centering text: Harder than it seems.

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

    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 10: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. Got ideas for improving the RIFT community? Feel free to PM me. Just came back? Welcome back! Here's what's changed. (NOTE NEW URL)

  2. #2
    Shield of Telara Semele's Avatar
    Join Date
    Mar 2011
    Posts
    712

    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 72 Guardian Mage
    RotP 4/4 - DH 4/4 - GP 4/4 - GSB 5/5 - RoS 5/5 - HK 11/11 - ID 8/8

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

    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. Got ideas for improving the RIFT community? Feel free to PM me. Just came back? Welcome back! Here's what's changed. (NOTE NEW URL)

  4. #4
    Rift Disciple Verea's Avatar
    Join Date
    Feb 2011
    Location
    Netherlands
    Posts
    179

    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?
    Asleep, level 50 Cleric @ Blightweald EU [Darkwind]
    I want to fly like an eagle, to the sea.
    I want to fly like an eagle, let my spirit carry me.

  5. #5
    Shield of Telara Semele's Avatar
    Join Date
    Mar 2011
    Posts
    712

    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 72 Guardian Mage
    RotP 4/4 - DH 4/4 - GP 4/4 - GSB 5/5 - RoS 5/5 - HK 11/11 - ID 8/8

  6. #6
    Rift Disciple Verea's Avatar
    Join Date
    Feb 2011
    Location
    Netherlands
    Posts
    179

    Default

    I see, I only ever use a single line of text for each text frame, so that might explain a lot.
    Asleep, level 50 Cleric @ Blightweald EU [Darkwind]
    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
    13,476

    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. Got ideas for improving the RIFT community? Feel free to PM me. Just came back? Welcome back! Here's what's changed. (NOTE NEW URL)

+ 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