Indigo Rose Software

Professional Software Development Tools

 
+ Reply to Thread
Results 1 to 6 of 6
  1. #1
    Join Date
    Jul 2010
    Posts
    10

    Word Wrap Problem

    I tried to post this question in the AMS 7.5 section, but i guess i don't have permissions to.


    I collected multiline text from a input box, put it in a MySQL DB, then retieved it and placed it in a Paragraph Object.

    The Input word-wraps, but the result in the Paragraph Object doesn't.

    I've looked and search, and also looked for a plugin that might help, but no luck.

    In the DB only a single line gets entered. How can i retain the line breaks as it passes through the DB?

  2. #2
    Join Date
    May 2006
    Posts
    5,380
    You cant preserve line breaks coz there aint any to preserve, you can however turn off horizontal scrollbars in the paragraph objects property pane in the IDE, or use the below line of code

    Code:
    Paragraph.SetProperties("Paragraph1", {ScrollHorizontal=SCROLL_OFF});

  3. #3
    Join Date
    Jul 2010
    Posts
    10
    Horizontal scrollbars are off.

    I tried setting the code you specified in a page.onload and it seems to be the same, but after further testing it appears that if my paragraph object has space for 20 characters across and my word is 21+ it doesn't word-wrap that line. But if there are normal breaks like normal words, it's wrapping.

    For testing i was using a bunch of characters in a row, seeing the result i thought it wasn't wrapping, but in reality it is, just not if you have one long word. It would be nice if it forced a wrap automatically at the amount of visible characters in the paragraph object (regardless of the presence of word breaks).

    I think this will work fine, i appreciate your assistance, have a great day.

  4. #4
    Join Date
    May 2006
    Posts
    5,380
    page.onload
    Do you mean Page PreLoad, if so, objects are not available in this event as it get executed before the page and objects are created, you should use Page On Show

    Try padding each line with a few space characters before you save the text, maybe this will fix the word wrap thing in the paragraph.

    You can use String.Replace for this, just replace "\r\n" with "\r\n ", worth a try, no?

  5. #5
    Join Date
    Jul 2010
    Posts
    10
    I had it on Show.

    Like you pointed out, there are no line breaks, so i don't think i can replace "\r\n" (it won't find it). I'm using an input box to gather the text, it's set to multiline and input text goes in wrapped, but once i Input.GetText("input_message"); it must be excluding the newline characters. In the DB it's just a single line with no "\r\n" etc...

    Like i pointed out previously, it truly is wrapping, i was mislead to think it wasn't, because if you happen to place 21+ characters in a box that has 20 characters of space (on one line), then it won't wrap. I figure it'll be extremely rare if ever someone enters text in that way.

    Thanks for your assistance.

  6. #6
    Join Date
    May 2006
    Posts
    5,380
    I figure it'll be extremely rare if ever someone enters text in that way.
    So your app is not for the welsh then, lmao

    "Llanfairpwllgwyngyllgogerychwyrndrobwllllantysili ogogogoch" (a railway station on the island of Anglesey in Wales)

    EDIT: im sure there is a way to get the text line by line from a edit control (Input), let me check MSDN and get back to you!

    Altho you say "it would be rare", im a sucker for making things *right* and *error* free, a wise man once said, when it comes to programming, "when making something completely fool proof, never underestimate the ingenuity of the complete fool"
    Last edited by RizlaUK; 12-22-2011 at 06:26 AM.

Posting Permissions

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