B4J Library [B4X] [XUI] SD_xComboBox

At the request of my friend @Mashiane , I created a combobox that has the graphics of my IconTextView that is Multiplatform (B4X, B4J, B4i)

SD_xComboBox

Author:
Star-Dust
Version: 0.06
  • SD_xComboBox
    • Events:
      • ItemClick (Position As Int, Value As String)
      • OpenList
    • Fields:
      • ItemHeight As Int
      • mBase As B4XView
      • Tag As Object
    • Functions:
      • Add (Text As String, ReturnValue As Object)
        Add Item
      • AddAll (L As List)
        Add List of Item, Return Value is a Text
      • Clear
      • CloseDropDown
      • DesignerCreateView (Base As Object, Lbl As Label, Props As Map)
        Base type must be Object
      • GetBase As B4XView
      • GetItem (Position As Int) As String
      • GetValue (Position As Int) As Object
      • Initialize (Callback As Object, EventName As String)
      • OpenDropDown
      • RemoveIndex (Position As Int)
      • Size As Int
    • Properties:
      • Hint As String
      • HintFont As B4XFont
      • SelectedIndex As Int
      • SelectedTextItem As String
      • SelectedValueItem As Object
      • TextFont As B4XFont

1.gif
2.gif
 

Attachments

  • SD_xComboBox.b4xlib
    4.3 KB · Views: 5
Last edited:

Star-Dust

Expert
Licensed User
Update 0.02
  1. Fix bugs
  2. Added method: OpenDropDown and CloseDropDown
 

Star-Dust

Expert
Licensed User
Hi

Can you please add a SelectedItem property - with that one can get the selected item outside the item click event. I am assuming this can use the .SelectedIndex property is such has a get and a set.

eg.

B4X:
Dim y As String = SD_xComboBox1.SelectedItem

and perhaps

B4X:
SD_xComboBox1.SelectedItem = "ABC"

Only if possible.
Use ByValue.

B4X:
SD_xComboBox1.ByValue = "ABC"
 

Star-Dust

Expert
Licensed User
B4X:
Dim y As String = SD_xComboBox1.GetItem(SD_xComboBox1.SelectedItem)
 

Star-Dust

Expert
Licensed User
I will update the names of the methods that are misspelled by mistake
 

Star-Dust

Expert
Licensed User
Update 0.03
  1. Added: SelectedTextItem and SelectedValueItem (Read and Write mode)
  2. Eliminated ByValue method
 
Last edited:

Star-Dust

Expert
Licensed User
Update 0.04
  • Added the possibility to edit the text. Select the field from design
  • Fix bugs
 

Star-Dust

Expert
Licensed User
Update 0.06
  • Added OpenList event. It is raised when you click on the ComboBox and the list opens

Example to close the keyboard when the ComboBox is opened
B4X:
Private Sub SD_OpenList
    Log("Oper DropDown")
    #if B4A
        Dim Ph As Phone
        Ph.HideKeyboard(B4XPages.GetManager.GetTopPage.Parent.NativeType)
    #else if b4i
        ' B4XPage
        Root.As(NativeObject).RunMethod("endEditing:", Array(True))
        ' Normal
        Page1.RootPanel.As(NativeObject).RunMethod("endEditing:", Array(True))
    #End If
End Sub
 
Last edited:
Top