B4J Question [SOLVED] B4J B4XPAGES remove titlebar in all forms

Gnappo jr

Active Member
Licensed User
Longtime User
In this example, threepagesexample three forms are shown
I would like to omit the titlebar in all of them but I can only do it on the main one by inserting the command in the MAIN module:
MainForm.SetFormStyle("TRANSPARENT") ' <====inserted
How can I do to obtain the same result in others?

Main modificato:
Sub AppStart (Form1 As Form, Args() As String)
    MainForm = Form1
    MainForm.SetFormStyle("TRANSPARENT") ' <====inserted
    MainForm.Show
    Dim PagesManager As B4XPagesManager
    PagesManager.Initialize(MainForm)
End Sub
 

Gnappo jr

Active Member
Licensed User
Longtime User
That's for B4A

For B4J I think this is currently impossible; you should get the new forms before they are displayed. I think it will be necessary for Erel to modify the B4XPages library.
mannaggia, aoh, nun se riesce a arrivĆ  a dama!šŸ˜œ
 
Upvote 0

mcqueccu

Well-Known Member
Licensed User
Longtime User
You can always access the native methods. Put this code in all the modules


B4X:
Private Sub B4XPage_Created (Root1 As B4XView)
    B4XPages.GetNativeParent(Me).SetFormStyle("TRANSPARENT") <--- insert
    Root = Root1
 
Upvote 1

LucaMs

Expert
Licensed User
Longtime User
You can always access the native methods
I know, and I tried that way, the project crashed. The error message was:

java.lang.IllegalStateException: Cannot set style once stage has been set visible

This is because for the first form, that of the B4XMainPage, you have to write it in the Main form:
B4X:
Sub AppStart (Form1 As Form, Args() As String)
    MainForm = Form1
    MainForm.SetFormStyle("TRANSPARENT")
    MainForm.Show
If instead you write the following code in the B4XMainPage, the project crashes:
B4X:
Private Sub B4XPage_Created (Root1 As B4XView)
    B4XPages.GetNativeParent(Me).SetFormStyle("TRANSPARENT")
    Root = Root1
 
Upvote 0

peacemaker

Expert
Licensed User
Longtime User
It seems, this feature is not cross-platformed.

I use
B4X:
Private Sub B4XPage_Created (Root1 As B4XView)
    B4XPages.GetNativeParent(Me).SetFormStyle("UTILITY")
in second and next pages after MainPage, but only in B4J and using the conditional compilation, and it's not needed in B4A for each Activity as a B4XPage.
 
Upvote 0

mcqueccu

Well-Known Member
Licensed User
Longtime User
I know, and I tried that way, the project crashed. The error message was:

java.lang.IllegalStateException: Cannot set style once stage has been set visible

This is because for the first form, that of the B4XMainPage, you have to write it in the Main form:
B4X:
Sub AppStart (Form1 As Form, Args() As String)
    MainForm = Form1
    MainForm.SetFormStyle("TRANSPARENT")
    MainForm.Show
If instead you write the following code in the B4XMainPage, the project crashes:
B4X:
Private Sub B4XPage_Created (Root1 As B4XView)
    B4XPages.GetNativeParent(Me).SetFormStyle("TRANSPARENT")
    Root = Root1
Put it as first thing in B4Xpage_created
if you put it after root = root1 it will crash.

Edit:
Dont put it on Mainpage. Mainpage is affected by what is set in Main


B4X:
Sub AppStart (Form1 As Form, Args() As String)
    MainForm = Form1
    MainForm.SetFormStyle("TRANSPARENT") ' <====inserted
    MainForm.Show
    Dim PagesManager As B4XPagesManager
    PagesManager.Initialize(MainForm)
End Sub
 
Upvote 0

LucaMs

Expert
Licensed User
Longtime User
It seems, this feature is not cross-platformed.

I use
B4X:
Private Sub B4XPage_Created (Root1 As B4XView)
    B4XPages.GetNativeParent(Me).SetFormStyle("UTILITY")
in second and next pages after MainPage, but only in B4J and using the conditional compilation, and it's not needed in B4A for each Activity as a B4XPage.
Yes, because only in B4J do you have multiple forms, with B4A and B4i you have a single "activity".
 
Upvote 0

peacemaker

Expert
Licensed User
Longtime User
So:

B4J:
Sub AppStart (Form1 As Form, Args() As String)
    MainForm = Form1
    MainForm.SetFormStyle("TRANSPARENT") ' <====inserted
    MainForm.Show
    Dim PagesManager As B4XPagesManager
    PagesManager.Initialize(MainForm)
End Sub

B4A:
#Region  Activity Attributes
    #FullScreen: True
    #IncludeTitle: False
#End Region
 
Upvote 0

peacemaker

Expert
Licensed User
Longtime User
Old 3 pages example
Each page excepting B4XMainPage:
'This event will be called once, before the page becomes visible.
Private Sub B4XPage_Created (Root1 As B4XView)
    #if B4J
    B4XPages.GetNativeParent(Me).SetFormStyle("TRANSPARENT")
    #end if

B4A:
#Region  Activity Attributes
    #FullScreen: True
    #IncludeTitle: False
#End Region

And i have no idea about B4i.
 
Upvote 0

LucaMs

Expert
Licensed User
Longtime User
I think the basic concept is also wrong.
In Android-BAA, a B4XPages type project should have only one Activity, on which to "browse the pages". I think, I assume the same is for iOS-B4i. The same thing should be for Desktop-B4J, you should have only one Form but that's not the case. If I want to have more forms, I might as well create a normal B4J project.
 
Upvote 0

peacemaker

Expert
Licensed User
Longtime User
It's impossible to make up 3 different things looking the same ideally, trying to preserve each to be fully-functional.
IMHO the result with 80% of cross-platformity is anyway super.
 
Upvote 0

LucaMs

Expert
Licensed User
Longtime User
It's impossible to make up 3 different things looking the same ideally, trying to preserve each to be fully-functional.
IMHO the result with 80% of cross-platformity is anyway super.
Of course, I'm not criticizing because I think the work done by Erel is excellent.
I am referring to the B4XPages project "concept". Even in B4J it should be composed of a single Form. I think I read a question about this topic some time ago, and that it is therefore possible (and should be by default). I look for...
 
Upvote 0
Top