RadioButton Question

17 views
Skip to first unread message

mcw

unread,
Sep 21, 2018, 5:30:53 PM9/21/18
to CodenameOne Discussions
Are setOppositeSide and setToggle mutually exclusive?

I used an example you posted on another thread to use custom images on a CheckBox here. It worked great.

So I tried to use the same approach with a RadioButton. It worked but the setOppositeSide setting was ignored. It always displays my images on the left.

Thanks

Shai Almog

unread,
Sep 22, 2018, 12:22:52 AM9/22/18
to CodenameOne Discussions
setOppositeSide applies to the radio button itself. The image is placed based on the setTextPosition property inherited from label.

mcw

unread,
Sep 23, 2018, 6:09:54 PM9/23/18
to CodenameOne Discussions
Thanks for the info.

I did set the text position and it did move the image to the right. But it was placed right after the text rather than aligned vertically on the right edge of the container. That makes sense, it is the way Label works. I couldn't find an answer for that so ended up using a different approach for this.

Thanks

Shai Almog

unread,
Sep 24, 2018, 12:30:41 AM9/24/18
to CodenameOne Discussions
Generally the solution for that is to compose two labels (icon and text) in a container e.g. border layout.
In retrospect we made a mistake with all the label modes and should have used layouts for everything.
Reply all
Reply to author
Forward
0 new messages