Designer issue

bishmedia

Member
Licensed User
Longtime User
Ive got a template that im building in designer as per attached image and have added some designer script as below...

B4X:
'All variants script
AutoScaleAll

pnlLower.Bottom = 100%y
pnlLower.SetTopAndBottom(WebView1.Bottom, 100%y)
pnlLower.Width = 100%x

WebView1.Width = 100%x
WebView1.SetTopAndBottom(0%x, pnlLower.Top)

'buttons
b = 33%x
pad = 4dip
btnDown1.SetLeftAndRight(0, b)
btnDown1.SetTopAndBottom(pad, pnlLower.Height - pad)
btnDown2.SetLeftAndRight(b, 2 * b)
btnDown2.SetTopAndBottom(pad, pnlLower.Height - pad)
btnDown3.SetLeftAndRight(2 * b, 3 * b)
btnDown3.SetTopAndBottom(pad, pnlLower.Height - pad)

When i change to a larger viewer like Nexus 7 the webviews and buttons both accommodate half the screen each.

Can anyone tell me what wrong with the above script??
 

Attachments

  • designer.jpg
    14.9 KB · Views: 195
  • designer2.jpg
    9.5 KB · Views: 417

barx

Well-Known Member
Licensed User
Longtime User
Find my thoughts on the problem below. Hope this helps.

B4X:
pnlLower.Bottom = 100%y 'Not required as you set the bottom in next line.
pnlLower.SetTopAndBottom(WebView1.Bottom, 100%y) 'I believe this is the problem line as it uses webview1.bottom which hasn't been set in the script, just the designer. You need to refine the webview1.bottom property.
pnlLower.Width = 100%x

WebView1.Width = 100%x
WebView1.SetTopAndBottom(0%x, pnlLower.Top)'2 things wrong here but neither cause your issue. 1) you use x axis to set a y plane 2) you dont need to 0%, just put 0
 
Upvote 0

bishmedia

Member
Licensed User
Longtime User
I cannot figure for the life of me how to set the webview1.bottom :-(

B4X:
pnlLower.SetTopAndBottom(WebView1.Bottom, 100%y)
pnlLower.Width = 100%x

WebView1.Width = 100%x
WebView1.SetTopAndBottom(0, pnlLower.Top)
 
Upvote 0

barx

Well-Known Member
Licensed User
Longtime User
I guess in this instance you don't set it directly, you set the top and the height.

I need to decide which of the 2 sections is set first. If the button at the bottom are a fixed size then set them and then set the webviews properties from there.

A little hard to describe
 
Upvote 0

bishmedia

Member
Licensed User
Longtime User
I think that the webview1 should always be 80% height and pnlLower should always be 20% height ??
Does this help??
 
Upvote 0

barx

Well-Known Member
Licensed User
Longtime User
I think that the webview1 should always be 80% height and pnlLower should always be 20% height ??
Does this help??

Well if that is the case, then change this line


B4X:
WebView1.SetTopAndBottom(0, pnlLower.Top)

to

B4X:
WebView1.SetTopAndBottom(0, 80%y)

and move it to above this line

B4X:
pnlLower.SetTopAndBottom(WebView1.Bottom, 100%y)
 
Upvote 0
Cookies are required to use this site. You must accept them to continue using the site. Learn more…