Hi all,
I'm really fond of the Designer Script mode and read most of the previous posts about it, but I'm still a bit puzzled; so please help me clarify a few concepts and correct my naive script attempt in the way.
1. Use standard 320x480 160dpi variant as your base layout
My app will be locked in landscape-only display so do I simply read the above as 480x320 or am I expected to design in portrait mode to correctly apply AutoScaleRate()/AutoScaleAll?
2. AutoScaleRate()/AutoScaleAll scale each following view, so to keep something at a specific size I have to declare it after the AutoScaleAll command. Right?
3. Labels' textsizes are scaled like any other view element so am I expected to design in 480x320 and stop "when it looks good" for a 4" device (again 480x320 160dpi)? This will scale up nicely up toward a 10" tablet?
Or have I to plan a second variant specific to 7" and 10" devices where I increase the TextSize in order to fill most of the extra space?
What follows is my first attempt at script usage; The main app screen shows 3 partially overlapping panels each one showing at least an image and a couple of labels with different textsizes.
Since the code looks "ugly" to me, I'm quite sure that a few things needs to be done differently..
My code:
'App will display ONLY in landscape mode
'All variants script
AutoScaleRate(0.3)
AutoScaleAll
' 3 partially overlapping panels
pnlHeader.SetLeftAndRight(0%x,50%x)
pnlHeader.SetTopAndBottom(0%y,100%y)
pnlDay.SetLeftAndRight(50%x,100%x)
pnlDay.SetTopAndBottom(0%y,55%y)
pnlMenu.SetLeftAndRight(40%x,100%x)
pnlMenu.SetTopAndBottom(50%y,100%y)
' Header panel content
imgLogo.SetLeftAndRight(5dip,pnlHeader.Right-5dip)
imgLogo.SetTopAndBottom(0,imgLogo.Width / 4)
lblHeader.TextSize = 24
lblHeader.Height = 70dip
lblHeader.SetLeftAndRight(pnlHeader.Left,pnlHeader.Right)
lblHeader.Top=imgLogo.Bottom+5dip
icosmall = 50%x /6
imgFbk.Width = icosmall
imgFbk.Height = icosmall * 1.6
imgFbk.Left = 4dip
imgFbk.Bottom = 85%y
imgTweet.Width = icosmall * 1.3
imgTweet.Height = icosmall *1.6
imgTweet.Left = imgFbk.Right+2dip
imgTweet.Bottom = 75%y
imgCopyright.Width=pnlHeader.Right-25%x
imgCopyright.Height = imgCopyright.Width / 12
imgCopyright.Bottom = 100%y
imgCopyright.Right=pnlMenu.Left-4dip
'Day panel content
lblToday.TextSize=16
lblToday.Height=30dip
lblToday.SetLeftAndRight(4dip,pnlDay.Right-4dip)
lblToday.Top=0%y
iv_Lavagna.Width=Min(20%x,20%y)
iv_Lavagna.Height=iv_Lavagna.Width
iv_Lavagna.HorizontalCenter=25%x
iv_Lavagna.VerticalCenter = 25%y
lblDayTitle.TextSize=30
lblDayTitle.Height=40dip
lblDayTitle.Top=iv_Lavagna.Bottom+8dip
lblDayTitle.Left=0%x
lblDayTitle.HorizontalCenter=pnlDay.Width/2
lblFee.TextSize=24
lblFee.Height=40dip
lblFee.Top = iv_Lavagna.Top+(iv_Lavagna.Height - lblFee.Height)/2
lblFee.Left = iv_Lavagna.Right + 10dip
lblFee.Width = pnlDay.Right-lblFee.left
'Menu panel content
iv_Menu.Width = Min(20%x,20%y)
iv_Menu.Height = iv_Menu.Width
iv_Menu.Left = 4dip
iv_Menu.Top = 15%y
lblMenu.TextSize = 30
lblMenu.Height = 70dip
lblMenu.Left = iv_Menu.Right+10dip
lblMenu.Width = pnlMenu.Width-iv_Menu.Width-12dip
lblMenu.Top = iv_Menu.Top+(iv_Menu.Height - lblMenu.Height)/2
lblMotto.TextSize = 24
lblMotto.Height = 30dip
lblMotto.SetLeftAndRight(4dip,pnlMenu.Width-8dip)
lblMotto.Bottom = pnlMenu.Height
Sorry for the message length
Umberto
I'm really fond of the Designer Script mode and read most of the previous posts about it, but I'm still a bit puzzled; so please help me clarify a few concepts and correct my naive script attempt in the way.
1. Use standard 320x480 160dpi variant as your base layout
My app will be locked in landscape-only display so do I simply read the above as 480x320 or am I expected to design in portrait mode to correctly apply AutoScaleRate()/AutoScaleAll?
2. AutoScaleRate()/AutoScaleAll scale each following view, so to keep something at a specific size I have to declare it after the AutoScaleAll command. Right?
3. Labels' textsizes are scaled like any other view element so am I expected to design in 480x320 and stop "when it looks good" for a 4" device (again 480x320 160dpi)? This will scale up nicely up toward a 10" tablet?
Or have I to plan a second variant specific to 7" and 10" devices where I increase the TextSize in order to fill most of the extra space?
What follows is my first attempt at script usage; The main app screen shows 3 partially overlapping panels each one showing at least an image and a couple of labels with different textsizes.
Since the code looks "ugly" to me, I'm quite sure that a few things needs to be done differently..
My code:
'App will display ONLY in landscape mode
'All variants script
AutoScaleRate(0.3)
AutoScaleAll
' 3 partially overlapping panels
pnlHeader.SetLeftAndRight(0%x,50%x)
pnlHeader.SetTopAndBottom(0%y,100%y)
pnlDay.SetLeftAndRight(50%x,100%x)
pnlDay.SetTopAndBottom(0%y,55%y)
pnlMenu.SetLeftAndRight(40%x,100%x)
pnlMenu.SetTopAndBottom(50%y,100%y)
' Header panel content
imgLogo.SetLeftAndRight(5dip,pnlHeader.Right-5dip)
imgLogo.SetTopAndBottom(0,imgLogo.Width / 4)
lblHeader.TextSize = 24
lblHeader.Height = 70dip
lblHeader.SetLeftAndRight(pnlHeader.Left,pnlHeader.Right)
lblHeader.Top=imgLogo.Bottom+5dip
icosmall = 50%x /6
imgFbk.Width = icosmall
imgFbk.Height = icosmall * 1.6
imgFbk.Left = 4dip
imgFbk.Bottom = 85%y
imgTweet.Width = icosmall * 1.3
imgTweet.Height = icosmall *1.6
imgTweet.Left = imgFbk.Right+2dip
imgTweet.Bottom = 75%y
imgCopyright.Width=pnlHeader.Right-25%x
imgCopyright.Height = imgCopyright.Width / 12
imgCopyright.Bottom = 100%y
imgCopyright.Right=pnlMenu.Left-4dip
'Day panel content
lblToday.TextSize=16
lblToday.Height=30dip
lblToday.SetLeftAndRight(4dip,pnlDay.Right-4dip)
lblToday.Top=0%y
iv_Lavagna.Width=Min(20%x,20%y)
iv_Lavagna.Height=iv_Lavagna.Width
iv_Lavagna.HorizontalCenter=25%x
iv_Lavagna.VerticalCenter = 25%y
lblDayTitle.TextSize=30
lblDayTitle.Height=40dip
lblDayTitle.Top=iv_Lavagna.Bottom+8dip
lblDayTitle.Left=0%x
lblDayTitle.HorizontalCenter=pnlDay.Width/2
lblFee.TextSize=24
lblFee.Height=40dip
lblFee.Top = iv_Lavagna.Top+(iv_Lavagna.Height - lblFee.Height)/2
lblFee.Left = iv_Lavagna.Right + 10dip
lblFee.Width = pnlDay.Right-lblFee.left
'Menu panel content
iv_Menu.Width = Min(20%x,20%y)
iv_Menu.Height = iv_Menu.Width
iv_Menu.Left = 4dip
iv_Menu.Top = 15%y
lblMenu.TextSize = 30
lblMenu.Height = 70dip
lblMenu.Left = iv_Menu.Right+10dip
lblMenu.Width = pnlMenu.Width-iv_Menu.Width-12dip
lblMenu.Top = iv_Menu.Top+(iv_Menu.Height - lblMenu.Height)/2
lblMotto.TextSize = 24
lblMotto.Height = 30dip
lblMotto.SetLeftAndRight(4dip,pnlMenu.Width-8dip)
lblMotto.Bottom = pnlMenu.Height
Sorry for the message length
Umberto