XtraViews

Periklis Koutsogiannis

Active Member
Licensed User
Longtime User
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.
 

Periklis Koutsogiannis

Active Member
Licensed User
Longtime User
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 :D
 

MaFu

Well-Known Member
Licensed User
Longtime User
Yes but the dialog width and height cannot be altered after the layout is loaded.
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.
 

Periklis Koutsogiannis

Active Member
Licensed User
Longtime User
The dialog width does not resize. It stays fixed and s set to you panel width in you layout file on all orientations
 

MaFu

Well-Known Member
Licensed User
Longtime User
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 :D
This solution would be ok imho. But does it work if i rotate while the dialog is active?
 

Periklis Koutsogiannis

Active Member
Licensed User
Longtime User
Yes, that is the task ... to automatically detect screen orientation changes and load the appropriate layout. It is a little bit tricky though :)
 

MaFu

Well-Known Member
Licensed User
Longtime User
Yes, that is the task ... to automatically detect screen orientation changes and load the appropriate layout. It is a little bit tricky though :)

But what's about the changes i have made in Dialog_Show (e.g. filling a listview)?
 

Periklis Koutsogiannis

Active Member
Licensed User
Longtime User
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.
 

MaFu

Well-Known Member
Licensed User
Longtime User
The dialog width does not resize. It stays fixed and s set to you panel width in you layout file on all orientations
But the dialog resizes on rotation. Sure only if the dialog size exceeds the screen size.
 

Periklis Koutsogiannis

Active Member
Licensed User
Longtime User
The width does not resize. I am talking about the DialogView. It sets a fixed width which is based on your layout panel.
 

MaFu

Well-Known Member
Licensed User
Longtime User

MaFu

Well-Known Member
Licensed User
Longtime User
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.

I can stay with it. If i have a dynamic layout (e.g. change label value on listview click) i must save the state on click somewhere and respect the settings on Dialog_show.
 

MaFu

Well-Known Member
Licensed User
Longtime User
Lol. Yes it does, but since the width does not we have a problem :)
Eventually it will be useful if Dialog_Show() have an additional parameter which signals the first call (like FirstTime on Activity_Create).
 

Thraka

Member
Licensed User
Longtime User
I'm having an issue with the dialog. I cannot get it to show properly. I don't see what is in the designer, being shown. The button is missing and no items are in the listbox.

B4X:
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
 

Attachments

  • setupweather.bal
    2.3 KB · Views: 144

Periklis Koutsogiannis

Active Member
Licensed User
Longtime User
In order to use the ShowDefault method, you must have one label for the title and one label for the content and add the TITLE1 and POS1 strings to the tags of the labels in your layout that you want to have as a title and content respectively.

If you want to use the SYSTEM title and buttons just use the Show, ShowOk, ShowYesNo or ShowYesNoCancel methods:
B4X:
Dialog.LoadLayout("setupweather").Show("Title", "yes", "no","cancel", null)

Check the Dialog1 and Dialog2 layouts in sample3
 
Last edited:

Thraka

Member
Licensed User
Longtime User
screenshot_20.png
 

Periklis Koutsogiannis

Active Member
Licensed User
Longtime User
What version on B4A are you using? Download the latest 1.3 version and try with that if it still does not work.

Attached is a sample and apk based on your code and layout. It works fine.

upload_2014-7-16_23-7-1.png
 

Attachments

  • sample.apk
    114.9 KB · Views: 167
  • sample.zip
    9.2 KB · Views: 169
Last edited:

Thraka

Member
Licensed User
Longtime User
That didn't work :(

b4a 3.82 the device I'm using is an emulated device. Here are the settings

screenshot_21.png
 
Top