Android Question B4X Pages

MList

Member
Licensed User
Hi,
I want to have the same Buttons and Labels on different B4XPages...
Lets say Button1, Button2, Button3 on every Page.
I would like to generate them in pgm, i would like to declare them just once and have the Events like Button1_clicked just once...
How can I do that ??
Or do I really have to declare them on every page... thats lots of same code..

I am not accustomed programming with classes...
(with B4i is was possible to declare labes as process globals..)

Thanks a lot for your help
Marion
 

Erel

B4X founder
Staff member
Licensed User
Longtime User
Never duplicate code.

You have two options:
1. Implement the buttons layout + code in a class and create a class instance in each of the pages. This is probably the best solution.
2. Implement it wherever you want and move the buttons panel to the current page when the page appears.
 
Upvote 0

pliroforikos

Active Member
Licensed User
Never duplicate code.

You have two options:
1. Implement the buttons layout + code in a class and create a class instance in each of the pages. This is probably the best solution.

Is there any example with this implementation? If i have, for example, buttons to insert, edit, delete records in different tables how can i make this class?
 
Upvote 0
Top