B4A Library MultiSelectSpinner V1.0.2

Discussion in 'Additional libraries, classes and official updates' started by DonManfred, May 1, 2015.

Similar threads

B4A Library IPCamView
B4A Library ChatMessageView
B4A Tutorial [java] Custom View with Designer Support (Java library)
B4A Library PanoramaImageView
B4A Library SnakeView
B4A Library msEmoji V1.0.0
  1. DonManfred

    DonManfred Expert Licensed User

    MultiSelectSpinner
    Author: Manfred Ssykor / DonManfred
    Version: 1.02
    • MultiSelectSpinner
      Events:
      • onItemSelected (position As Int, isChecked As Boolean, item As String)
      Fields:
      • ba As BA
      Methods:
      • AddToParent (Parent As ViewGroup, left As Int, top As Int, width As Int, height As Int)
      • BringToFront
      • DesignerCreateView (base As PanelWrapper, lw As LabelWrapper, props As Map)
      • Initialize (EventName As String)
      • Invalidate
      • Invalidate2 (arg0 As Rect)
      • Invalidate3 (arg0 As Int, arg1 As Int, arg2 As Int, arg3 As Int)
      • IsInitialized As Boolean
      • RemoveView
      • RequestFocus As Boolean
      • SendToBack
      • SetBackgroundImage (arg0 As Bitmap)
      • SetColorAnimated (arg0 As Int, arg1 As Int, arg2 As Int)
      • SetLayout (arg0 As Int, arg1 As Int, arg2 As Int, arg3 As Int)
      • SetLayoutAnimated (arg0 As Int, arg1 As Int, arg2 As Int, arg3 As Int, arg4 As Int)
      • SetVisibleAnimated (arg0 As Int, arg1 As Boolean)
      Properties:
      • Background As Drawable
      • Color As Int [write only]
      • Enabled As Boolean
      • Height As Int
      • Items() As String [write only]
        Set the Items for this MultiSelectSpinner
        Example:
        <code>msspinner.Items = Array As String("Apple","Banana","Coconut","Kiwi","Strawberry")</code>
      • Left As Int
      • SelectAllOnFirst As Boolean [write only]
      • SelectedIndicies As List [read only]
        Return a list with all selected indicies
      • SelectedItemsString As String [read only]
        Returns a comma separated String with all selected Items
      • SelectedStrings As List [read only]
        Return a list of selected items as Strings
      • Selection() As String [write only]
        Set the selected items by giving a array of strings
        Example:
        <code>msspinner.Selection = Array As String("Apple","Banana","Strawberry")</code>
      • SelectionByIndicies() As Int [write only]
        Set the slected idicies by giving a array of int
        Example:
        <code>msspinner.SelectionByIndicies = Array As Int(0,1,4)</code>
      • Tag As Object
      • Top As Int
      • Visible As Boolean
      • Width As Int


    [​IMG][​IMG]


    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) :)
    [​IMG]

    Known problems:
    - The Spinner is always in the middle of the screen. I actually dont know how to change this


    Example code used to build the two Screenshots
    Code:
    msspinner.Items = Array As String("Apple","Banana","Coconut","Kiwi","Strawberry")
        msspinner.Selection = 
    Array As String("Apple","Banana","Strawberry")
        
    Dim spitems(100As String
        
    For i = 0 To 99
            spitems(i) = 
    "Item "&(i+1)
        
    Next
        mss2.Items = spitems
     

    Attached Files:

    Last edited: May 3, 2015
  2. giga

    giga Well-Known Member Licensed User

    Nice contribution as usual DonManFred :)!!
     
  3. RauchG

    RauchG Active Member Licensed User

    Very good. I already donated
     
    DonManfred likes this.
  4. DonManfred

    DonManfred Expert Licensed User

    thank you very much Günter. Really appreciated :D
     
  5. johndb

    johndb Active Member Licensed User

    Just what I was looking for! Donated :)
     
    DonManfred likes this.
  6. DonManfred

    DonManfred Expert Licensed User

    Great to hear :)
    Thank you very much John. Really appreciated!
     
  7. johndb

    johndb Active Member Licensed User

    An update to this library which would be very useful would be to add an additional check-box above the list. When this check-box is selected, it would select all of the members and when cleared it would clear all of the members.

    Thanks,

    John
     
  8. DonManfred

    DonManfred Expert Licensed User

    Would it be ok to have the option to set SelectAllOnFirst to true and when set to true the first item in the list will act like you wish.
    The first item is ignored in the build "complete string"

    Code:
    msspinner.SelectAllOnFirst = True
        msspinner.Items = 
    Array As String("-----","Apple","Banana","Coconut","Kiwi","Strawberry")
        msspinner.Selection = 
    Array As String("Apple","Banana","Strawberry")
    [​IMG] [​IMG][​IMG]
     
    johndb likes this.
  9. johndb

    johndb Active Member Licensed User

    Yes, Manfred. That would be perfect :)
     
  10. johndb

    johndb Active Member Licensed User

    I have started to implement this lib in my app. The following would be useful if not essential:
    • Allow text size to be set in spinner. Designer setting has no effect. Popup text size is ok.
    • Allow text color to be set in spinner. Designer setting as no effect. Popup text color is ok.
    • Provide an event when popup closes. This is required to apply an action when the list is modified.
    Thanks for all of your hard work Manfred.

    John
     
    Last edited: May 3, 2015
  11. DonManfred

    DonManfred Expert Licensed User

    It cannot be changed in this library. Internally it is using a Native Alert-Dialogbuilder which has only one Fontsize.
    Same here. The native alertdialog does not expose a Color property

    This should be possible. I´m just trying to implement this
     
    Peter Simpson likes this.
  12. DonManfred

    DonManfred Expert Licensed User

    Sadly the event when popup is closed does not work as the library is using a Dialog builder but not using any Buttons to set the positive or negative answers.
    This does not work somehow.

    But i exposed an ItemClicked event
    Code:
    Sub msspinner_onItemSelected(position As Int, isChecked As Boolean, item As String)
        
    Log("_onItemSelected("&position&","&isChecked&","&item&")")
    End Sub
    Library is updated to V1.0.2 (See Post #1)

    Changes:
    - Added a boolean flag
    Code:
    msspinner.SelectAllOnFirst = True
    If this is set to true then the first item will (de-)select all Items. In the build complete-String of all Selected items the first item will not be included in this case.
    - Added itemselected event
    Code:
    Sub msspinner_onItemSelected(position As Int, isChecked As Boolean, item As String)
        
    Log("_onItemSelected("&position&","&isChecked&","&item&")")
    End Sub
     
    Peter Simpson likes this.
  13. johndb

    johndb Active Member Licensed User

    There appears to be a problem with the "select all ..." feature. Successive selection of the first item requires multiple "back key" presses in order to exit the selection process.
     
  14. DonManfred

    DonManfred Expert Licensed User

    Will check this tomorrow
     
    johndb likes this.
  15. maleche

    maleche Member Licensed User

    can you set it for single selection? When the user selects another checkbox, any previous checks will become unchecked automatically?
    Thanks!
     
  16. DonManfred

    DonManfred Expert Licensed User

    Sounds not logically for me to set single selection to a MultiSelectSpinner.
     
    Peter Simpson and LucaMs like this.
  17. LucaMs

    LucaMs Expert Licensed User

    You're right, Speedy, but you might want it allows a single selection on the basis of a given state.
     
  18. johndb

    johndb Active Member Licensed User

    A standard spinner would be used to select a single item. This library is used for multiple selections.

    John
     
  19. LucaMs

    LucaMs Expert Licensed User


    If it is possible, why not increase its functionality?

    Multi selection? Multi function.
    If I had only one view which, based on a few parameters, serve as EditText, Label, Spinner, etc. I would not cry :)
     
  20. johndb

    johndb Active Member Licensed User

    Is there any update on correcting this issue?

    Thanks,

    John
     
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