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
simon_hain
Posts: 16,282
Registered: ‎07-29-2008
My Device: Z10 LE, Z30, Passport
Accepted Solution

Change text size for a checkbox

A checkbox seems to have a very huge font set, it is bigger than the font on the title bar.

Is there any way to change that, or would I have to use a label and an empty checkbox side by side?

----------------------------------------------------------
feel free to press the like button on the right side to thank the user that helped you.
please mark posts as solved if you found a solution.
@SimonHain on twitter
Developer
Hithredin
Posts: 404
Registered: ‎06-03-2010
My Device: Z10 Red

Re: Change text size for a checkbox

I created a custom component with a checkbox, a label and aliases, which is as simple to use as a common checkbox.

 

Container {
		property alias text: labeltext.text
		
                layout: StackLayout {
                    orientation: LayoutOrientation.LeftToRight
                }
                horizontalAlignment: HorizontalAlignment.Left
                CheckBox {
		    onCheckedChanged: {
                        checkChanged(checked);
                    }
                }
                Label {
		    id : labeltext
                }
}	
			
//USE
MyCheckbox{
	text: ""myText"
	function checkChanged(){
		//TODO
	}
}

 

Developer
peter9477
Posts: 6,473
Registered: ‎12-08-2010
My Device: PlayBook, Z10

Re: Change text size for a checkbox

I'm currently using a custom component as well, in at least one case where my checkbox had too little room and the large text in its label was actually getting "elided" (as in, fading out at the end, similar in functionality to the conventional "...").

The downside for me at the moment is that I didn't (yet) reimplement the behavior where the user can tap not only on the checkbox but also on the label, to toggle the checked state. I suggest doing that since it's a lesser user experience without it.

Peter Hansen -- (BB10 and dev-related blog posts at http://peterhansen.ca.)
Author of White Noise and Battery Guru for BB10 and for PlayBook | Get more from your battery!
Developer
Hithredin
Posts: 404
Registered: ‎06-03-2010
My Device: Z10 Red

Re: Change text size for a checkbox

True, I've forgotten this feature, and I will implement it

Developer
peter9477
Posts: 6,473
Registered: ‎12-08-2010
My Device: PlayBook, Z10

Re: Change text size for a checkbox

Hithredin, another improvement you could probably make is to add an alias property to the outer container: "property alias checked: id_of_checkbox.checked"

That should also let you eliminate your custom signal name, depending on how you're using this, since there should then be a checkedChanged signal emitted for the alias as well (if they work that way... I don't recall having used a changed signal on an alias property yet, but I imagine it should work fine).

Peter Hansen -- (BB10 and dev-related blog posts at http://peterhansen.ca.)
Author of White Noise and Battery Guru for BB10 and for PlayBook | Get more from your battery!