B4i Library iComboBox - Easy way to put combo in your B4i apps

iComboTop.png


Installation instructions:

- Copy the *.a and *.h files into the folder "Libs" in your MAC or in your MAC HOSTED by AnywhereSoftware, normally in "B4i-MacServer\Libs" folder

-Copy the iComboBox.xml to your custom libraries folder in B4i
- Select in your REFERENCED LIBRARIES
RefiCombo.jpg


Version history:
V1.0.0 (First public release):
- Initial version

V1.0.2
- New method to move combo after initialized (.moveCombo(x,y,width,height)

V1.0.3
- New methods:
* SetText
* SetPlaceHolder

V1.0.4

Obs: From this version is not necessary replace the libraries to convert to the FULL VERSION, now by simply put your license in the LicenseKey and LicenseEmail in appropriate properties.

- New methods:

* ColorBackground
* SetTextWithColor
* SetPlaceHolderWithColor

* LicenseEmail
* LicenseKey
* LicenseShow

CHECK NEW EXAMPLE ATTACHED IN HERE: ExampleWithLicenseKey.zip



iComboBox
Author:
Alberto Iglesias ([email protected])
Version: 1.0.2
  • iComboBox
    Events:
    • onInitialized (EventName As String)
    • onSelected (itemName as String )
    Methods:
    • AddSection (SectionName As String, MenuItens As Array)
      Add a section to combo with itens
    • ColorHeadSection (Rt As Int, Gt As Int, Bt As Int, Rb As Int, Gb As Int, Bb As Int)
      Set the colors of Head Section
    • Initialize (EventName As String, defaultPlaceHolder As String, x As Int, y As Int, width As Int, height As Int, expandHeight As Int, allowFiltering As BOOL, iconArrow As NSString*)
    • moveCombo(x AsInt, y AsInt, width AsInt, height AsInt)
      Initializes the object.
    • Show (Parent As B4IPage*)
      Show the Combo
    Properties:
    • Author As String [read only]
      Author of this Library
    • DebugMode As BOOL
      Enable/Disable Debug mode from Library
    • LastItemChoosed As String [read only]
      Last Title of Item Choosed
    • LastSectionChoosed As String [read only]
      Last Section Name Choosed
    • NameIdentifier As String [read only]
      Name of Combo Identifier
    • SectionTitleEnable As BOOL
      Enable/Disable Title of Section
    • UUID As String [read only]
      UUID Identifier
    • Version As String [read only]
      Library Version
    • borderWidth As Int
      Width of Combo border

B4iShotCombo.jpg




 

Attachments

  • Example1.zip
    23.6 KB · Views: 117
  • Example2.zip
    49.4 KB · Views: 100
  • Example4Move.zip
    67.4 KB · Views: 45
  • iComboBox103.zip
    282.5 KB · Views: 61
  • iComboBox v1.0.4.zip
    229.2 KB · Views: 103
  • ExampleWithLicenseKey.zip
    50.3 KB · Views: 67
Last edited:

abarnett

Member
Licensed User
Longtime User
Alberto, Great combobox.

What is the best way to move the box once it is created. I rearrange the views based on the orientation of the device.

Thanks
Andrew
 

Derek Johnson

Active Member
Licensed User
Longtime User
Hello Derek,

Can you try this beta version? Now with Return event, I mean, when you type and pulse ENTER, works like choose a list item.


Alberto Iglesias

Alberto

I still have the issue in testing your updated library but I have a couple of further observations.

If you rotate a device there seems to be no way to correctly reposition/resize the combo box. There is also no way to remove the object from a page (except by showing it on another page).

There is no IsInitialized property.
Perhaps the Initialize method should remove previous instances of the object.

Finally what is the mechanism for removing the nagware messages from production apps? I can't see how this would work for hosted versions of the Library.

Thanks for creating this, it looks very promising.

Derek
 

abarnett

Member
Licensed User
Longtime User
Hi Alberto, i'm still getting an error with the move command, also is there a way to prepopulate the edit box within the combo

Thanks
 

Derek Johnson

Active Member
Licensed User
Longtime User
abarnett,

I've created this workaround for myself to deal with the issue of not being able to move the combo box when the device is rotated.

B4X:
Sub Process_Globals
    'These global variables will be declared once when the application starts.
    'Public variables can be accessed from all modules.
    Public App As Application
    Public NavControl As NavigationController
    Private Page1,Page2, Page3, HiddenPage As Page
    Dim Combo1 As iComboBox
    Dim Combo1_IsInitialised =False As Boolean
    Dim ComboNotNeeded as  Boolean
    Dim gCombo1AreaSelected As String 'Tracks item that is selected
End Sub

Private Sub Application_Start (Nav As NavigationController)
.....
HiddenPage.Initialize("Hidden")
...
End Sub

B4X:
'Call this when you want to re-display the combo box after a rotation for instance
Sub ShowCombo(MyPage As Page)

    If Combo1_IsInitialised Then 'remove evidence of it from the current page
        'Since we can't get rid of it - show it on another unused page
       'These will accumulate when the device is rotated!
        Combo1.Show(HiddenPage)
    End If
    If ComboNotNeeded Then
        Return
    End If
 
    'Now re-draw the combo box
    Combo1_IsInitialised=True
    gCombo1AreaSelected=""
    Combo1.DebugMode = False
   'Get positioning and size of combo-box from other elements on the same page (These will have been moved/re-sized by the rotation event)
    Combo1.Initialize("Combo1","Select Area",txtCardNumber.left, lblSpinner.top,Min(txtCardNumber.width,300), txtCardNumber.Height, 60%y, False, File.DirAssets & "/arrow.png" )
    Combo1.SectionTitleEnable=True
    Combo1.ColorHeadSection(240,240,240,180,180,180)
 
'(Re) Initialise combo contents from a list
    Dim AreaList() As String, i As Int
    AreaList=Regex.Split(",",gAreaCSVList)
    Dim Items As List
    Items.Initialize
  
    For i=0 To AreaList.Length-1
        Dim tempIcon1 As typeIcon , FileName  As String
        tempIcon1.IconLabel  = AreaList(i)
'Icon based on first letter of AreaList item
        FileName = AreaList(i).SubString2(0,1) & ".png"
        tempIcon1.ImagePath = File.Combine(File.DirAssets,FileName.ToLowerCase)
        Items.Add(tempIcon1)
    Next

    Combo1.AddSection("Select Area",Items)
    Combo1.Show(MyPage)


End Sub

Sub Combo1_onSelected(itemName As String)
    gCombo1AreaSelected=itemName
End Sub

It would be nice to hear back from Alberto with a better solution though! :)
 
