Help with an IF block

  1. 2 months ago

    Ramon S

    Aug 17 Pre-Release Testers, Xojo Pro UPC, Europe (Barcelona, Spain)

    I can not imagine what is the problem with such obvious behaviour.
    I have and instance of a class defined in the module (local): Polyline
    This class has a property called Closed.
    I've created a break point to check the value of this property and it is TRUE.
    However if I press the button Step the program skips the IF block.
    How is it possible?
    Here you have an animation to understand better the problem.

    An help will be appreciated.

    -image-

    It seams that the problem is the property called "Closed". "Closed" i protected?
    Perhaps, because I changed the property name to "Clossed" ans everything works as it should.

    This type of silent errors not detected are very, very annoying.

  2. Julian S

    Aug 17 Pre-Release Testers, Xojo Pro UK

    I remember helping someone with an issue like this a long time ago, it was something like two instances conflicting, maybe one was a global, I can't quite remember but its worth checking that you don't have another Polyline somewhere that is in scope at that point.

  3. Ramon S

    Aug 17 Pre-Release Testers, Xojo Pro UPC, Europe (Barcelona, Spain)

    It could be. I will look at it. Thanks!

  4. Jeff T

    Aug 17 Pre-Release Testers Midlands of England, Europe

    Try putting the value into a local variable

    Dim debugClosed as boolean
    debugClosed = PolyLine.closed
    
    if debugClosed then 
    //etc
  5. Ramon S

    Aug 17 Pre-Release Testers, Xojo Pro UPC, Europe (Barcelona, Spain)

    @Julian
    Unfortunately it is not the reason.
    As it was local object I changed its name: POLYLINE2D, so now it is impossible to coincide with another object.
    And the behaviour is exactly the same.

    @Jeff
    This is a good idea.
    I wrote this line before the IF :

    Dim Closed As Boolean = Polyline2D.Closed

    And curiously according to the variables panel
    Closed = False
    Polyline2D.Closed = True
    I don't understand.

  6. Ramon S

    Aug 17 Pre-Release Testers, Xojo Pro Answer UPC, Europe (Barcelona, Spain)

    It seams that the problem is the property called "Closed". "Closed" i protected?
    Perhaps, because I changed the property name to "Clossed" ans everything works as it should.

    This type of silent errors not detected are very, very annoying.

  7. Norman P

    Aug 17 Pre-Release Testers, Xojo Pro great-white-software.com/blog

    Really depends on what this class is a subclass of
    I cant tell that from the gif

  8. Ramon S

    Aug 17 Pre-Release Testers, Xojo Pro UPC, Europe (Barcelona, Spain)

    @Norman P Really depends on what this class is a subclass of
    I cant tell that from the gif

    Thanks Norman for paying attention to this case.
    In fact there was a misinformation in what I said: "Closed" was a method of the Class, not a property.
    I don't know if this is relevant or not, but I think it is, and most of that behaviour was due to this fact.
    Fortunately everything works now and I can go on with my task.

  9. Norman P

    Aug 18 Pre-Release Testers, Xojo Pro great-white-software.com/blog

    Really wont matter whether it was a Property or Method
    Having to rename to a misspelled name works around the issue but I was trying to focus on understanding why this issue arose in the first place
    Hence why I was curious about super classes etc

  10. Ramon S

    Aug 19 Pre-Release Testers, Xojo Pro UPC, Europe (Barcelona, Spain)

    @Norman P Really wont matter whether it was a Property or Method
    Having to rename to a misspelled name works around the issue but I was trying to focus on understanding why this issue arose in the first place
    Hence why I was curious about super classes etc

    Hi Norman.
    I'm sorry I couldn't answer you before.
    This class is defined as Public in a method and has no Super
    I hope it serves to you now.

    -image-

  11. Tim P

    Aug 20 Pre-Release Testers Rochester, NY

    @Ramon S Hi Norman.
    I'm sorry I couldn't answer you before.
    This class is defined as Public in a method and has no Super
    I hope it serves to you now.

    Creating a new project, adding an empty class, and checking the Closed property won't compile - so something in your project is named Closed on a global scope. You may wish to look for and fix that.

  12. Ramon S

    Aug 20 Pre-Release Testers, Xojo Pro UPC, Europe (Barcelona, Spain)

    Thanks Tim for your help.
    In fact I changed the name of the property and everything worked, so I forgot about looking for the real reason.
    But the thing is I am not complaining about this problem, my concern is about the fact that Xojo said nothing at all, this property(method) was a boolean and Xojo returned False without saying anything about any possible duplicate.
    May be this is the normal way for Xojo, but when you are used to so many error detections (which I love), it was very difficult to isolate this problem.

  13. Tim P

    Aug 20 Pre-Release Testers Rochester, NY

    Yeah, it's not a huge issue since you're up and running again. I'm just the curious type who likes to know why something operates the way it does - so I'd dig into the cause :)

  14. Norman P

    Aug 20 Pre-Release Testers, Xojo Pro great-white-software.com/blog

    There's some thing not right about whats been posted
    tyDXF_Polyline in the second image has no super and no property named closed which doesnt match up with the very first image
    So closed isnt inherited based on this second image

  15. Ramon S

    Aug 20 Pre-Release Testers, Xojo Pro UPC, Europe (Barcelona, Spain)

    @Norman P There's some thing not right about whats been posted
    tyDXF_Polyline in the second image has no super and no property named closed which doesnt match up with the very first image
    So closed isnt inherited based on this second image

    Yes, you are right.
    The second image belongs to the solved problem. I changed "Closed" for "Tancada", but the rest is exactly the same as before.

or Sign Up to reply!