I want my form to resizable but withing limits... lets say from 600 to screen Width....
I know I can just check the screen width in the resize event, but that wont stop neither the flickering not the screen resizing event from retriggering...
Anyway to avoid this?
EDIT:
There is a "setWindowSizeLimits" method available!!!
my Solution:
Dim ps As Screen = fx.PrimaryScreen
MainForm.SetWindowSizeLimits(600,600, ps.MaxX,ps.MaxY)
With B4XPages you can get the MainPage to resize like this:
B4X:
Public Sub Initialize
B4XPages.GetManager.LogEvents = True
End Sub
Private Sub B4XPage_Created (Root1 As B4XView)
Root = Root1
Root.LoadLayout("MainPage")
Dim ps As Screen = fx.PrimaryScreen
Log(ps.MaxX & " " & ps.MaxY)
B4XPages.GetNativeParent(B4XPages.MainPage).SetWindowSizeLimits(600,600, ps.MaxX,ps.MaxY)
End Sub
Private Sub B4XPage_Resize (Width As Int, Height As Int)
Log(Width & " " & Height)
End Sub
Dim Form As Form = B4XPages.GetNativeParent(Me)
Dim Stage As JavaObject = Form.As(JavaObject).GetFieldJO("stage")
Stage.RunMethod("setMinWidth",Array(600.0))
Stage.RunMethod("setMinHeight",Array(600.0))
Dim PS As Screen = fx.PrimaryScreen
Stage.RunMethod("setMaxWidth",Array(PS.MaxX))
Stage.RunMethod("setMaxHeight",Array(PS.MaxY))