Thank you for this, apparently the Enabled property seem doesn't work.
When Enabled property set to false the button should have grayed color and can not be clicked
This is a custom drawn button. Nothing will happen unless it is implemented. The code is quite simple. It shouldn't be difficult to add a "disabled" state.
This is a custom drawn button. Nothing will happen unless it is implemented. The code is quite simple. It shouldn't be difficult to add a "disabled" state.
Is it possible to include states for focused and unfocused buttons with this library? (B4XView doesn't seem to have a FocusChanged event or something like a 'HasFocus' member.)
This would be perfect for creating obvious navigation on things like Android TV.
B4XView doesn't have any events of its own. You need to handle the native view events. In this case the view is a Panel or Pane. You will need to do some work to make it focusable.
How can I use it in B4A? can it be used in TabStrip?
Any way of use better lookin buttons or images to click on and go to an activity with B4A and designer?
Thanks
just modify this code to raise click event only if touch_up position inside the button:
B4X:
Private Sub p_Touch (Action As Int, X As Float, Y As Float)
If mBase.Enabled=False Then Return
Select Action
Case mBase.TOUCH_ACTION_DOWN
pressed = True
Draw
Case mBase.TOUCH_ACTION_UP
pressed = False
Draw
If (mBase.Left + x) >= mBase.Left And (mBase.Left + x) <= (mBase.Left + mBase.Width) And _
(mBase.Top + y) >= mBase.Top And (mBase.Top + y) <= (mBase.Top + mBase.Height) Then
CallSubDelayed(mCallBack, mEventName & "_Click")
End If
End Select
End Sub
I wanted to SetLatoutAnimated to this button component, here we go..
B4X:
Sub AnimateSwiftButton(b As SwiftButton, Duration As Int, newTop As Int)
Dim base As B4XView = b.mBase
Dim left As Int = base.left
Dim height As Int = base.Height
Dim width As Int = base.width
base.SetLayoutAnimated(Duration, left, newTop, width, height)
End Sub