B4A Library FancyButton V1.0.3

FancyBtn This Library-Wrapper is based on this Github-Project.
FancyBtn
Version: 1.03

  • Methods:
    • onTouch (view As View, motionEvent As MotionEvent) As Boolean
  • FancyBtn
    Events:
    • click (v as Object As , tag As Object)
    • hover (v as Object As , tag As Object)
    • ondismiss (v as Object As , tag As Object)
    Methods:
    • AddToParent (Parent As ViewGroup, left As Int, top As Int, width As Int, height As Int)
    • DesignerCreateView (base As PanelWrapper, lw As LabelWrapper, props As Map)
    • Initialize (EventName As String, iconres As String, IconPosition As Int, tag As Object, AllowDismiss As Boolean)
    • IsInitialized As Boolean
    • uniplus (s As String) As String
    Properties:
    • Background As Drawable [write only]
    • BackgroundColor As Int [write only]
      Sets the BackgroundColor to use with the FancyButton
    • BackgroundColor2 As String [write only]
      Sets the BackgroundColor to use with the FancyButton
      here you can give a hexstring representating the color
    • BorderColor As Int [write only]
      Sets the BorderColor to use with the FancyButton
    • BorderWidth As Int [write only]
      Sets the BorderWidth to use with the FancyButton
    • CustomIconFont As String [write only]
      Set a new Iconfont to use in the FancyButton.
      It must be a name from a file in the assets-folder
      fontawesome.ttf for ex.
    • CustomTextFont As String [write only]
      Set a new Textfont to use in the FancyButton.
      It must be a name from a file in the assets-folder
      robotoregular.ttf for ex.
    • FontIconSize As Int [write only]
      Sets the Size of the icon to use with the FancyButton
      Only works when using an Icon from the IconFont.
    • Icon As String [write only]
      Sets the Icon to use with the FancyButton. You need to give an unicode
      string representating the Icon in the Iconfont. For ex. ?
    • IconDrawable As String [write only]
      Sets the Icon to use with the FancyButton
      You can give the filename of a drawable in the
      drawable folder in your res folder.
    • IconPosition As Int [write only]
      Set the Icon-Position of the FancyButton.
      1 = Left
      POSITION_LEFT = 1;
      POSITION_RIGHT = 2;
      POSITION_TOP = 3;
      POSITION_BOTTOM = 4;
    • Left As Int
    • Radius As Int [write only]
      Sets the Radius to use with the FancyButtons edges
    • Tag As Object
      Sets the Tag for this FancyButton
    • Text As String [write only]
      Sets the Text to use with the FancyButton
    • TextSize As Int [write only]
      Sets the Textsize to use with the FancyButton
    • Textcolor As Int [write only]
      Sets the TextColor to use with the FancyButton
    • Top As Int
    • Visible As Boolean
      Sets the FancyButtons visibility
    • Width As Int

See this cheat for a list of all included Icons in the Iconfont

FancyButton004.png


This library is Donationware. You can download the library, you can test the library. But if you want to USE the library in your App you need to Donate for it.
Please click here to donate (You can donate any amount you want to donate for the library (or my work) :)
 

Attachments

  • libFancyButtonV1.0.0.zip
    24.1 KB · Views: 430
  • libFancyButtonV1.0.3.zip
    30.8 KB · Views: 805
  • FancyButtonEx.zip
    272.7 KB · Views: 992
Last edited:

tdocs2

Well-Known Member
Licensed User
Longtime User
have you tried it without obfuscation? Just a thought and dont know whether this is relevant.

The method you are calling (maybe initialize?) needs 3 parameters but you are giving 5 parameters.

Thank you, Don.

The error I posted was with Lib 1.0.

The method Initialize according to the xml requires 5 parameters with Lib 1.0.3 and 3 parameters with 1.0.

B4X:
FancyBtn.xml - version 1.03

FancyBtn : Process object - wraps com.div.FancyButton

Initialize

Method

Returns : Void

Initialize(EventName As String, iconres As String, IconPosition As Int, tag As Object, AllowDismiss As Boolean)

B4X:
FancyBtn.xml - version 1.0

FancyBtn : Process object - wraps com.div.FancyButton

Initialize

Method

Returns : Void

Initialize(EventName As String, iconres As String, IconPosition As Int)
I downloaded the sample app you provided on a different computer with 1.0.3 and it works just fine.

Thank you, Don. Your generosity and willingness to help is to be commended.

Sandy
 

Gary Milne

Active Member
Licensed User
Longtime User
Hi Don, I like what you are doing here but I wish some of this stuff were more built in. (Feels like I spend way too much time working on overcoming the limits of the built in views).

