Search code examples
delphidevexpressvcl

How to get the value of TcxComboBox in DELPHI 10.3.3


I hope I can get the answer that I want... I have read many things about it and found nothing So here is the thing I have a DBVERTICALGRID View that gets data from the database... (not important) when I press a button which is Called Edit_btn I turn the EditorRow to a ComboBox Using :

for I := 1 to Data_Sheet_.temp_Query.RecordCount do
    begin
     TcxComboBoxProperties(Job_ColorName.Properties.EditProperties).Items.Add(Data_Sheet_.temp_Query.FieldByName('Color_Name').AsString);
     Data_Sheet_.temp_Query.Next;
    end;
   Data_Sheet_.temp_Query.First;

And I get the proper result of populating the Combobox items by data in my database... then I wanna get the Value of the that is changed by the user... (Let's say the data was 'White', Now he wants to change it to 'Blue' From the ComboBox Items), And I did the proper setting on the EditorRow to make the OnChange procedure work... ... the problem arises when I wanna show the selected value in the ComboBox through :

procedure TBindingJobEdit_.Job_ColorNameEditPropertiesChange(Sender: TObject);
begin
 ShowMessage('HAHAHAH|'+' '+TcxComboBoxProperties(Job_ColorName.Properties.EditProperties).Items.Text);
end;

And I get all of the records in the database, But I only want the selected one like Red or Just Blue

All Records of my database


Solution

  • Here is the answer that I have found with the help of DevExpress Experts and Supporters you can see the full description in this link and here is the line of code

    procedure TBindingJobEdit_.Job_ColorNameEditPropertiesChange(Sender: TObject);
    begin
     ShowMessage('HAHAHAH|'+' '+TcxComboBox(Sender).EditValue);
    end;
    

    and the link to the Support Center