B4A Class ButtonBar

I am not sure if b4a has a buttonBar or not but I made this one. I have found using radiobuttons a bit of a chore and they tend to use a bit of screen real estate along with the handlers required. This custom control consists of as many buttons as you need for making a unique selection. There is also a "clr" button to reset all the buttons to enabled state. The selected button changes color and shrinks to indicate selection. The text of the buttons resizes as required. I struggled a little how to set the number of buttons so I used the tag value of the custom view when added to the designer to hold the number of buttons (the more buttons you have might restrict the amount of space you have for text...see demo). I have added properties to change the border color (you can also make the border transparent) and the button state colors for enabled, pressed, disabled. You can also set text of buttons, text color which can be different for each button or same for all using 99 in the call. Also a setEvent for the click event. I have demo'd some of them in the example. This control can be used for selecting options or performing actual tasks. I have commented quite a lot, and the demo is also commented. This custom view requires Rsize and rndButton classses which I did a while ago they are in the demo.Forgot to say
classes and demo in link

https://www.dropbox.com/s/xz6fumuwbdj3y8g/buttonBarv1.1.zip?dl=0





 

Attachments

  • buttonBarDemo.png
    buttonBarDemo.png
    45 KB · Views: 444
Last edited:

tremara1

Active Member
Licensed User
Longtime User
I have updated with a version with no clear button. Also it now sets the textsize of buttons to the smallest size so all text are all the same size.
I have updated the link above.....
 

mshafiee110

Active Member
Licensed User
Longtime User
hi @tremara1 can you upload again this class.
because the file has been moved or deleted.
 
Top