Android Question B4XPages Root Confusion

mmieher

Active Member
Licensed User
Longtime User
I don't understand why I sometimes have to reference Root in the B4XMainPage.

B4XMainPage:
B4X:
Public B4XSillyMod As B4XSilly
...
Private Sub B4XPage_Created (Root1 As B4XView)
Root = Root1
Root.LoadLayout("BootPage")
...
B4XSillyMod.Initialize
B4XPages.AddPageandCreate("SillyShit", B4XSillyMod)
...
Case "whatishere"
       B4XPages.ShowPage("SillyShit")
       B4XSillyMod.WhatIsHere

Parts of B4XSilly Page:
B4X:
    WhatsThis.Initialize("")
    WhatsThis.SetLayoutAnimated(0, 0,0, 100%x, 100%y)
    WhatsThis.LoadLayout("WhatIsThis")
    
    Root.AddView(WhatsThis,0,0,100%x,100%y)              ' only virgin CenterPanel
    'B4M.Root.AddView(WhatsThis,0,0,100%x,100%y)     ' works but cannot be right
    
'    WhatsThis.BringToFront  ' nope
'    Root.BringToFront ' nope
 

Rubsanpe

Active Member
Licensed User
Hi.

Root is the view where the B4XPage window is created in the Activity that groups them all together. When you create the B4XPage the system generates the containing view and passes it to the B4XPage so that its own views are created in it. The B4XPage is still a class, and when you use the

B4X:
Root = Root1

Root.LoadLayout("BootPage")


you are assigning to Root the view created by the system.

Rubén
 
Upvote 0

mmieher

Active Member
Licensed User
Longtime User
So B4XMainPage.Root.AddView is the correct way to do it?
Do not do the BootPage thing? It is just a loading indicator.
In general, stay away from Root1 in non-main pages?

Just because I call a sub in another B4XPage does not mean I ever left B4XMainPage? I must sound like such a beginner. 2012. $99. B4A.
 
Last edited:
Upvote 0

Alexander Stolte

Expert
Licensed User
Longtime User
So B4XMainPage.Root.AddView is the correct way to do it?
Yes.
In general, stay away from Root1 in non-main pages?
Each B4XPage has its own "root" panel.
Just because I call a sub in another B4XPage does not mean I ever left B4XMainPage?
You only leave the main page when you display a new B4XPage, but even then the main page is still in the background. The advantage of B4XPages is that you can do something on a page without having opened it before.
 
Upvote 0

mmieher

Active Member
Licensed User
Longtime User
Yes.

Each B4XPage has its own "root" panel.

You only leave the main page when you display a new B4XPage, but even then the main page is still in the background. The advantage of B4XPages is that you can do something on a page without having opened it before.
"display a new page"? .AddPage? .AddPageAndCreate? I am thinking .ShowPage? Is the non-main Root good for anything? I guess if the non-main only does one specific thing?
 
Upvote 0

Alexander Stolte

Expert
Licensed User
Longtime User
You should take a close look at this thread and also the video, after that your B4XPages understanding will be better.
 
Upvote 0

mmieher

Active Member
Licensed User
Longtime User
You should take a close look at this thread and also the video, after that your B4XPages understanding will be better.
I will again. Videos confuse me because PAUSE messes up what I am trying to look at.

[new error message: You must wait 4 seconds ...]
 
Upvote 0

davemorris

Active Member
Licensed User
Longtime User
Hi, Guys

Slightly off post - but I find viewing the Erel's Videos works great for me - no problem with pause (I am always pausing to take in the information).

Is anyone else having this problem (My browser is Chrome)?

Dave Morris
 
Upvote 0

mmieher

Active Member
Licensed User
Longtime User
Hi, Guys

Slightly off post - but I find viewing the Erel's Videos works great for me - no problem with pause (I am always pausing to take in the information).

Is anyone else having this problem (My browser is Chrome)?

Dave Morris
It must be my f Windows setup. Just started over last August with new computer. I still think I have a video issue. Many annoying things. Two large screens plus casting to WebOS giant TV.

Most annoying in B4A, the "..." things for label text, etc. often open that edit window in an invisible place. Must hit ESC to retake control. This is new.
 
Upvote 0

davemorris

Active Member
Licensed User
Longtime User
Hi, mmieher - sorry about your problems - but it does sound a nice setup.

I use a dual screen setup and the only slight problem is the IDE main screen overlaps very slightly into the second screen (only a 1mm or 2) when you expand it by double clicking on the caption bar (or clicking the icon) to fill the screen. However, after a time the overlap vanishes. I did post it on the forum and it appears I am the only one with the problem (I just blame my video card - must try another one).

With regards to your "..." problem, Just tired it on my system - It always appears on the number 2 screen. In the past, when using applications which remember where you put the windows, I found switching from dual monitors to a single monitor caused problems with the windows appearing to vanish. The fix was to attach both monitors and move the the window back onto the main screen then close the program down.

Many years ago we developed software under windows which was designed to use to monitors, one for input information and the other for displaying information to customers. It was running under Windows XP and written in Visual Basic VB6 - message boxes were the real pain, the user entered incorrect information their screen and warning msgbox was viewed by the customers on the other screen. It was fixed but the software had to do something with the OS. Not sure if this problem still exists as we now use C# and the OS is Windows 10 but no dual monitor requirements.

Someone is going to kill me - this is really off post!

Regards
Dave
 
Upvote 0

mmieher

Active Member
Licensed User
Longtime User
Hi, mmieher - sorry about your problems - but it does sound a nice setup.

I use a dual screen setup and the only slight problem is the IDE main screen overlaps very slightly into the second screen (only a 1mm or 2) when you expand it by double clicking on the caption bar (or clicking the icon) to fill the screen. However, after a time the overlap vanishes. I did post it on the forum and it appears I am the only one with the problem (I just blame my video card - must try another one).

With regards to your "..." problem, Just tired it on my system - It always appears on the number 2 screen. In the past, when using applications which remember where you put the windows, I found switching from dual monitors to a single monitor caused problems with the windows appearing to vanish. The fix was to attach both monitors and move the the window back onto the main screen then close the program down.

Many years ago we developed software under windows which was designed to use to monitors, one for input information and the other for displaying information to customers. It was running under Windows XP and written in Visual Basic VB6 - message boxes were the real pain, the user entered incorrect information their screen and warning msgbox was viewed by the customers on the other screen. It was fixed but the software had to do something with the OS. Not sure if this problem still exists as we now use C# and the OS is Windows 10 but no dual monitor requirements.

Someone is going to kill me - this is really off post!

Regards
Dave
"The fix was to attach both monitors" Physically? This happens to me even when not casting to TV (I think not casting?).

Me VB6 guy. Randomly met Bill Gates in a hallway at a theater (1988?). He was giving a talk about this new "coming soon" thing called Windows 95. I have his autograph on my original VB6 installation disk (5.25") somewhere. Took the diskette just in case.

[must have been Windows 98 maybe]
 
Last edited:
Upvote 0

Alexander Stolte

Expert
Licensed User
Longtime User
Off topic, yes, but I thought I'd mention that I have the same problem with Visual Studio and haven't experienced it with B4A so I don't think it's B4A-specific.
I don't have the problem in VS, but I have it in B4A,B4I and B4J.
 
Upvote 0

mmieher

Active Member
Licensed User
Longtime User
You should take a close look at this thread and also the video, after that your B4XPages understanding will be better.

Thank you, Alexander. This was the BEST ADVICE ever for me.
Along with another video, as well as reading the entire closed threads, this has made a huge difference in my understanding of what the heck is going on.
 
Last edited:
Upvote 0
Top