The best solution in my opinion (at least for now) is to incorporate the ability to be able to load a layout for each orientation if needed.
Dialog.LoadLayoutMultiple("layout1", "layout1_landscape").ShowDefault("", "")
Dialog.LoadLayout("layout1").ShowDefault("","")
I don't understand. I would not change the dialog width or height. If i rotate my device, the dialog resizes itself if the dialog height/width exceeds the new screen heigth/width.Yes but the dialog width and height cannot be altered after the layout is loaded.
This solution would be ok imho. But does it work if i rotate while the dialog is active?For example:
B4X:Dialog.LoadLayoutMultiple("layout1", "layout1_landscape").ShowDefault("", "")
If there is no need for multiple layouts, the default call will be still valid
B4X:Dialog.LoadLayout("layout1").ShowDefault("","")
Design more code less
Yes, that is the task ... to automatically detect screen orientation changes and load the appropriate layout. It is a little bit tricky though
But the dialog resizes on rotation. Sure only if the dialog size exceeds the screen size.The dialog width does not resize. It stays fixed and s set to you panel width in you layout file on all orientations
OK, you're right. But the height changesThe width does not resize. I am talking about the DialogView. It sets a fixed width based on you layout panel.
The events will be re-raised since the layout will be loaded. And since you will have the same controls, it should work just fine.
Eventually it will be useful if Dialog_Show() have an additional parameter which signals the first call (like FirstTime on Activity_Create).Lol. Yes it does, but since the width does not we have a problem
Dim dialog As DialogView
dialog.LoadLayout("setupweather").ShowOk("TITLE1", "POS1")
Sub setupweather_Show()
LocationsListView.SingleLineLayout.Label.TextColor = Colors.Black
LocationsListView.AddSingleLine("Duvall, Wa 98019")
End Sub
Dialog.LoadLayout("setupweather").Show("Title", "yes", "no","cancel", null)