i have used the delphi data binding wizard with my xml file, and everything compiles and runs fine.
I have 3 comboboxes on my form. Manufacturer, Model and Year.
Manufacturer is populated using the following code on FormCreate.
procedure TfrmMain.FormCreate(Sender: TObject);
var
RGearing : IXMLracegearingType;
i : Integer;
begin
// Load XML Document into Memory
RGearing := Getracegearing(XMLDocument1);
// Populate Manufacturer combobox
for i := 0 to RGearing.Car.Count-1 do
begin
cbManufac.Items.Add(RGearing.Car[i].Manufacturer);
end;
// Copy current selected Manufacturer to string variable
varManufac := cbManufac.ListItems[(cbManufac.ItemIndex)].Text;
end;
My question is how can i populate the Model combobox based on the current manufacturer that is selected.
Here is the XML File that goes with it
<?xml version="1.0" encoding="UTF-8"?>
<gearing>
<car>
<id>1</id>
<manufacturer>Ford</manufacturer>
<model>Test 1</model>
<year></year>
</car>
<car>
<id>2</id>
<manufacturer>Ford</manufacturer>
<model>Test 2</model>
<year></year>
</car>
<car>
<id>3</id>
<manufacturer>Honda</manufacturer>
<model>Test 1</model>
<year></year>
</car>
<settings>
<form_height></form_height>
<form_width></form_width>
</settings>
</gearing>
So if the manufacturer selected is Ford then the model combobox needs to display Test 1 and Test 2 as the items.
I can not see your function and the type
So I can only test it with the following code.
Go through the code and customize it to your needs.
To load xml from a file.
I hope this helps.