Panel and spinner

derez

Expert
Licensed User
Longtime User
Panel and spinner and more

I have a problem with the combination of panel and spinner, demonstrated in the attached program.
the button click should move the panel left but only the spinner moves. invalidate to the panel or the activity does not help.
Also, I don't understand why I need to add the views inspite the fact that they are defined in the designer.

In another program I start the program when the panel and its child the spinner are not visible. When I turn visibility to true for both - only the spinner is seen.

Something else - how do you get rid of a layout which you want to delete (of a second module which has been deleted) ?

Activity_touch - works when there is a panel, is therew a way to enable touch response only on the activity ?
 

Attachments

  • paneltest.zip
    5.8 KB · Views: 235
Last edited:

Erel

B4X founder
Staff member
Licensed User
Longtime User
Your code should be:
B4X:
Sub Process_Globals
    'These global variables will be declared once when the application starts.
    'These variables can be accessed from all modules.

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 Panel1 As Panel
    Dim Spin As Spinner
    Dim lt As List
    
End Sub

Sub Activity_Create(FirstTime As Boolean)
    activity.LoadLayout("spin")
    lt.Initialize
    lt.Add("aaa")
    lt.Add("bbb")
    spin.AddAll(lt)
End Sub

Sub Activity_Resume

End Sub

Sub Activity_Pause (UserClosed As Boolean)

End Sub

Sub Spin_ItemClick (Position As Int, Value As Object)
    ToastMessageShow(value,True)    
End Sub


Sub Button1_Click
    panel1.Left = 0
End Sub

You should not initialize views that are added by the designer (and you should not add them manually).
 
Top