Enjoy this project from B4A https://github.com/buraktamturk/AnswerView
A library mimics the circles used in optic forms.
AnswerView
Author: SMM
Version: 0.01
Sample (Not the best of course )
A library mimics the circles used in optic forms.
AnswerView
Author: SMM
Version: 0.01
- AnswerView
Events:- _answerchanged (answerview1 As AnswerView, index As Int)
- ba As BA
- BringToFront
- Initialize (EventName As String, count As Int, ShowTextWhenActive As Boolean, changeOnClick As Boolean, canCancelAnswer As Boolean, ShowNumber As Boolean)
- Invalidate
- Invalidate2 (arg0 As Rect)
- Invalidate3 (arg0 As Int, arg1 As Int, arg2 As Int, arg3 As Int)
- IsInitialized As Boolean
- RemoveView
- RequestFocus As Boolean
- SendToBack
- SetBackgroundImage (arg0 As Bitmap)
- SetColorAnimated (arg0 As Int, arg1 As Int, arg2 As Int)
- SetLayout (arg0 As Int, arg1 As Int, arg2 As Int, arg3 As Int)
- SetLayoutAnimated (arg0 As Int, arg1 As Int, arg2 As Int, arg3 As Int, arg4 As Int)
- SetVisibleAnimated (arg0 As Int, arg1 As Boolean)
- resize (count As Int)
- ActiveChar As Char
- ActiveIndex As Int
- Background As Drawable
- Color As Int [write only]
- Enabled As Boolean
- Height As Int
- Left As Int
- Number As Int [write only]
- Parent As Object [read only]
- Tag As Object
- Top As Int
- Visible As Boolean
- Width As Int
Sample (Not the best of course )
B4X:
Sub Globals
'These global variables will be redeclared each time the activity is created.
'These variables can only be accessed from this module.
Dim finished As Button
End Sub
Sub Activity_Create(FirstTime As Boolean)
'Do not forget to load the layout file created with the visual designer. For example:
'Activity.LoadLayout("Layout1")
'
For i = 0 To 5
Dim ans As AnswerView
ans.Initialize("an",5,True,True,True,True)
ans.Number=i+1
ans.Tag=i+1
If i Mod 2 = 1 Then
ans.Color=Colors.White
Else
ans.Color=Colors.LightGray
End If
Activity.AddView(ans,0,(0+10%y*i),100%x,10%y)
Next
finished.Initialize("finished")
finished.Text="Finished"
Activity.AddView(finished,0,90%y,100%x,10%y)
End Sub
Sub finished_click
Dim unanswered As List
unanswered.Initialize
For v=0 To Activity.NumberOfViews-1
If Activity.GetView(v) Is AnswerView Then
Dim vv As AnswerView = Activity.GetView(v)
If vv.ActiveChar="@" Then
unanswered.Add(vv.Tag)
End If
End If
Next
If unanswered.Size=0 Then
ToastMessageShow("You have answered all questions , Good luck",False)
Else
For un = 0 To unanswered.Size-1
ToastMessageShow("Please answer question number "&unanswered.Get(un),False)
Next
End If
End Sub
Sub an_answerchanged(ans As AnswerView,index As Int)
Dim send As AnswerView = Sender
Log(send.ActiveChar&index&send.Tag)
End Sub