Explaining "Private Root As B4XView"

pliroforikos

Active Member
Licensed User
When we are creating a B4XPage a Root Object declared as B4XView and later in B4XPage_Created it says Root = Root1 and Root1 is also B4XView
Can someone explain what Root or Root1 do and why we declare Root and then we say Root = Root1?

B4X:
Sub Class_Globals
    Private Root As B4XView
    Private xui As XUI
End Sub

Public Sub Initialize
End Sub

Private Sub B4XPage_Created (Root1 As B4XView)
    Root = Root1
    Root.LoadLayout("MainPage")
End Sub
 

Erel

B4X founder
Staff member
Licensed User
Longtime User
1. B4XView is the default type for most views, especially when building cross platform solutions.
2. Root is the page's root panel. It needs to be created somewhere. It is created and managed by B4XPagesManager and passed to the page in the Created event.
3. Root = Root1 -> just a simple assignment of the root panel that was injected from B4XPagesManager.
 

pliroforikos

Active Member
Licensed User
So B4XView is a type not a class?
B4XPagesManager is something we can't see just runs in background for as?
When we say Root.LoadLayout("page2") we load the page2.bjl file from Files folder?
 

Erel

B4X founder
Staff member
Licensed User
Longtime User
B4XView is a type (=class) from XUI library. Read more here: https://www.b4x.com/android/forum/threads/b4x-xui-cross-platform-native-ui-library.84359/#content
B4XPagesManager is a class from B4XPages.
B4XPages is a b4xlib = a library written in B4X.
hen we say Root.LoadLayout("page2") we load the page2.bjl file from Files folder?
Yes. The extension is less important and depends on the platform.

[B4X] B4XPages - Cross platform and simple framework for managing multiple pages
 

pliroforikos

Active Member
Licensed User
This is what I want: "say" something and my sw writes the source code :)
I will develop an app to get it (Android, because windows in italian would not work)
?
It's an expression in Greek and i translated in English. It's called GreekEnglish Language
:p
 
Top