Panel touch & drawings

KMatle

Expert
Licensed User
Longtime User
Hi,

I tried some graphics today with this code:

B4X:
Sub Activity_Create(FirstTime As Boolean)
   'Do not forget to load the layout file created with the visual designer. For example:
   Activity.LoadLayout("LO1")
   
   'initialize the Canvas for the activity
    cvsActivity.Initialize(Activity)
    'initialize the Canvas for the pnlGraph panel
    cvsGraph.Initialize(Panel1) 'Panel1 comes via designer

End Sub

Sub Panel1_Touch (Action As Int, X As Float, Y As Float)
Select Action
        Case Activity.ACTION_DOWN
            
          Label1.Text = NumberFormat(X,2,0)
            Label2.Text = NumberFormat(Y,2,0)
   
             cvsGraph.DrawCircle(X, Y, 30dip, Colors.Gray, False, 10Dip)
          
End Select
End Sub

The two Labels are updated with the x/y values at every touch but DrawCircle draws 1-2 circles only.

Any ideas? Thanks
 
Top