Help with SegmentedControl

I’m trying to add to a iOS SegmentedControl programatically. The language reference shows sample code of “.Append”, but that’s not a valid method.

If anyone could send an example of how to add segments with a name programatically.

Thanks

[quote=154497:@Jon Daggett]I’m trying to add to a iOS SegmentedControl programatically. The language reference shows sample code of “.Append”, but that’s not a valid method.

If anyone could send an example of how to add segments with a name programatically.
[/quote]

TestSegmentedControl.Add(New iosSegmentedControlItem("Mars"))

I reported the error in the LR <https://xojo.com/issue/37478>

I have that working now, thank you.

But now a different issue, which might actually be a bug, but not sure.

If I do a “.RemoveAll” and then re-populate the control, if the number of segments is smaller than it was previously, the extra segments still show up. So, for example, if I had 11 segments labeled 1 thru 11, and then did a RemoveAll and added 8 new segments labeled A thru H , what I end up with is: A B C D E F G H 9 10 11 (the last 3 shouldn’t be there).

Am I missing something, or is that a bug in Xojo?

[quote=154516:@Jon Daggett]I have that working now, thank you.

But now a different issue, which might actually be a bug, but not sure.

If I do a “.RemoveAll” and then re-populate the control, if the number of segments is smaller than it was previously, the extra segments still show up. So, for example, if I had 11 segments labeled 1 thru 11, and then did a RemoveAll and added 8 new segments labeled A thru H , what I end up with is: A B C D E F G H 9 10 11 (the last 3 shouldn’t be there).

Am I missing something, or is that a bug in Xojo?[/quote]

Looks like a bug. I also tried RemoveByIndex, and it crashes. You may want to file a bug report in Feedback.