ygerdel Posted September 11, 2020 Share Posted September 11, 2020 Hi, I have a combobox with two columns (City - Code), it should show both columns but only save one of them (the city). This combobox is assigned as editor of a column in the dbgrid. I should also be able to write the name of the city in case it is not on the list. Using the combobox does not allow me to save only the name of the city because it takes the complete text (name and code) even though I do the following to separate the name of the city before saving: UniComboBox1.Text: = Trim (Copy (UniComboBox1.Text, 1, Pos ('-', UniComboBox1.Text, 1) -1)); I tried combobox and dbcombobox and they don't work for me. I can't use the LookUpCombobox because it should let me write the code in case it's not on the list. What are my options? I attach a test case. Regards, GridEditor-TestCase.zip Link to comment Share on other sites More sharing options...
dkeene Posted September 13, 2020 Share Posted September 13, 2020 Why is this not working? Link to comment Share on other sites More sharing options...
Sherzod Posted September 14, 2020 Share Posted September 14, 2020 On 9/11/2020 at 8:24 PM, ygerdel said: I have a combobox with two columns (City - Code), 15 hours ago, dkeene said: Why is this not working? Hello, Sorry for the late response. Can you make a simple testcase in VLC to see what you wanted? Link to comment Share on other sites More sharing options...
ygerdel Posted September 14, 2020 Author Share Posted September 14, 2020 8 hours ago, Sherzod said: Hola, Lo siento por la respuesta tardía. ¿Puedes hacer un caso de prueba simple en VLC para ver lo que querías? In VLC I cannot assign the combo as editor in the grid column. 1. Is there an option in the dblookupcombbox that allows me to enter and save something that is not in the list? 2. Is there any way that a dbcombobox or a combobox allows me to show 2 columns but save only one? Regards, 897261766 - AnyDesk 2020-09-14 10-55-20.zip Link to comment Share on other sites More sharing options...
ygerdel Posted September 15, 2020 Author Share Posted September 15, 2020 Hello, could you see the problem? Any ideas? Link to comment Share on other sites More sharing options...
Sherzod Posted September 15, 2020 Share Posted September 15, 2020 32 minutes ago, ygerdel said: could you see the problem? Hello, Sorry, not yet. I will check. Link to comment Share on other sites More sharing options...
Sherzod Posted September 15, 2020 Share Posted September 15, 2020 4 hours ago, ygerdel said: could you see the problem? Any ideas? Maybe something like this?: UniComboBox.ClientEvents.ExtEvents -> function select(combo, record, eOpts) { if (combo.getValue().indexOf('-')>-1) { combo.setRawValue(combo.getValue().slice(0, combo.getValue().indexOf('-')-1)) } } Link to comment Share on other sites More sharing options...
ygerdel Posted September 17, 2020 Author Share Posted September 17, 2020 This works perfectly. Thank you very much. 1 Link to comment Share on other sites More sharing options...
Recommended Posts
Please sign in to comment
You will be able to leave a comment after signing in
Sign In Now