I have a lot of Pane: Pane1, Pane2, Pane3, Pane4, etc. And there is a sub-program where I have to change the height of each panel. Can I do this with the help of a subroutine?
B4X:
HeightPane(1,20%y)
HeightPane(2,10%y)
'etc
Sub HeightPane (a As Int,b As Int)
Pane&"a".Height=b
End Sub
Create an array of Panes and pass directly each pane to your routine, like:
B4X:
Dim MyPanes(10) As Pane
MyPanes(0) = Pane1
MyPanes(1) = Pane2
...
SetPaneHeight(MyPanes(5), 50dip)
Sub SetPaneHeight(P As Pane, Height As Int)
P.Height = Height
End Sub
SetPaneHeight(Pane1, 50dip)
SetPaneHeight(Pane2, 40dip)
Sub SetPaneHeight(P As Pane, Height As Int)
P.Height = Height
End Sub
u can also a List or Array as sub input parameter, so u can use for each there if there have the same properties.
or u can search the view objects by tag or id property with a little sub.