is it possible in basic 4 ppc?

aru

Member
Hi,
I have Two List Box
1)country
2)states

when i select a country I want To List out states in that country

is it possible in basic 4 ppc?

Can you Help me?:sign0085:
Aru
 

mjcoon

Well-Known Member
Licensed User
Assuming you really do mean ListBox, I don't see why not.

(It is slightly confusing that all the Help items for ListBox methods use "ComboBox1" as the name for the example ListBox. Hopefully this is just copy-and-paste overkill. I don't know what the actual difference between a ComboBox and ListBox is. The Help for ComboBox specifically says there is no "Text" property, but then ListBox doesn't have one either!)

So if you have your list of state names you first clear the Listbox (ListboxState.Clear) then add the names (ListboxState.Add(stateName(i)).

What was the problem?

HTH, Mike
 

klaus

Expert
Licensed User
Longtime User
The differences between ComboBoxes and ListBoxes are:
ListBox shows a list and the selected item is highlighted.
ComboBox is a drop down list, it shows only the selected item.
ListBox does't have a Textbox included
ComboBox has one:
On the desktop it works.
On the device it does'n work by default.
But this can be changed with the Door library.
The ComboBox has a property 'DropDownStyle'
'DropDown' without TextBox.
'DropDownList' with the TextBox.
On the desktop the default is 'DropDownList'
but unfortunately on the device the default is 'DropDown'
This property can be changed with the Door library.

Attached a small test Program.
I don't know if the Door library is part of the standard libraries accessible also to non registered users.

Best regards.
 

Attachments

  • CombBoxTest.sbp
    3.6 KB · Views: 227

mjcoon

Well-Known Member
Licensed User
I don't know if the Door library is part of the standard libraries accessible also to non registered users.

Thanks for that explanation Klaus. (Meaning that if I ever need that feature I shall have to study it properly!).

Is your mention of "TextBox" the same as the "Text" property that I cited the Help as mentioning? Also, it seems to me that the deviant behaviour on the device is a bug and should have been reported in the Bugs forum. And/or explained in the Help and tutorials...

In a program that I have been working on I wanted to offer a set of date formats but still be able to type my own (different punctuation, perhaps). So I put a ComboBox behind a TextBox with just the drop-down arrow showing. If you click on that arrow the offered set shows in the ComboBox, temporarily in front of the TextBox. The chosen format gets copied into the TextBox but can now be edited.

Mike.
 

klaus

Expert
Licensed User
Longtime User
Hi Mike,
B4X:
Is your mention of "TextBox" the same as the "Text" property 
that I cited the Help as mentioning?
Yes, with the DropDownType property set to DropDownList the ComboBox becomes a combination of a drop down list and a text box.
By the way, on the device with the DropDownType property set to DropDown the Text property is readable but not editable.

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