troubleshooting Question

Regarding Express Grid Control - Combobox inside Express Quantum Grid detail record

Avatar of renjitkumar
renjitkumarFlag for India asked on
Delphi
12 Comments1 Solution1935 ViewsLast Modified:
Hi Folks ,

I have grid with a master - detail relationship  (Used Express VCL Quantum Grid ) the master table will have the record and the corresponding detail will be displayed below during master record expand detail will be shown and detail record has four columns and i am making it one of the column to be combo box by changing the custom edit properties.Now i want to populate the values inside the combo box based on the value of one of the master record column.My question is in which event i need to write the code to add data in the combo box.I am trying to write in the detail focussed record changed event is that right ?? I have provided the sample code below .Please advise me on this

Thanks in advance.
 
procedure TForm2.cxGrid1DBTableView2FocusedRecordChanged(
  Sender: TcxCustomGridTableView; APrevFocusedRecord,
  AFocusedRecord: TcxCustomGridRecord; ANewItemRecordFocusingChanged: Boolean);
const 
C_Query_New = 'select NewMethod from "C:\RAPID\RPFILES\PrintLocation.db4" where PrintLocationName = ''%0:s''';
var PrintLocation : String;
begin
try
(TcxComboBoxProperties(cxGrid1DBTableView2NEWMETHOD.Properties)).Items.Clear;
PrintLocation := GetPrintLocation(cxGrid1DBTableView1.DataController.GetDisplayText(cxGrid1DBTableView1Column3.DataBinding.DataController.FocusedRecordIndex,1));
showmessage(PrintLocation);
DBISAMQuery1.SQL.Clear;
DBISAMQuery1.SQL.Add(Format(C_Query_New, [PrintLocation]));
DBISAMQuery1.ExecSQL;
cxGrid1DBTableView2NEWMETHOD.PropertiesClass := TcxComboBoxProperties;
with TcxComboBoxProperties(cxGrid1DBTableView2NEWMETHOD.Properties) do
begin
if (DBISAMQuery1.RecordCount > 0) then
begin
while not DBISAMQuery1.Eof do
begin
(TcxComboBoxProperties(cxGrid1DBTableView2NEWMETHOD.Properties)).Items.Add(DBISAMQuery1.FieldByName('NewMethod').AsString);
DBISAMQuery1.Next;
end;
end;
end;
cxGrid1DBTableView2NEWMETHOD.DataBinding.FieldName := 'NEW METHOD';
DBISAMQuery1.SQL.Clear;
finally
FreeAndNil(DBISAMQuery1);
end; 
end;

end;
ASKER CERTIFIED SOLUTION
Ephraim Wangoya
Software Engineer

Our community of experts have been thoroughly vetted for their expertise and industry experience.

Join our community to see this answer!
Unlock 1 Answer and 12 Comments.
Start Free Trial
Learn from the best

Network and collaborate with thousands of CTOs, CISOs, and IT Pros rooting for you and your success.

Andrew Hancock - VMware vExpert
See if this solution works for you by signing up for a 7 day free trial.
Unlock 1 Answer and 12 Comments.
Try for 7 days

”The time we save is the biggest benefit of E-E to our team. What could take multiple guys 2 hours or more each to find is accessed in around 15 minutes on Experts Exchange.

-Mike Kapnisakis, Warner Bros