Welcome!

Welcome to the official BlackBerry Support Community Forums.

This is your resource to discuss support topics with your peers, and learn from each other.

inside custom component

Native Development

Reply
Developer
dbigham
Posts: 516
Registered: ‎04-01-2009
My Device: Z10, PlayBook
My Carrier: NA

SegmentedControl now requires that an option be selected

One of the apparent changes to version 6 of the SDK, if I'm not mistaken, is that the segmented control must always have an option selected.

 

In my app, this is not desireable... the app has the user rate a number of items. An analogy would be voting. If you were allowing a user to vote for 4 different things, you wouldn't want to default the vote to one of the people that can be voted for.

 

Is there a reason for why this was changed? 

Please use plain text.
Developer
greenback
Posts: 515
Registered: ‎10-17-2010
My Device: BlackBerry Z10, DAC

Re: SegmentedControl now requires that an option be selected

An alternative way of thinking of this would be to default to an option who's value is null or false.

Please use plain text.
Developer
dbigham
Posts: 516
Registered: ‎04-01-2009
My Device: Z10, PlayBook
My Carrier: NA

Re: SegmentedControl now requires that an option be selected

That's a reasonable workaround but I wish the control worked as it did before -- to allow no selection.

Please use plain text.
Developer
dbigham
Posts: 516
Registered: ‎04-01-2009
My Device: Z10, PlayBook
My Carrier: NA

Re: SegmentedControl now requires that an option be selected

Actually, that doesn't work because the control only allows up to four options and I need all four options for valid choices, thus I can't add a "" option to represent no selection.

Please use plain text.
Developer
greenback
Posts: 515
Registered: ‎10-17-2010
My Device: BlackBerry Z10, DAC

Re: SegmentedControl now requires that an option be selected

You could implement your own custom controls. 

 

Not sure what exactly you're making, but you may want to think about simplifying the amount of options that your end user needs to select on any given screen. It can be very easy to quickly overwhelm someone with lots of options.

 

 

Please use plain text.
Developer
dbigham
Posts: 516
Registered: ‎04-01-2009
My Device: Z10, PlayBook
My Carrier: NA

Re: SegmentedControl now requires that an option be selected

Yes, that's a good point and I've also considered that. For example, Android has a rating control where you click on stars. The downside is that takes more time and then you don't get the highly polished widget produced by RIM with nice fades etc.

Please use plain text.
BlackBerry Development Advisor (Retired)
mgoulet
Posts: 329
Registered: ‎05-07-2012
My Device: BB Alpha
My Carrier: N/A

Re: SegmentedControl now requires that an option be selected

Generally, SegmentationControl gives me the impression that each option leads to an existing concrete result of some sort; therefore it makes no sense to me to have one that does not contain a 'current' selection.

Although the UI would be different, RadioGroups come to mind when I think of singular selection with the possibility of null values. Depending on your UI design, this could work very well.

Martin

Please use plain text.
Developer
dbigham
Posts: 516
Registered: ‎04-01-2009
My Device: Z10, PlayBook
My Carrier: NA

Re: SegmentedControl now requires that an option be selected

[ Edited ]

Hi Martin,

 

I suppose I'm using the segmented control as more of a "rating control", or a "voting control" and so my desire for there to be a non-selected state follows from that. I think I agree with your premise if you're using it entirely within the narrow scope you suggest.

 

That said, it's not clear to me that limiting the control in this way is wise because you then exclude the control from being used as a rating control. Hard to say. Android has a rating control, BB10 does not. It seems tempting to relax a constraint of the segmented control as was the case in release 4 of the SDK to allow the control to be used in the broader context.

Please use plain text.
BlackBerry Development Advisor (Retired)
mgoulet
Posts: 329
Registered: ‎05-07-2012
My Device: BB Alpha
My Carrier: N/A

Re: SegmentedControl now requires that an option be selected

[ Edited ]

Thanks for your input;

Another option would be to implement a custom control which would take some effort. I agree that such a Rating control would be very useful - I recommend placing a feature request on our issue tracker for such a new control, or for adjustments to the existing SegmentationControl (as it used to function in the past). This risks becoming a very popular use-case and request; developers would definitely benefit from this moving forward.

 

Issue tracker: https://www.blackberry.com/jira/secure/Dashboard.jspa

 

Cheers,

Martin

Please use plain text.
Developer
dbigham
Posts: 516
Registered: ‎04-01-2009
My Device: Z10, PlayBook
My Carrier: NA

Re: SegmentedControl now requires that an option be selected

Please use plain text.