Android Question How to draw on a canvas in Android

saeed10051

Active Member
Licensed User
Longtime User
Hi all
i have seen on code from Erel where following code is executed on B4J side to draw on a canvas

Sub cvs_MouseDragged (EventData As MouseEvent)
cvs.DrawCircle(EventData.X, EventData.Y, 30dip, fx.Colors.From32Bit(Rnd(0xFF000000, -1)), True, 0)
End Sub

Here as we see that MouseDragged sub is using MouseEvent to draw. However if i want to use the same sub in B4A, i am unable to find an event which i can use to draw. I am trying to create an app in which on dragging my finger on the screen i can draw on the screen.
 

aeric

Expert
Licensed User
Longtime User
 
Upvote 0

saeed10051

Active Member
Licensed User
Longtime User
Hi Aeric
thanks for the reply
however i am missing one point here, the examples given here refer to drawing something grammatically and displaying it on the canvas. I want to draw by dragging my finger on the screen. how to capture that event. When i see the code by Erel in B4J (as given in my original question) he has used the mouse drag to draw something, how to capture that event while working with B4A , as here we do not have a mouse we just drag our finger on the screen.
 
Upvote 0

saeed10051

Active Member
Licensed User
Longtime User
Hi Angel
i have reviewed the code, however i am unable to catch that in which event are you writing the code to draw the lines. There is a Sub ASDraw1_Touch (Action As Int, XY As Map)
but within the sub all the code is commented.
can you please explain.
 
Upvote 0
Cookies are required to use this site. You must accept them to continue using the site. Learn more…