Combobox in editable table

Discussion in 'Questions (Windows Mobile)' started by rlkummer, Nov 19, 2008.

  1. rlkummer

    rlkummer Member Licensed User

    Is There a way to have an editable table with comboboxes?

    Ron
     
  2. Cableguy

    Cableguy Expert Licensed 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....
     
  3. Erel

    Erel Administrator Staff Member Licensed User

  4. rlkummer

    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
     
  5. Erel

    Erel Administrator Staff Member Licensed User

  6. rlkummer

    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
     
  7. Erel

    Erel Administrator Staff Member Licensed User

    It was not clear enough in my example.
    Code:
    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.
     
  8. rlkummer

    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
     
Loading...
  1. This site uses cookies to help personalise content, tailor your experience and to keep you logged in if you register.
    By continuing to use this site, you are consenting to our use of cookies.
    Dismiss Notice