Android Question Layout Panel with Button Array

Guardian17

Active Member
Licensed User
Longtime User
I have an App that I need to generate my own QWERTY keyboard (because the keyboard button colors change during the course of the App). Each button will be a StateListDrawable to have a pressed and unpressed (enabled) image. I can keep track of which button has been pressed (using "b = sender") by assigning a value to the Tag property and getting "b.tag".

I have two questions:

1) In the Layout Designer Script, is there a way to access each button of this KeyboardPanel to programmatically set each button's left, top, width, and height properties (without specifying Button1.Left, Button1.Top, Button1.Width, Button 1.Height, Button2.Left, Button 2.Top, ...... Button26.Width, Button26.Height)?

2) Once the layout for this 26-button keyboard has been loaded into KeyboardPanel (there will be other buttons, but I'll stick to just the letters for now), if I then need to change the properties of a particular button, how can I reference any particular button if I have a reference value from 1 to 26? Can a layout have a Button Array using subscripts?
 

Guardian17

Active Member
Licensed User
Longtime User
Erel:

Thanks for your responses. I was afraid that I'd only be able to do it in code.

I was already handling the keyboard in code, and I have shied away from using Layouts because of the many-buttons-on-the-screen issue for which I have many loops to perform the positioning of the buttons and other elements. Since I am still having issues with the Pause/Resume aspect of restoring the game to its former state on Resume, I thought maybe going back to Layouts would help.

:rolleyes: A tip to those newer programmers using B4A -- plan the Pause/Resume aspect of the Android Activity cycle from the start. Don't wait until you've finalized the operation of your app before tackling the Pause/Resume issue, which can be quite exasperating!! :eek:
 
Upvote 0
Top