Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

Multiple buttons with same width equal to widest button

Tags:

blackberry

I have multiple ButtonFields in a VerticalFieldManager. By default the width of each button depends on the text it contains.

I would like all the buttons to be of the same width - equal to the width of the widest button.

like image 691
CITBL Avatar asked Sep 01 '26 12:09

CITBL


2 Answers

Take a look at the BlackBerry Developers Knowledge Base:
How to - Implement advanced buttons, fields, and managers
Last Updated: 12 February 2010
Article Number: DB-00796

You are probably looking for the VerticalButtonFieldSet!

like image 113
endevour Avatar answered Sep 05 '26 16:09

endevour


Step 1 - Extend the VerticalFieldManager class, and make the constructor take in a bunch of Strings that you want to put end each button.

Step 2 - Find the longest of String out of the Strings passed into the manager.

Step 3 - create the button for the longest string

Step 4 - create all other buttons, and set their width to the same as the 1st (see setExtent)

Step 5 - add the buttons to the manager in the order you want them to appear

FIN

like image 20
gburgoon Avatar answered Sep 05 '26 17:09

gburgoon



Donate For Us

If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!