Combobox in editable table

Cableguy

Expert
Licensed User
Longtime User
The straight answer would be YES...
Take EREL's editable table and replace the textbox with a combobox, but would render ALL the edi fields to be a combobox....
 

rlkummer

Member
Licensed User
Editable table with textboes and comboboxes

Hi,

Thanks for your responses. I guess what I should have asked is, can I have some text boxes and some comboboxes in an editable table? If so, where do I insert the comboboxes in the code? I am trying to generate a data entry form that has both text boxes and comboboxes in the table.

TIA,

Ron
 

rlkummer

Member
Licensed User
Erel,

I've looked at editabletable2, but I'm new with Basic4ppc and am not sure where or how to change the code to have some columns be textboxes and some comboboxes. Any help would be greatly appreciated.

Ron
 

Erel

B4X founder
Staff member
Licensed User
Longtime User
It was not clear enough in my example.
B4X:
Sub App_Start
 ...
    EditableTable.SetEdit("Main.Table2","","Main.SetCombo")
End Sub

'column - Selected column
'combo - The combobox control that you should edit
'value - The value of the current selected cell
Sub SetCombo(column, combo, value)
    Control(combo,ComboBox).Clear
    Select column
        Case "Days"
            Control(combo,ComboBox).Add("Sunday")
            Control(combo,ComboBox).Add("Monday")
            Control(combo,ComboBox).Add("Tuesday")
            Control(combo,ComboBox).Add("Wednesday")
            Control(combo,ComboBox).Add("Thursday")
            Control(combo,ComboBox).Add("Friday")
            Control(combo,ComboBox).Add("Saturday")
            Control(combo,ComboBox).SelectedIndex = 0
            Return True
        Case "IsRainy"
            Control(combo,ComboBox).Add("True")
            Control(combo,ComboBox).Add("False")
            Control(combo,ComboBox).SelectedIndex = 0
            Return True
        Case Else
            Return False
    End Select
End Sub
First, when you call Editable.SetEdit, the third parameter should be the name of a sub that will handle the combobox and textbox.

Now in this sub (SetCombo in my example) we receive the column name and we decide if we want a textbox or a combobox.
If you want a combobox you should return true.
So we test the current selected column. If it is 'Days' or 'IsRainy' then we fill the combobox (that was passed as a parameter) with the values we need and return true.
Otherwise we return false.
Note that the names of the columns are case-sensitive.

I hope that it is more clear now.
 

rlkummer

Member
Licensed User
The light is coming on!

Erel,

Thanks! I didn't catch your link to the updated file at first. My dim light bulb is starting to get a little brighter. I think I can figure it out now.

Thanks a lot!

Ron
 
Top