B4J Question Undo/Redo by canvas.drawline with UndoManager

Discussion in 'B4J Questions' started by Alexander Stolte, Jun 21, 2018.

  1. Alexander Stolte

    Alexander Stolte Well-Known Member Licensed User

    Hello,

    How can i save the state of my Canvas drawing for the Undo and Redo Button with the UndoManager?


    i use this code for drawing:
    Code:
    Process_Globals
        
    Private pnl_back As B4XView
        
    Private cvs_back As B4XCanvas
    End Sub

    Sub AppStart (Form1 As Form, Args() As String)

    cvs_back.Initialize(pnl_back)

    End Sub

    Sub pnl_back_Touch (Action As Int, X As Float, Y As Float)
        
        
    Select Action
            
    Case pnl_back.TOUCH_ACTION_DOWN
                x2 = X
                y2 = Y
            
    Case pnl_back.TOUCH_ACTION_MOVE
                cvs_back.DrawLine(X, Y, x2, y2, xui.Color_RGB(r,g,b), bright)
                x2 = X
                y2 = Y
                cvs_back.Invalidate
            
        
    End Select
    End Sub
     
  2. Erel

    Erel Administrator Staff Member Licensed User

Loading...
  1. This site uses cookies to help personalise content, tailor your experience and to keep you logged in if you register.
    By continuing to use this site, you are consenting to our use of cookies.
    Dismiss Notice