how come all the products are shown with the same indent as categories? i tried to add '.....' before every product to increase the indent, it looked soo ugly.
btw, i tried the example code in delphi help, very samilar code with mine, but it didnt generate this problem.
can any one help me with this plz?
- Code: Select all
procedure TfrmProduct.btnShowAllProductsClick(Sender: TObject);
begin
TreeView1.Items.Clear;
Category.IBQueryCategory.First;
while not Category.IBQueryCategory.Eof do
begin
TreeView1.Items.Add(nil, Category.IBQueryCategoryNAME.AsString);
Product.IBQueryProduct.Open;
Product.IBQueryProduct.First;
while not Product.IBQueryProduct.Eof do
begin
if Product.IBQueryProductCATEGORYID.AsString = Category.IBQueryCategoryCATEGORYID.AsString then
begin
TreeView1.Items.AddChild(nil, Product.IBQueryProductNAME.AsString);
end;
Product.IBQueryProduct.Next;
end;
Category.IBQueryCategory.Next;
end;
end;