Android Question How acces properties from name a control

pcicom

Member
Licensed User
Longtime User
Hi.

How acces a propieries from control by name..

example:

List of controls

Panel1.height = 100
Panel2.height = 200
Panel3.height = 300
Panel4.height = 400


Sub SizePanel(strNamePanel as String) as int
Dim nH as Int
nH = strNamePanel.height <--- how acces a properties from name of control.
return nH
end sub
 

klaus

Expert
Licensed User
Longtime User
First you should use code tags to display code.
upload_2017-7-14_20-20-46.png


Your sub should be, if you have only Panels:
B4X:
Sub SizePanel(pnl as Panel) as int
    Dim nH as Int
    nH = pnl.Height <--- how acces a properties from name of control.
    return nH
End Sub

or more general:
B4X:
Sub SizePanel(v as View) as int
    Dim nH as Int
    nH = v.Height <--- how acces a properties from name of control.
    return nH
End Sub
 
Upvote 0
Top