Property Comments

  1. 2 weeks ago

    Robert W

    Nov 27 Western Canada
    Edited 2 weeks ago

    I don't think I've ever seen a discussion of this, or seen anything in the documentation about this, but I'm sure that everyone on the forum is aware of this.

    If you create a property in your project (either in a window or class or app), you can type some text in the code editor window, and it will be saved when you save your project, and magically reappear when you open it again. This would seem to be an ideal way to add a comment about the property. Except, as I mentioned above, I've never seen anything in the documentation to suggest doing this. So, I'm wondering, since it appears to be undocumented, is it safe to put comment text in the code editor window? If it is (or isn't), how many of you take advantage of this to document your properties?

    Context:
    Being somewhat hard of thinking, I probably overdocument my code, because I know that a week after I write something, I'll have no idea how it works unless there are two comments for every line of source code.

  2. Emile S

    Nov 28 Europe (France, Strasbourg)

    This is know and existsed in REALbasic / Real Studio.

    Yes, usefull. Sometimes I even add where it is used (of course after I explain its meaning / use).

    Same kind are the Notes.

  3. Kevin G

    Nov 28 Pre-Release Testers, Xojo Pro Gatesheed, England

    I added a request back in 2017 & 2019 to improve the documentation of methods and to add the ability to document parameters and the return.
    Feedback Case #48717

  4. Rick A

    Nov 29 Pre-Release Testers (Brazil. UTC-3:00)

    I always do that, also I do prefix the comment with a // just in case for enhanced security reasons.

    -image-

  5. Julia T

    Nov 29 Sandy Hook, Connecticut

    It's not well-known, but you can also comment constants by using the usual '//' in the Default Value field in the Inspector.

  6. Dave S

    Nov 29 San Diego, California USA

    @Julia T It's not well-known, but you can also comment constants by using the usual '//' in the Default Value field in the Inspector.

    Julia... have you tried that?
    If the varialbe is a STRING then its value is your "comment" (unless you immediately assign a new value)
    if you change it to another datatype it removes your "comment" because it doesn't match the indicated datatype

  7. Rick A

    Nov 29 Pre-Release Testers (Brazil. UTC-3:00)

    @Julia T you can also comment constants by using the usual '//' in the Default Value field in the Inspector.

    I do recall doing something like that in the past, but probably a bug, right now the IDE does not allow me to put a value like "0 // comment" in the Default of a integer for example.

  8. Julia T

    Nov 29 Sandy Hook, Connecticut

    Well, it works for numbers anyway.

    -image-

    I used to do it all the time in RS, but like so many other nice features, it may be compromised in Xojo.

  9. Rick A

    Nov 29 Pre-Release Testers (Brazil. UTC-3:00)
    Edited 2 weeks ago

    In constants and enums I believe the IDE "lets" you put such values.

    -image-

  10. Tim P

    Nov 29 Pre-Release Testers Rochester, NY
    Edited 2 weeks ago

    You can also use reserved keywords like new in the enum editor. It's just that the enum and constant editors are incomplete and are missing some aspects of the field validation.

    If I were you, I would not rely on this behavior.

  11. Karen A

    Nov 29 Pre-Release Testers

    @Tim P You can also use reserved keywords like new in the enum editor. It's just that the enum and constant editors are incomplete and are missing some aspects of the field validation.

    If I were you, I would not rely on this behavior.

    You can also do that for structure members IIRC.

    It is certainly handy for documenting things so I would not call being able to put comments in such definitions a bug...

    Even if it originally was bug it's now a feature! ;)

    -karen

  12. Martin T

    Nov 29 Pre-Release Testers Germany

    @Tim P You can also use reserved keywords like new in the enum editor. It's just that the enum and constant editors are incomplete and are missing some aspects of the field validation.

    If I were you, I would not rely on this behavior.

    You did? I recently had the problem that the compiler of an enumeration called To or Event didn't want and I had to rename them.

    If I interpret your statement correctly, is it possible to use these names? If so, how?

  13. Tim P

    Nov 29 Pre-Release Testers Rochester, NY

    @MartinTrippensee You did? I recently had the problem that the compiler of an enumeration called To or Event didn't want and I had to rename them.

    Yes, if the editor were operating correctly, you wouldn't be able to enter them at all. The same behavior as the name of a control or class.

    @Martin Trippensee If I interpret your statement correctly, is it possible to use these names? If so, how?

    No, you misunderstood - and that you want to find a way to use them is alarming.

  14. Martin T

    Nov 29 Pre-Release Testers Germany

    @Tim P No, you misunderstood - and that you want to find a way to use them is alarming.

    Why is that alarming? I don't understand why the compiler prevents the execution if, for example, MyEnumerationTypes.Event is uniquely assigned. It is obvious that this is an enumeration and not an event.

  15. Norman P

    Nov 29 Pre-Release Testers, Xojo Pro under THE bus

    In an Enum its impossible for a value named the same as a keyword to be misinterpretted since you always have to prefix it with the enumeration name to refer to a specific value

    I reported a bug with this
    Feedback Case #56375

  16. Craig H

    Nov 29 Black Hills, SD, USA

    @Robert W ...If you create a property in your project (either in a window or class or app), you can type some text in the code editor window, and it will be saved when you save your project, and magically reappear when you open it again. This would seem to be an ideal way to add a comment about the property. ...

    Thanks for asking as I have had the same question. I remember that as a beginner, this large blank space seemed a bit imposing, as though inviting you to enter something. I also recall finding no mention in the documentation. I have been using it extensively for making notes and would find it irksome if it just went away on some future release.

    Unless I’m mistaken about the lack of documentation, XOJO should include some for this feature.

    As Rick A. mentioned, I also as a precaution made every line a commnent, but stopped the practice when I realized I could have auto-complete. (Why, again, can’t we have the option of auto-complete within a comment)?

    Note that there is a “Description” field in the IDE inspector (showing one line, but supporting multi-lines) for properties, methods, constants, event handlers, etc. , usually/always located on the “gear tab” panel. It shows by default for Event Handlers which only have the ‘gear’ panel). The Description field may be a convenient place to keep notes, though it appears that the contents are not printed when one prints out code, whereas the bonus Properties area appears to be printed. Also, I suspect that most of us would want to have more that a single line visible by default.

or Sign Up to reply!