B4A Library SD: ScratchCard

Discussion in 'Additional libraries, classes and official updates' started by Star-Dust, Dec 8, 2018.

  1. Star-Dust

    Star-Dust Expert Licensed User

    I created a new view / panel that simulates the effect of scratch cards.
    Create a panel from code that design and you can hook other views that will be visible after the user has passed the finger on the surface.

    It has all the properties of a panel and also returns the native panel.


    Author: Star-Dust
    Version: 0.01
    • PanelScratchCard
      • Events:
        • Click
        • LongClick
        • Touch (Action As Int, Coordinate As String)
      • Fields:
        • ACTION_DOWN As Int
        • ACTION_MOVE As Int
        • ACTION_UP As Int
        • thickness As Int
      • Functions:
        • AddToParent (Parent As Panel, Left As Int, Top As Int, Width As Int, Height As Int) As String
        • AddView (View As View, Left As Int, Top As Int, Width As Int, Height As Int) As String
        • BringToFront As String
        • Class_Globals As String
        • DesignerCreateView (Base As Panel, Lbl As Label, Props As Map) As String
        • Initialize (Callback As Object, EventName As String) As String
        • Invalidate As String
        • IsInitialized As Boolean
          Verifica se l'oggetto sia stato inizializzato.
        • LoadLayout (layoutFile As String) As String
        • Panel As Panel
        • RemoveAllViews As String
        • RemoveView As String
        • RemoviewAt (Index As Int) As String
        • RequestFocus As String
        • SendToBack As String
        • SetBackgroundImage (Bitmap As Bitmap) As String
        • SetColorAnimated (Duration As Int, FromColor As Int, ToColor As Int) As String
        • SetLayout (Left As Int, Top As Int, Width As Int, Height As Int) As String
        • SetLayoutAnimated (Duration As Int, Left As Int, Top As Int, Width As Int, Height As Int) As String
        • Scratch (Enabled As Boolean)
          Default is Enabled
      • Properties:
        • Color
        • Elevation As Float
        • enabled As Boolean
        • Height As Int
        • Left As Int
        • Parent As Panel [read only]
        • Tag As Object
        • Top As Int
        • Visible As Boolean
        • Width As Int

    Sub Globals
    'These global variables will be redeclared each time the activity is created.
        'These variables can only be accessed from this module.
        Dim PA As PanelScratchCard
    End Sub

    Sub Activity_Create(FirstTime As Boolean)
    'Do not forget to load the layout file created with the visual designer. For example:
    End Sub

    Sub PA_Touch (Action As Int, Coordinate As String)
    Dim C() As String = Regex.Split("|",Coordinate)
    Dim X As Int = C(0)
    Dim Y As Int = C(1)
    End Sub

    Attached Files:

    Last edited: Dec 9, 2018
    T201016, Almora, paragkini and 10 others like this.
  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