Anyway, I have been playing with FontAwesome as a way of dressing up buttons when I came across your FancyButtons. I wanted to give it a try so I changed a button on my project as shown below.

Screenshot_2015-05-18-14-19-50.png

It looks not too bad but I find the spacing between the Icon and the text to be a bit "off". It seems as though the icon is gravity.left and the text is gravity right leaving an oversized space between them. This gap does not seem to be present on any of your examples but there do not seem to be any controls to change this.

P.S. It would be nice to be able to specify the use of BOLD\ITALIC for the text as I'm sure many developers already use this as a visual aid for the user.
 

Lello1964

Well-Known Member
Licensed User
Longtime User
Hi Don, i must use button without text, but if i set .text="", text space isn't used bye icon.
How can put icon in middle center of button without text ?
 

Mashiane

Expert
Licensed User
Longtime User
H
FancyBtn This Library-Wrapper is based on this Github-Project.
FancyBtn
Version:
1.03

  • Methods:
    • onTouch (view As View, motionEvent As MotionEvent) As Boolean
  • FancyBtn
    Events:
    • click (v as Object As , tag As Object)
    • hover (v as Object As , tag As Object)
    • ondismiss (v as Object As , tag As Object)
    Methods:
    • AddToParent (Parent As ViewGroup, left As Int, top As Int, width As Int, height As Int)
    • DesignerCreateView (base As PanelWrapper, lw As LabelWrapper, props As Map)
    • Initialize (EventName As String, iconres As String, IconPosition As Int, tag As Object, AllowDismiss As Boolean)
    • IsInitialized As Boolean
    • uniplus (s As String) As String
    Properties:
    • Background As Drawable [write only]
    • BackgroundColor As Int [write only]
      Sets the BackgroundColor to use with the FancyButton
    • BackgroundColor2 As String [write only]
      Sets the BackgroundColor to use with the FancyButton
      here you can give a hexstring representating the color
    • BorderColor As Int [write only]
      Sets the BorderColor to use with the FancyButton
    • BorderWidth As Int [write only]
      Sets the BorderWidth to use with the FancyButton
    • CustomIconFont As String [write only]
      Set a new Iconfont to use in the FancyButton.
      It must be a name from a file in the assets-folder
      fontawesome.ttf for ex.
    • CustomTextFont As String [write only]
      Set a new Textfont to use in the FancyButton.
      It must be a name from a file in the assets-folder
      robotoregular.ttf for ex.
    • FontIconSize As Int [write only]
      Sets the Size of the icon to use with the FancyButton
      Only works when using an Icon from the IconFont.
    • Icon As String [write only]
      Sets the Icon to use with the FancyButton. You need to give an unicode
      string representating the Icon in the Iconfont. For ex. ?
    • IconDrawable As String [write only]
      Sets the Icon to use with the FancyButton
      You can give the filename of a drawable in the
      drawable folder in your res folder.
    • IconPosition As Int [write only]
      Set the Icon-Position of the FancyButton.
      1 = Left
      POSITION_LEFT = 1;
      POSITION_RIGHT = 2;
      POSITION_TOP = 3;
      POSITION_BOTTOM = 4;
    • Left As Int
    • Radius As Int [write only]
      Sets the Radius to use with the FancyButtons edges
    • Tag As Object
      Sets the Tag for this FancyButton
    • Text As String [write only]
      Sets the Text to use with the FancyButton
    • TextSize As Int [write only]
      Sets the Textsize to use with the FancyButton
    • Textcolor As Int [write only]
      Sets the TextColor to use with the FancyButton
    • Top As Int
    • Visible As Boolean
      Sets the FancyButtons visibility
    • Width As Int

See this cheat for a list of all included Icons in the Iconfont

FancyButton004.png


This library is Donationware. You can download the library, you can test the library. But if you want to USE the library in your App you need to Donate for it.
Please click here to donate (You can donate any amount you want to donate for the library (or my work) :)
Hi

Can you make an oval button with this with the image centered inside? I'm looking for one without text, just the image only
 

DonManfred

Expert
Licensed User
Longtime User
You just can use the radius and no text. See example-screenshot in post #1
but this will not result in an oval... Only a rectangle with rounded corners. Or even a circle

The library does not support any special layouts as it is based on a button
 

R Rioja

Member
Licensed User
Longtime User
Don,
Most of the properties as write-only. Is it possible to make them read/write? I also noticed that there is no property for height.
Thank you,
Robert
 

R Rioja

Member
Licensed User
Longtime User
The sample program will not work on Android version 2.3.4 but is works with Android 4.4.2, so my question is what is the minimum version required?
Thanks,
Robert
 

eelias

Active Member
Licensed User
Longtime User
Don.... do you have plans to update this library? they made many changes to it... thanks
 
Top