B4J Library ToastMessageShow Library

Discussion in 'B4J Libraries & Classes' started by lonleystar, Dec 26, 2013.

  1. lonleystar

    lonleystar Well-Known Member Licensed User

    Hi guys, I am pleased to introduce ToastMessageShow for B4J.

    In to the zip is included the library and the demo.

    The library Include:

    Below is the commons where you wish to display the Toast:


    jCustomToast
    Author:
    GiuseppeSalvi
    Version: 1.1
    • ToastMessageShow
      Fields:
      • TOAST_ERROR_ICON As Image
      • TOAST_INFO_ICON As Image
      • TOAST_SUCCESS_ICON As Image
      • TOAST_WARNING_ICON As Image
      • TEXT_CENTER As Int
      • TEXT_LEFT As Int
      • TEXT_RIGHT As Int
      • TOAST_BOTTOM_CENTER As Pos
      • TOAST_BOTTOM_LEFT As Pos
      • TOAST_BOTTOM_RIGHT As Pos
      • TOAST_CENTER As Pos
      • TOAST_CENTER_LEFT As Pos
      • TOAST_CENTER_RIGHT As Pos
      • TOAST_ERROR_ICON As Image
      • TOAST_INFO_ICON As Image
      • TOAST_LONG_DELAY As Double
      • TOAST_SHORT_DELAY As Double
      • TOAST_SUCCESS_ICON As Image
      • TOAST_TOP_CENTER As Pos
      • TOAST_TOP_LEFT As Pos
      • TOAST_TOP_RIGHT As Pos
      • TOAST_WARNING_ICON As Image
      Methods:
      • Initialize (EventName As String)
        Initialize the Objct
      • ToastIconSize16x16
        Set the icon 16 x 16
      • ToastIconSize24x24
        Set the icon 24 x 24
      • ToastIconSize32x32
        Set the icon 32 x 32
      • ToastIconSize40x40
        Set the icon 40 x 40
      • ToastIconSize48x48
        Set the icon 48 x 48
      • ToastShow (message As String)
        Show message
      • ToastShow2 (title As String, message As String)
        Show title and message
      • ToastShow3 (message As String, icon As Image)
        Show message and icon
      • ToastShow4 (title As String, message As String, icon As Image)
        Show title, message and icon
      • ToastShow5 (title As String, icon As Image)
        Show title and icon
      • ToastShow6 (icon As Image)
        Show icon
      • ToastStop
        Stop the toast
      Properties:
      • ToastDuration As Double [write only]
        Set the delay
      • ToastLocation As Pos [write only]
        Set the position of the toast
      • ToastMessageColor As Color [write only]
        Set color to the message
      • ToastNotificationOwner As Form [write only]
        Set MainForm to Anchor the Toast Inside own Window
      • ToastTextLocation As Int [write only]
        Set the position of the text
      • ToastTitleColor As Color [write only]
        Set color to the title
      • Version As String [read only]
        Return Author and Version of this library



    How it work:
    Code:
    #Region  Project Attributes
       
    #MainFormWidth: -1
       
    #MainFormHeight: -1
    #End Region

    Sub Process_Globals
       
    Private fx As JFX
       
    Private MainForm As Form
       
    Private b1 As Button
       
    Private b2 As Button
       
    Private b3 As Button
       
    Private b4 As Button
       
    Private b5 As Button
       
    Private b6 As Button
       
    Private Toast As ToastMessageShow
    End Sub

    Sub AppStart (Form1 As Form, Args() As String)
       MainForm = Form1
       MainForm.RootPane.LoadLayout(
    "CutomToast"'Load the layout file.
       Toast.Initialize("Toast")
       Toast.ToastIconSize32x32
       Toast.ToastDuration = 
    6 'Toast.TOAST_LONG_DELAY
       Toast.ToastTextLocation = Toast.TEXT_CENTER
       Toast.ToastLocation= Toast.TOAST_CENTER_RIGHT
     
       
    '******************************************
     
       Toast.ToastNotificationOwner = MainForm 
    'this declaration Important
     
       
    '******************************************
     
       MainForm.Show
    End Sub

    Sub b1_MouseClicked (EventData As MouseEvent)
       Toast.ToastMessageColor = fx.Colors.White
       Toast.ToastShow(
    "This is a Toast with message")
    End Sub

    Sub b2_MouseClicked (EventData As MouseEvent)
       Toast.ToastTitleColor = fx.Colors.Red
       Toast.ToastMessageColor = fx.Colors.Yellow
       Toast.ToastShow2(
    "Title","This is a Toast with title and message")
    End Sub

    Sub b3_MouseClicked (EventData As MouseEvent)
       
    Dim icon As Image
       icon.Initialize(
    File.DirAssets,"info.png")
       Toast.ToastMessageColor = fx.Colors.Green
       Toast.ToastShow3(
    "This is a Toast with message and icon",icon)
    End Sub

    Sub b4_MouseClicked (EventData As MouseEvent)
    Toast.ToastTitleColor = fx.Colors.Cyan
    Toast.ToastMessageColor = fx.Colors.Yellow
       Toast.ToastShow4(
    "Title","This is a Toast with title, message and icon",Toast.TOAST_SUCCESS_ICON)
    End Sub

    Sub b5_MouseClicked (EventData As MouseEvent)
    Toast.ToastTitleColor = fx.Colors.Blue
       Toast.ToastShow5(
    "Title and icon",Toast.TOAST_ERROR_ICON)
    End Sub

    Sub b6_MouseClicked (EventData As MouseEvent)
       Toast.ToastShow6(Toast.TOAST_INFO_ICON)
    End Sub

    Sub MainForm_CloseRequest (EventData As Event)
       Toast.ToastStop
    End Sub
    Any comment or any suggestion will be appreciated.


    Author of the original class is (Gerrit Grunwald)

    I made a lot of changes to make it the same like android Toast.


    Any error u find please report to me.
     

    Attached Files:

    Last edited: Mar 8, 2014
  2. Theera

    Theera Well-Known Member Licensed User

    Hi Giuseppe Salvi,
    Is there version for B4A? I more like it.
     
    inakigarm likes this.
  3. magoandroid

    magoandroid Member Licensed User

    Grazie 10^3, Giuseppe.
    Ottimo lavoro, sicuramente utile.

    MAgo
     
  4. Erel

    Erel Administrator Staff Member Licensed User

    Looks great. Toast messages are really useful. Thank you!
     
  5. lonleystar

    lonleystar Well-Known Member Licensed User

    Hi Theera, yes it´ll come sooon.
     
    Theera likes this.
  6. lonleystar

    lonleystar Well-Known Member Licensed User

    Ciao Magoo, Grazie a te per i complimenti.

    Hi Mago thanks to u for the compliments.
     
  7. lonleystar

    lonleystar Well-Known Member Licensed User

    Hi Erel, Thanks to U, I would like that in the new release of B4J this little library is integrated in to the IDE if it is possible.

    let me know.
     
  8. Erel

    Erel Administrator Staff Member Licensed User

    Maybe in the future...
     
  9. aklisiewicz

    aklisiewicz Active Member Licensed User

    I agree, it would be nice to have it as standard
    Arthur
     
  10. Pascual Pérez

    Pascual Pérez Member Licensed User

    Great work, very useful, thank you very much.
     
  11. JakeBullet70

    JakeBullet70 Well-Known Member Licensed User

  12. lonleystar

    lonleystar Well-Known Member Licensed User

    Thanks to every body i´ll be soon be patience.
     
  13. micro

    micro Well-Known Member Licensed User

  14. lonleystar

    lonleystar Well-Known Member Licensed User

    Hi Guys, the v1.1 of ToastMessageShow is released.

    What´s new:


    ToastNotificationOwner = MainForm (this is important to anchor the toast in main form so it´ll not show the message out of the main form.)

    ToastIconSize16x16 (will show the icon with this size )
    ToastIconSize24x24 (will show the icon with this size )
    ToastIconSize32x32 (will show the icon with this size )
    ToastIconSize40x40 (will show the icon with this size )
    ToastIconSize48x48 (will show the icon with this size )


    ToastMessageColor = fx.Colors.White (changes the color of the message)

    ToastTitleColor = fx.Colors.Cyan (changes the color of the title)

    and some bug fixed.

    just download and enjoy.

    any thanks will be appreciated
     
    magoandroid and Pascual Pérez like this.
  15. magoandroid

    magoandroid Member Licensed User

    Grazie Giuseppe.
     
  16. lonleystar

    lonleystar Well-Known Member Licensed User

    grazie a te magoandroid
     
  17. JTmartins

    JTmartins Active Member Licensed User

    Great Job.
    Thanks
     
  18. lonleystar

    lonleystar Well-Known Member Licensed User

    Thanks to u JTmartins.
     
  19. Sytek

    Sytek Active Member Licensed User

    Thank's Giuseppe
     
  20. lonleystar

    lonleystar Well-Known Member Licensed User

    Hi Sytek, thx to you, any comment anz idea please let me know.
     
Loading...
  1. This site uses cookies to help personalise content, tailor your experience and to keep you logged in if you register.
    By continuing to use this site, you are consenting to our use of cookies.
    Dismiss Notice