B4J Question {SOLVED} [B4XPages] how to resize layout

giannimaione

Well-Known Member
Licensed User
Longtime User
B4XPages 1.05: how to resize layout Width and Height ?

in Main:
B4X:
#Region Project Attributes
    #MainFormWidth: 600
    #MainFormHeight: 600
#End Region
'
#Region Delegates
Sub MainForm_Resize (Width As Double, Height As Double)
    B4XPages.Delegate.MainForm_Resize(Width, Height)
'what is ?
End Sub

in B4XMainPage:
B4X:
Private Sub B4XPage_Created (Root1 As B4XView)
    Root = Root1
    'load the layout to Root
    Root.LoadLayout("demoLayout")
End Sub
'
Sub B4XPage_Appear
'what is?
End Sub
'
Sub B4XPage_Resize (Width As Int, Height As Int)
'what is?
End Sub

with JFX (NOT B4XPAGES) i can resize easy:
B4X:
dim f as Form
f.Initialize("", fx.PrimaryScreen.MaxX-50dip, fx.PrimaryScreen.MaxY-50dip)
f.RootPane.LoadLayout("demo")
 

giannimaione

Well-Known Member
Licensed User
Longtime User
[Solved]
in Main:
B4X:
Sub AppStart (Form1 As Form, Args() As String)
    MainForm = Form1
    MainForm.WindowWidth= 150dip 
    MainForm.WindowHeight= 250dip
    MainForm.Show
    Dim PagesManager As B4XPagesManager
    PagesManager.Initialize(MainForm)
End Sub
 
Upvote 0

giannimaione

Well-Known Member
Licensed User
Longtime User
code for maxim pages

B4X:
Private Sub B4XPage_Created (Root1 As B4XView)
Root = Root1
'load the layout to Root
Root.LoadLayout("your layout")
#if B4J
Dim form As Form = B4XPages.GetNativeParent(Me)
Dim joForm As JavaObject = form
Dim joStage As JavaObject = joForm.GetField("stage")
joStage.RunMethod("setMaximized",Array(True))
#if
End Sub
 
Upvote 0

LucaMs

Expert
Licensed User
Longtime User
The problem has not actually been solved.

That way you can resize the form (and, if you wanted, also the views and their positions) but only at startup.

What is the way to handle the resize event when the user changes the size of the form at runtime, with B4XPages?
 
Upvote 0

Magma

Expert
Licensed User
Longtime User
The problem has not actually been solved.

That way you can resize the form (and, if you wanted, also the views and their positions) but only at startup.

What is the way to handle the resize event when the user changes the size of the form at runtime, with B4XPages?
You mean... make "app" (or b4xpages) not leave the user resize the form ? or what ?
 
Upvote 0

LucaMs

Expert
Licensed User
Longtime User
You mean... make "app" (or b4xpages) not leave the user resize the form ? or what ?
B4J-B4XPages project. I mean that the solution that Ugo found was sufficient for him, as he only wanted to change the size of the form (Main) at every start of the application, while the title of the thread, and the problem, is to trigger the Resize event written in the B4XPage every time the user resizes the form.
 
Upvote 0

Cableguy

Expert
Licensed User
Longtime User
while the title of the thread, and the problem, is to trigger the Resize event written in the B4XPage every time the user resizes the form.
If the form is either UTILITY or DECORATED, the user will be able to resize the form to his liking AND the resize event WILL be fired.
 
Upvote 0

LucaMs

Expert
Licensed User
Longtime User
Sorry, I asked a really stupid question.
The event is delegated in the Main form and is sufficient...

1.gif
 
Upvote 0
Top