Last edited:

abarnett

Member
Licensed User
Longtime User
Alberto, is there any way to change the selected text colour in the combo box, it seems to be gray not black. Actually black default would be better.

Thanks
Andrew
 

abarnett

Member
Licensed User
Longtime User
Just for information, Alberto's iComboBox has resolved a couple of its issues

Andrew
 

JonPM

Well-Known Member
Licensed User
Longtime User
I keep getting Class not found error with v1.03:

B4X:
Copying updated assets files (3)
Error occurred on line: 0 (Main)
Class not found: B4IComboBox
Stack Trace: (
  CoreFoundation       <redacted> + 154
  libobjc.A.dylib      objc_exception_throw + 38
  CoreFoundation       <redacted> + 0
  iComboBox            -[B4IShell createObject:] + 206
  iComboBox            -[B4IShell raiseEventImpl:method:args::] + 1832
  iComboBox            -[B4IShellBI raiseEvent:event:params:] + 1332
  iComboBox            -[B4IStaticModule initializeModule] + 530
  iComboBox            -[b4i_main initializeStaticModules] + 88
  iComboBox            -[B4IShellBI raiseEvent:event:params:] + 230
  iComboBox            __33-[B4I raiseUIEvent:event:params:]_block_invoke + 74
libdispatch.dylib    <redacted> + 10
libdispatch.dylib    <redacted> + 22
libdispatch.dylib    <redacted> + 254
CoreFoundation       <redacted> + 8
CoreFoundation       <redacted> + 1300
CoreFoundation       CFRunLoopRunSpecific + 522
CoreFoundation       CFRunLoopRunInMode + 106
GraphicsServices     GSEventRunModal + 138
UIKit                UIApplicationMain + 1136
iComboBox            main + 108
libdyld.dylib        <redacted> + 2
)
Application_Start
Application_Active

I have verified that I have copied the .a and .h to my local MAC server Libs folder, and the XML to the B4i folder. It shows up under Libraries and I have it selected.
 

Ross Woodward

Member
Licensed User
Longtime User
Thanks Alberto,

Thank you also for adding the feature as requested!
Recommend this icombox, mainly because for the filter option!
 

stanmiller

Active Member
Licensed User
Longtime User
Fellow iComboBox users, what is the procedure for obtaining a license key to iComboBox? I have donated and received a link from PayPal to the old library, version 1.03. I would like to use version 1.04.

I sent a note to Alberto requesting a license key and he replied with a link to the 1.04 library. I updated to that library but I'm still prompted that the library is not registered. I am using the hosted building service.

Thank you...
 
Top