Hello,
I'm trying out some class coding again and bumped into something I can't seem to solve and would like to have an explanation or solution on the behaviour.
I had it working by "posting" the panel name to the init & subs of the class.
But when trying to cut down the code a bit and using less sub calling variable I thought about sending the panel name in the init once and store it somewhere but I can't get it to work right.
the minified code looks like this...
I get errors that menupanel is not initialized.
If I init it the error is gone but the panel is still visible, so I guess it created a new one and hides that?
I'm trying out some class coding again and bumped into something I can't seem to solve and would like to have an explanation or solution on the behaviour.
I had it working by "posting" the panel name to the init & subs of the class.
But when trying to cut down the code a bit and using less sub calling variable I thought about sending the panel name in the init once and store it somewhere but I can't get it to work right.
the minified code looks like this...
B4X:
Sub Class_Globals
Dim mainactivity As Activity
Dim menupanel As Panel
End Sub
Sub Initialize(act As Activity,menu_panel As Panel)
mainactivity=act
menupanel=menu_panel
End Sub
Sub start()
menupanel.Visible=False
end sub
I get errors that menupanel is not initialized.
If I init it the error is gone but the panel is still visible, so I guess it created a new one and hides that?