Continuous line drawing with touch

I couldn't find this particular bit of code anywhere and so I figured it out myself. Used it for my Less Note 1.0.0 drawing/sketching/writing app currently waiting for review.

B4X:
Sub DrawPanel_Touch(Action As Int, X As Float, Y As Float)
    Select Action
        Case DrawPanel.ACTION_DOWN
            x2 = X
            y2 = Y
        Case DrawPanel.ACTION_MOVE
            cvsDrawPad.DrawLine(X, Y, x2, y2, penColor, penwidth)
            x2 = X
            y2 = Y
            cvsDrawPad.Refresh
    End Select
End Sub

Hope this is helpful.
 

freedom2000

Well-Known Member
Licensed User
Longtime User
Hi,

I tried your code but got an error on the refresh method...

B4X:
Error description: Unknown member: refresh
Occurred on line: 178
            cvsDrawPad.Refresh
Word: refresh
 

Mark Turney

Active Member
Licensed User
Longtime User
Silly question, but iOS or Android? This is specifically for iOS. If Android, you use Invalidate to "redraw" a view.
 
Top