Debug of Treeviews is dependent on focus

Date:Archived
Product/Release:Visual LANSA
Abstract:When debugging a treeview in Visual LANSA sometimes it may seem that the debugger is faulty, when in reality it is dictated by how the focus moves when in debug
Submitted By:LANSA Technical Support

When debugging a treeview in LANSA, using an ItemExpanding event, so that the values are only loaded into the treeview when the user clicks on the expand button, sometimes it may appear to the user that the debug program is not working correctly. If the user clicks on the first level of the treeview it will expand as expected.

If the user clicks on the first level of the treeview it will expand as expected.

However when the user clicks on the second level of the treeview it will simply replicate the second level options again.

Although a second level entry has been expanded, the focus remains on the first level item.

The reason for this is clear in the diagrams above. Note: Although a second level entry has been expanded, the focus remains on the first level item. Therefore in this situation the code will assume that the user has expanded the first level item, thus the second level entries are replicated. This has to do with the way that the debugger deals with focus, something which only exists in the debugger and can be easily resolved by simply clicking on the second level entry before expanding it. This will allow the replication of the real treeview behaviour when debugging a tree view.