Wordwrap in code editor

  1. 2 weeks ago

    I've searched through the menus and preferences in the Xojo IDE but cannot seem to find a way to wordwrap anywhere.

    Some of my code lines (especially SQL statements) are quite long.

  2. Greg O

    Jan 12 Xojo Inc scout.galaxy.barn
    Edited 2 weeks ago

    There’s no automatic code wrap, but you can use the line continuation feature.

    Var s as String = “hello “ + _
        “World”
  3. Jean-Yves P

    Jan 12 Pre-Release Testers, Xojo Pro Europe (France, Besançon)
    Edited 2 weeks ago

    for sql I use something like

    dim sqlCode as String = "select *"
    sqlCode = sqlCode + " from mytable"
    sqlCode = sqlCode + " where rowid=10"

    it fits in the width of the window, and it's easier to maintain if you need to change some fields in the query.
    I also made some simple editor to manipulate sql queries, and then generate the corresponding xojo code
    -image-
    -image-

  4. Kem T

    Jan 12 Pre-Release Testers, Xojo Pro, XDC Speakers, MVP Connecticut

    Or add a constant.

  5. Greg O

    Jan 12 Xojo Inc scout.galaxy.barn

    It’s worth noting that the line continuation method works for more than just strings.

  6. Shame there's no proper word-wrap though, no idea why they've omitted that from the editor, would make for much easier code reading.

  7. @Kem T Or add a constant.

    Sorry Kem, you've lost me...

  8. Kem T

    Jan 12 Pre-Release Testers, Xojo Pro, XDC Speakers, MVP Connecticut

    You can add a String constant to a window, class, or module, and you can type your sql in there with a simple editor.

  9. @Kem T You can add a String constant to a window, class, or module, and you can type your sql in there with a simple editor.

    Oh, ok. Still not an elegant solution, I just figured I was missing a tick box in the preferences somewhere to turn on word-wrap, can't quite believe it's missing.

  10. Tim S

    Jan 12 Pre-Release Testers Canterbury, UK

    @Rod P I've searched through the menus and preferences in the Xojo IDE but cannot seem to find a way to wordwrap anywhere.

    Some of my code lines (especially SQL statements) are quite long.

    So are some of mine. I split them with the continuation character - underscore (_)

  11. Dave S

    Jan 12 San Diego, California USA
    Edited 2 weeks ago

    this is the way *I* prefer to handle it... much more readable in my opinion

    SQL= _
    "SELECT id_list "+_
    "  FROM myTable "+_
    " WHERE listname='xyz'"
  12. Richard D

    Jan 12 Pre-Release Testers, Xojo Pro Europe (UK, London)

    @Dave S this is the way *I* prefer to handle it... much more readable in my opinion

    SQL= _ "SELECT id_list "+_ " FROM myTable "+_ " WHERE listname='xyz'"

    i usually replace the 'xyz' with a placeholder instead and then use replace the placeholder with the value.

  13. Dave S

    Jan 12 San Diego, California USA

    So do I , but I was just illustrating the format the I use, not the code logic itself...
    as a matter of fact.. none of my SQL usually even has hard code table names... Those are all constants, on the off chance I need/want to change them before the app is complete. Change once, affect many.

or Sign Up to reply!