+ Reply to Thread
Results 1 to 5 of 5

Thread: No word wrap in RiftTextfield: Anyone got ideas?

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

    Default No word wrap in RiftTextfield: Anyone got ideas?

    So, I want to allow people to type more than a single short line of text in a window.

    What do?

    RiftTextfield doesn't have :SetWordwrap. You can't tell it to auto-resize so you can't find out how wide it is, so you can't really scroll, and even if you could, scrolling SUCKS for paragraphs.

    Basically, I want about what the mailbox Send page has.

    Anyone solved this?
    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
    Plane Touched Verea's Avatar
    Join Date
    Feb 2011
    Location
    Netherlands
    Posts
    200

    Default

    I'll come back to this later, but I'll say one thing:

    libTea.GUI.Widget.Textfield

    Has exactly this functionality, among many other things like tabs, several data graphs and more. You might want to look at that when it's done.

    Of course the downside is that you lose the native look. Of course, libTea.GUI has its own look that can easily be changed.

    But either way, I'll have a look for you if this is possible with the native widget, but maybe this is an idea?
    Store the written string in a variable, and only show 16 characters, when someone presses left or right while at a certain cursor position, you can simply take a different slice of the string?

    A workaround sure, and not even sure if that's possible as I never used the native frames supplied by the API yet.
    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.

  3. #3
    Rift Chaser NerfedWar's Avatar
    Join Date
    Dec 2010
    Posts
    377

    Default

    Quote Originally Posted by the_real_seebs View Post
    So, I want to allow people to type more than a single short line of text in a window.

    What do?

    RiftTextfield doesn't have :SetWordwrap. You can't tell it to auto-resize so you can't find out how wide it is, so you can't really scroll, and even if you could, scrolling SUCKS for paragraphs.

    Basically, I want about what the mailbox Send page has.

    Anyone solved this?

    You've already worked out how to add newlines, combine this with a fixed-width font (to let you calculate whether the next character of a line will extend beyond the width of the text field) and you could move the word to the next line.
    ...the internet treats censorship as damage, and routes around it...
    NerfedWar Addons and Tutorials
    * Note: tutorials are currently being ported to the new site.

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

    Default

    You can't set the font of a RiftTextfield either.

    Although I can of course search the entire field for lines, split them up, and so on.
    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!)

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

    Default

    From IRC, my vague thoughts:
    Okay, phase one. Imagine that we redefine our concept of the field, such that a newline translates to a space, and a double-newline to a newline.
    We can implement this through a two-step process in which we translate all newlines to \1, then translate \1\1 to \n and \1 to ' '.
    So, we have a field which is currently in this state. What we do:
    1. Do the newlines to spaces-and-newlines transformation.
    2. Set a Text frame to this text.
    3. Check its width. If it is larger than the width of the frame, we then have to wrap it. To wrap it, we look at each line, and see whether it is too long. If it is too long, we try to find the first subline that's not too long, change that space into a newline, and try again on the rest of this line. After each line, we insert a newline.
    At the end of this, we have a thing which has width suitable for the field, at which point we can :SetText() the field with it.

    The only special case is that any time we encounter a line with no spaces which is too wide, and have to insert a newline (which then permanently breaks that word at that point), we have to increase the cursor position by one if and only if the cursor was after that point.
    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