panel having multiple labels - help needed

shashkiranr

Active Member
Licensed User
Longtime User
Hi,

I am calling this panel which has two labels (as shown in the attachment) and one child panel containing a button to be displayed in scrollview and i am calling this layout using "ScrollView1.Panel.LoadLayout"

The labels get displayed but the panel containing the button is not visible.

I made sure that "ScrollView1.Panel.Width = ScrollView1.Width"

I have attached the screenshot.

The Child panel containing the button should come at the right end of the screen and the two labels should be to the left next to the Child panel

This is the code in the designer

B4X:
AutoScaleAll

PanelPmanku.SetLeftAndRight(0,100%x)
PanelPmanku.SetTopAndBottom(0,100%y)

PanelCmanku.SetTopAndBottom(0,100%y)
PanelCmanku.SetLeftAndRight(90%x,100%x)


'PanelCmanku.Width = 40dip

Button1manku.Height = 70dip
Button1manku.Width = PanelCmanku.Width

Label1manku.SetTopAndBottom(5%y,50%y)
Label2manku.SetTopAndBottom(Label1manku.Bottom+10dip,95%y)

Label1manku.SetLeftAndRight(7dip,PanelCmanku.Left)
Label2manku.SetLeftAndRight(7dip,PanelCmanku.Left)


Button1manku.VerticalCenter = 50%y

Kindly let me know where i am going wrong... :(

Regards,
SK
 

Attachments

  • Screenshot_2013-07-09-22-14-14.jpg
    Screenshot_2013-07-09-22-14-14.jpg
    61.8 KB · Views: 198

shashkiranr

Active Member
Licensed User
Longtime User
Here is the Code

Hi Erel, Sorry for the delayed reply. Kindly find the code below and i have attached the layout file since the zip file was greater then 390KB.

Kindly let me know where i am going wrong.

Note : You can remove the wood1.jpg line since i was not able to upload the image :(

B4X:
#Region  Project Attributes 
   #ApplicationLabel: B4A Example
   #VersionCode: 1
   #VersionName: 
   'SupportedOrientations possible values: unspecified, landscape or portrait.
   #SupportedOrientations: unspecified
   #CanInstallToExternalStorage: False
#End Region

#Region  Activity Attributes 
   #FullScreen: False
   #IncludeTitle: True
#End Region

Sub Process_Globals
   'These global variables will be declared once when the application starts.
   'These variables can be accessed from all modules.
   Dim FILL_PARENT As Int : FILL_PARENT = -1
End Sub

Sub Globals
   'These global variables will be redeclared each time the activity is created.
   'These variables can only be accessed from this module.
   Dim ScrollView1 As ScrollView
   Dim Panelpmanku As Panel
End Sub

Sub Activity_Create(FirstTime As Boolean)
   'Do not forget to load the layout file created with the visual designer. For example:
   'Activity.LoadLayout("Layout1")
   Dim b As Bitmap
   b.Initialize(File.DirAssets,"wood1.jpg")
   ScrollView1.Initialize(Activity.Height)
   Activity.AddView(ScrollView1,0,0,FILL_PARENT, FILL_PARENT)
   ScrollView1.Panel.LoadLayout("manku")
         Panelpmanku.SetBackgroundImage(b)
         
         ScrollView1.Panel.Width = ScrollView1.Width
'         Panelpmanku.Width =  ScrollView1.Width
   
End Sub

Sub Activity_Resume

End Sub

Sub Activity_Pause (UserClosed As Boolean)

End Sub

Regards,
Shashi Kiran
 

Attachments

  • manku.bal
    3.3 KB · Views: 148
Upvote 0

klaus

Expert
Licensed User
Longtime User
Try to replace
Activity.AddView(ScrollView1, 0, 0, FILL_PARENT, FILL_PARENT)
by
Activity.AddView(ScrollView1, 0, 0, 100%x, 100%y)

Why do you use a ScrollView ?
You set the height of the panel you load into it to 100%y the same as the ScrollView height, so nothing will scroll.
You use a standard layout variant, but PanelPmanku has a bigger width and height why?
Then in the DesignerScript you use AutoScaleAll and then you set the width to 100%x and the height to 100%y ?

Attached a small test program.

Best regards.
 

Attachments

  • Test.zip
    7.4 KB · Views: 161
Upvote 0

shashkiranr

Active Member
Licensed User
Longtime User
Activity.AddView(ScrollView1, 0, 0, 100%x, 100%y)

Why do you use a ScrollView ?

Hi Kluas,

Sorry for the delayed reply. Yes you are right. it worked perfectly :sign0142:

I am using scroll view becuase the labels can have mutliple line text and i will be adjusting the height of the label based on the text.

Regards,
SK
 
Upvote 0
Top