red30 Well-Known Member Licensed User Longtime User Nov 14, 2018 #1 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? Code: Copy HeightPane(1,20%y) HeightPane(2,10%y) 'etc Sub HeightPane (a As Int,b As Int) Pane&"a".Height=b End Sub
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? Code: Copy HeightPane(1,20%y) HeightPane(2,10%y) 'etc Sub HeightPane (a As Int,b As Int) Pane&"a".Height=b End Sub
LucaMs Expert Licensed User Longtime User Nov 14, 2018 #2 No. Create an array of Panes and pass directly each pane to your routine, like: Code: Copy 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 Upvote 0
No. Create an array of Panes and pass directly each pane to your routine, like: Code: Copy 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
MarkusR Well-Known Member Licensed User Longtime User Nov 14, 2018 #3 that would be the same as Code: Copy 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. Upvote 0
that would be the same as Code: Copy 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.