BUG - iOSSegmentedControl - iOS Selector Control

Ver. Xojo 2016 R4.1Mac

I discovered bug in Xojo Selector Control.

Place Selector control to View and then try to remove all items from code and then load items and try to set any item as selected item.

Super: iOSSegmentedControl

Object Inspector:

In Behavior part

Value should be set to 0 not to -1 since -1 is default value when place it on View.

If you don’t set to 0 you will get error all the time when you run App in debug mode at least.

I hope that guys from Xojo team will see this and fix it.

Thanks.

You can’t set the segmented control value at run time
You can use it in the IDE to set the initial selected item

if you need to change the selected item you need to use:
mySegmentedControl.item(1).selected=true

Hi,
Guess you didn’t get a point.
Just drag and drop selector control.

Via code use let say like is made in Notes example

	Me.RemoveAll
	
	for each cat as text in note.Categories
			
			me.Add(new iOSSegmentedControlItem(cat))
			
	next

Also in class SET part when you try to set value for it, it will indicate bug
Class Note (Set)

	mNote = value
	
	NoteTitleField.Text = mnote.Title
	NoteDetailsArea.Text = mnote.Details

So to resolve this, in Design mode you should set value from -1 to 0 like i described already in post.

What you set in design mode is what you want selected when you open the view. Since you remove all, is has no sense.

Have you tried this?
CategorySelector.item(mnote.Category).selected=true
IconSelector.item(mnote.IconNum).selected=true

Here you go screen shots and please look Inspector on right side :slight_smile:
When you drop a control value is -1.
With given code you will get bug and error.

After you set in code inspector value to 0 from -1 then no more bug and errors.

Screen 1

http://tinypic.com/r/2dwbxnt/9

Screen 2

http://tinypic.com/r/20qc0oy/9

Screen 3

http://tinypic.com/r/1zd0lew/9

Screen 4

http://tinypic.com/r/19v0qv/9