B4A Library [B4X] [XUI] SwiftButton

incendio

Well-Known Member
Licensed User
What's the minimum B4J version to run this sample?

Tried it in B4J 6.01, got an error :

Unknown member drawpath.
 

DonManfred

Expert
Licensed User

rraswisak

Active Member
Licensed User
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
 

rraswisak

Active Member
Licensed User
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.
Yes you are right, this is what i have done:

1. Add this at p_Touch sub right before Select Action code
B4X:
 If mBase.Enabled=False Then Return
2. Add this at Draw sub right before If pressed = False Then code
B4X:
If mBase.Enabled=False Then
   clr1 = Colors.Gray
   clr2 = Colors.DarkGray
   pressed=False
End If
 

JdV

Active Member
Licensed User
Hi

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.

Regards

Joe
 

Alberto Michelis

Well-Known Member
Licensed User
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
 

Erel

Administrator
Staff member
Licensed User

rraswisak

Active Member
Licensed User
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
 
Top