B4J Question B4XDialog on B4XPage, Size Limit

mw71

Active Member
Licensed User
Longtime User
hi

I have a B4XPages project (in B4J). The creation/display of the pages etc. works.
Now I have a page that is normally 600dpi x 600dpi.
But when a certain selection is made, this page has to be changed to 800 x 1470.
This works fine with the following lines of code

B4X:
If form.WindowHeight <800 Then form.WindowHeight = 800
If form.WindowWidth <1470 Then form.WindowWidth = 1470

The problem is that the following B4XView/dialog is still limited to the old limits (600x600).
After the two lines above, the view is called as follows: :

B4X:
Dim cld As B4XDialog
cld.Initialize(Root)

Dim p As B4XView = xui.CreatePanel(“”)
p.SetLayoutAnimated(0, 0, 0, 1440dip, 740dip)
p.LoadLayout(“ContestData_EDI_Extend”)
p.Color=xui.Color_LightGray

Dim rs As ResumableSub = cld.ShowCustom(p, Main.loc.Localize(“txt_start”), “”, “Cancel”)
Wait For (rs) Complete (ret As Int)

How can I solve it so that the new limits also apply to this B4X dialog?
 

mw71

Active Member
Licensed User
Longtime User
thanks for your quick reply Erel & sri for my late one (just having a bit of trouble with one of the computers here)

To give a correct answer I have written the code as follows:
B4X:
Log($“pre Root: ${Root.Height}h, ${Root.Width}”$)
   
If form.WindowHeight <700 Then form.WindowHeight = 700
If form.WindowWidth <930 Then form.WindowWidth = 930   
Sleep(0)
   
Log($“post Root: ${Root.Height}h, ${Root.Width}”$)

Most of the time this works well (then root is big enough), but sometimes not (then root is too small). If I look at the log, the reason?? is that B4XPage_Resize is called after the B4X dialog has been called.
Is there a possibility to wait until the resize is done and only then execute the code?
 
Upvote 0
Top