AddExpandableRow problem

  1. 2 weeks ago

    John A

    Jan 11 Glasgow, Scotland

    I have a fairly complex listbox which has the Allow Expandable Rows property set.
    When the disclosure triangle is clicked a variable number of rows should be created for the row being expanded.
    The expansion is only 1 level deep.

    My problem is when I click the triangle ExpandRow is not being called, the Change event is.
    At this point Change causes the program to fail.
    If I disable the change event and run the program and click the triangle the row remains selected, click it again and the ExpandRow event runs fine.
    The documentation uses DoubleClick to toggle the expanded status, but it doesn't cure the problem either.

    I don't understand why the Change event is being called. Anyone got any ideas?

    Jack

  2. Emile S

    Jan 11 Europe (France, Strasbourg)

    The File Browser example works fine (load an example, Files, File Browser).

    Can you try it ?

  3. John A

    Jan 11 Glasgow, Scotland

    Yes I know, I tried it and I wrote a simple program that created and loaded a hierarchical listbox and
    its Expand / Collapse events worked fine. What I can't figure out is why the Change event is running
    instead of the ExpandRow.

  4. Tim P

    Jan 11 Pre-Release Testers, Xojo Pro Rochester, NY

    @John A What I can't figure out is why the Change event is running instead of the ExpandRow.

    It's likely just running before, and your code needs to be refactored to defend against invalid selections. Work out the error in the Change event. You haven't told us what it is, but I bet it's fixable and the actual root of the problem.

  5. John A

    Jan 11 Glasgow, Scotland

    The change event is running and as a result it is calling a method that tries to access a table that doesn't yet exist, hence a NilObjectException. I still have an earlier version of the program that uses API v1 and it works fine, even if I compile that in Xojo 2019v3. In that version clicking the disclosure triangle calls the ExpandRow event and doesn't go near Change. I don't think it's an API problem.

    And I'm absolutely sure it's my problem, I just can't figure out why the Change event is running so I don't really know where to look.

  6. Tim P

    Jan 11 Pre-Release Testers, Xojo Pro Rochester, NY

    @John A I just can't figure out why the Change event is running so I don't really know where to look.

    If you found a different behavior between the classic API and API 2.0 you should file that as a bug report!

  7. jim m

    Jan 11 Pre-Release Testers, Xojo Pro piDog.com

    Do you have any code in cellClick that might cause change to fire?

  8. John A

    Jan 13 Glasgow, Scotland

    Thanks for that. I'm quite sure I'm doing something wrong, I've no idea what or where to start looking. I created this section of the app by cutting and pasting from an older version and converted to API2.0. I'll rewrite it from scratch and if the behaviour reappears in the new version I'll report it.

or Sign Up to reply!