Getters and Setters not cooperating in 19r1.1?

I’m working on a new project and setting my Properties to use the Get and Set methods. However, I’m finding that the Set is not always being called when I do something like this:

intCurrentFileSelectionRow = Me.ListIndex  // Me is a generic ListBox and ListIndex is set at this point

My setter is simply:

p_intCurrentFileSelectionRow = Value // private

If I check the value of intCurrentFileSelectionRow (.Get contains Return p_intCurrentFileSelectionRow), it is always 0.

Is there a bug here, or am I misunderstanding Xojo’s implementation of getters and setters?

Linux (multiple)

don’t you mean GET here?

GET returns the value
SET well sets the value

Yes - typo fixed.

no idea
I use getter setter in computed properties all the time and have a listbox subclass that has ones along this line and they work just fine

The more interesting discovery is that if I check the private p_intCurrentFileSelectionRow, that value is correct in the debugger so teh Set must be working properly. It seems to be something with the Get that’s off.

I have verified that the variable names all match :smiley:

Could p_intCurrentFileSelectionRow be shadowed? i.e. a superclass and a subclass both define it as a property?

Well did you change the listbox selection to an item other than 0?

To wat listindex did you set it otherwise?

while shadowing should generally be avoided there are times when you cant becuase the property is the right name or you want to make sure that if the property is set you take some action

so there are definitely better ways to do shadowing as I discuss in this blog post and this one

[quote=455093:@Derk Jochems]Well did you change the listbox selection to an item other than 0?

To what listindex did you set it otherwise?[/quote]
As I mentioned, it was selected - 125 in this last case - and the private var :wink: :wink: has the proper value.

… more test runs …

However, I discovered that a timer that was locking in mode = 2 (even after the Timer’s Action event sets it to 0 at the end of the action and I only ever set it to 1 in use) was setting the value to 0 in a lot of cases before I called the getter. The timer is set to clear/reset the search panel’s selection, so it was working, it just shouldn’t have been getting set to 2 in ANY case - but that’s another discussion.