Not sure if its me misunderstanding the usage of LoadLayout, but here comes the explanation of the problem I have.
I have a project that has basically one main screen, into that I load various layouts depending on user interaction. As some screens need more space than others, I dynamically change the main screen size, and restore it when I leave the screen.
I have a routine which handles the saving and restore of the screen size title etc.
In Main class file I use
and all works as expected.
In the WindowHandler class I use this:
The height width title all get set correctly.
Sorry for long post - been trying for ages to discover why one works and one causes exception.
I have a project that has basically one main screen, into that I load various layouts depending on user interaction. As some screens need more space than others, I dynamically change the main screen size, and restore it when I leave the screen.
I have a routine which handles the saving and restore of the screen size title etc.
In Main class file I use
B4X:
Public Sub Initialize
m = Main.MainForm
WindowHandler.saveWindow(m)
WindowHandler.newWindowLayout(m,350,400,"Log In2","loginScreen")
Dim fred As String = "loginScreen"
m.RootPane.LoadLayout(fred)
m.Show
End Sub
In the WindowHandler class I use this:
B4X:
Public Sub newWindowLayout(m As Form,h As Double,w As Double,t As String,lout As String)
Log("new window")
m.RootPane.RemoveAllNodes
m.WindowHeight = h
m.WindowWidth = w
m.Title = t
'm.RootPane.LoadLayout(lout) ' <<<<<< this wont work, produces exception
End Sub
Sorry for long post - been trying for ages to discover why one works and one causes exception.