Hi,
i´m new here and try to make a very simple tool to input some data.
On the first hand i was unsure wich views are safe to use over android and ios, but after some time it looks like the one i search for is missing anyway.
I need a button with 4 states - unselected, on, type a and type b. I want to display this with circles inside the button.
With a idea in my head i start to build something like that. I look at the forum how to draw what i need and at the beginning it looks "ok". But then i add a timer to roll through the options - and i see the old element is stay there... My "canvas.clearRect(rect)" makes nothing. Than i add a filled background to my button, so the dots, in the code later, should be over this. Short answer - no, it works the first time, after that ist stays in this position.
Can anybody tell me what is wrong in my head...
"Drawing" has only one view, a Pane named "pnlDrawing"
	
	
	
	
	
	
	
		
			
			
			
			
			
		
	
	
	
		
	
	
		
	
Thank you
Matze
			
			i´m new here and try to make a very simple tool to input some data.
On the first hand i was unsure wich views are safe to use over android and ios, but after some time it looks like the one i search for is missing anyway.
I need a button with 4 states - unselected, on, type a and type b. I want to display this with circles inside the button.
With a idea in my head i start to build something like that. I look at the forum how to draw what i need and at the beginning it looks "ok". But then i add a timer to roll through the options - and i see the old element is stay there... My "canvas.clearRect(rect)" makes nothing. Than i add a filled background to my button, so the dots, in the code later, should be over this. Short answer - no, it works the first time, after that ist stays in this position.
Can anybody tell me what is wrong in my head...
"Drawing" has only one view, a Pane named "pnlDrawing"
			
				B4X:
			
		
		
		Sub Class_Globals
    Dim fx As JFX
    Dim xui As XUI
    Dim pnlDrawing As B4XView
    Dim canvas As B4XCanvas
    Dim rect As B4XRect
    Dim path As B4XPath
    Dim SelectedOption As Int
    Dim tmr As Timer
End Sub
Public Sub Initialize(Parent As B4XView)
    Parent.LoadLayout("Drawing")
 
    SelectedOption=1
    tmr.Initialize("timer",1000)
    tmr.Enabled = True
End Sub
Sub timer_tick
    SelectedOption=SelectedOption+1
    If SelectedOption=4 Then SelectedOption=0
    UpdateButton
End Sub
Private Sub UpdateButton()
    canvas.Initialize(pnlDrawing)
 
    rect.Left =0:rect.Top=0:rect.Width=60:rect.Height=60
    canvas.ClearRect(rect)                                             
    path.InitializeRoundedRect (rect,5)
    canvas.DrawPath(path,xui.Color_Gray ,True,0)                '< this stops updating the rest after the first execute
    canvas.DrawPath(path,xui.Color_RGB(145,0,41) ,False,2)
    If SelectedOption=1 Then
        rect.Left =15:rect.Top=10:rect.Width=30:rect.Height=10
        canvas.DrawRect(rect,xui.Color_RGB(43,137,4) ,True,2)
    End If
    If SelectedOption=1 Or SelectedOption=2 Then
        canvas.DrawCircle(15,15,5,xui.Color_RGB(43,137,4) ,True,0)
    End If
    If SelectedOption=1 Or SelectedOption=3 Then
        canvas.DrawCircle(45,15,5,xui.Color_RGB(43,137,4) ,True,0)
    End If
 
    canvas.Invalidate
End SubThank you
Matze
 
				 
 
		 
 
		 
 
		 
 
		 
 
		 
 
		 
 
		 
 
		