B4J Question how to handle Forms in XUI ?

MarkusR

Well-Known Member
Licensed User
Longtime User
hello, i using classes for shared code at b4j and b4a.
i like to have the classes independent that they can open/close his form self.
currently i open the form outside and give it to the class (same as tutorial),
but that did not make me happy because i need call a sub to close the form from outside.
i have nested classes, i can not use "as Form" in parent class.
you have best practice for me?
should i make a form/activity list in main class?
 

Cableguy

Expert
Licensed User
Longtime User
in you class initialize, return the created form to the main, if needed, everything else can be done within the class
 
Upvote 0

Erel

B4X founder
Staff member
Licensed User
Longtime User
Forms and activities are not exactly the same. Forms are more flexible and easy to work with.

i have nested classes, i can not use "as Form" in parent class.
You have two options:
1. Return Object and cast it to Form in the B4J module.
2. Use conditional compilation:
B4X:
#if B4J
Public Sub DoesSomething As Form
#else if B4A
'?????????
Public Sub DoesSomething As Panel
#end If
 
Upvote 0
Top