B4A Library [Library] ComboBox

HotShoe

Well-Known Member
Licensed User
Longtime User
@peacemaker Try this version. It should now resize or reposition as needed.

Version 1.25 linked in first post.

--- Jem
 

lucdrb

Active Member
Licensed User
Longtime User
Hi,

I like the way you made your combobox but I don't understand how you retrieve the text entered by the user into the combobox.
I want to make a new list in adding the new text into it.

Thank in advance

Luc
 

HotShoe

Well-Known Member
Licensed User
Longtime User
Luc,

It does not add anything automatically. You would have to use additem or additemat to add to the list.

--- Jem
 

lucdrb

Active Member
Licensed User
Longtime User
Ok thanks that what I guess but I can't see how you retreive the text entered by the user?
If it's simple, I usually don't see it

Luc
 

HotShoe

Well-Known Member
Licensed User
Longtime User
use the .text method.

--- Jem
 

lucdrb

Active Member
Licensed User
Longtime User
Hi Jem,

Thank you for your reply but the silly think is that I don't see in which event should I put the .text method to retrieve the text entered.

Thanks in advance
Luc
 

HotShoe

Well-Known Member
Licensed User
Longtime User
Oh, I see what you are saying. Yeah, there is no event for the text box changing. I use a button or some other method on forms to save data and that's where I check the value. I will add an onchange type event to it. I had not really thought about using it to add new items, but that is not a bad use.

--- Jem
 

lucdrb

Active Member
Licensed User
Longtime User
Thanks for your reply and for your work on the combobox, I'll use it like you and wait for the new event.

Luc
 

lucdrb

Active Member
Licensed User
Longtime User
Hi Jem,

Strange behavior, I use a combobox who is linked into a panel which is linked into a tabhost who is into an activity.
When I open the combobox the list is not displayed under the textfield but over it (It's think that the coordinates(top,left) are reported on the activity in place of the panel).

Screenshot under (I think that a picture is more explanatory than my english ).

Regards
Luc

 

HotShoe

Well-Known Member
Licensed User
Longtime User
Thanks, I'll look at this later

--- Jem
 

HotShoe

Well-Known Member
Licensed User
Longtime User
Lucdrb, try version 1.26 attached to the first post. the source and test project is now included in that file.

Thanks,

--- Jem
 

udg

Expert
Licensed User
Longtime User
Hi Jem,

thank you for this much needed component.
May I suggest the addition of a simple ReadOnly property? It should default to False so everything stays unchanged, but setting it to True causes the ComboBox to become a "selection" box.
My usage will be to load a few values in the dropbox list, select one as "default" (so it's displayed in the CB) and finally show the CB; this way the user is necessarily forced to select one of the proposed alternatives.
Functionally similar to a radiobox but CB-style.

Another point could be the use of a MaskEditText instead of an EditText, but this will probabily take us too far from this lib initial goal.

Umberto
 

HotShoe

Well-Known Member
Licensed User
Longtime User
Version 1.27 has been added.

NOTE: This version WILL require you to change your code if you allow editing of the text box!

Added a ReadOnly property. This property defaults to TRUE, so if you need the user to be able to edit or type in the text box, set ReadOnly = False as soon as the ComboBox is initialized. If ReadOnly is not changed, or is set to True, the user MUST select an item from the dropdown list, and it cannot be changed unless they select another item from the list.

--- Jem
 

udg

Expert
Licensed User
Longtime User
Hi Jem,

thank you so much for the update.
The only thing I would have done differently is the ReadOnly property default value. Setting it as False as default would have had no impact on existing code. But you surely had your good reason to have done it the other way aroud, so don't bother with this.

Umberto
 

HotShoe

Well-Known Member
Licensed User
Longtime User
You are right, but in my mind at least, a combobox is for selections from the list and not as an active edittext. That said, since the source is included, all that need be done is to change :

ComboEdit.Enabled = False to ComboEdit.Enabled = True

in the Initialize method of the MLComboBox class. Or assign classname.ReadOnly = False after your layout is loaded or the cb is initialized. I hope it isn't too big a deal. If so I will change the default in an update.

--- Jem
 

udg

Expert
Licensed User
Longtime User
You are right, but in my mind at least, a combobox is for selections from the list and not as an active edittext.
--- Jem
That's the way I generally use a combobox too, so I wholeheartedly agree with you.
My suggestion for the ReadOnly initial state was due to my concern not to break existing users' code with the introduction of the new property.

Umberto
 

Myr0n

Active Member
Licensed User
Longtime User
HotShoe,

Thank you so much for this wonderful ComboBox.
 

stanks

Active Member
Licensed User
Longtime User
is there ItemLongClick Event or maybe one response from image view and another from label? what about visible or disabled property?

thanks
 
Last edited:

HotShoe

Well-Known Member
Licensed User
Longtime User
is there ItemLongClick Event or maybe one response from image view and another from label? what about visible or disabled property?

thanks

There is not, but I will add longclick event over the weekend. If the dropdown box is open then the DropShowing property will = True.

--- Jem
 
Cookies are required to use this site. You must accept them to continue using the site. Learn more…