views:

46

answers:

1

hi anybody i have a win application project that should be done in delphi2010. in a form something like the image below,should be produced: www.up.iranblog.com/Files2/1e867ce0de784c469496.jpg first the image of product and under that tha name and the price. the information should be read from a xml file,but i dont know how to display the information in dbctrlgrid.please help thanx in advance

+2  A: 

For DBCtrlGrid, it is just like a normal panel control. The difference is, it creates this panel for every record in your dataset. So you should put your data-aware or ordinary controls in the panel anyway you like, and your panel will be automatically repeated for each record in the dataset, and if the controls on your panel are data-aware, then they will receive data of the connected fields for each corresponding record. You can check DBCtrlGrid entry in Delphi help for more information.

If you want to use DBCtrlGrid for presenting your XML data, then you should first present your XML data as database records. To do so, you should first create a XML transformation file using XML Mapper tool. After that, you can use a XMLTransformProvider control, and connect it to your transformation file, and your XML data. XMLTransformProvider would transform your XML data to database records using the provided transformation file.

Now you can connect a ClientDataset to your XMLTransformProvider, and your XML data would be available in your ClientDataset as database records. You can connect a DataSource to your ClientDataset, and connect your DBCtrlGrid to that datasource, so that your DBCtrlGrid control would present the data available in ClientDataset.

So the data flow is somehow like this:

XML Data -- (Transformed to database records) --> Data Provider --> ClientDataset --> DataSource --> Data-aware controls (e.g. DBCtrlGrid).

P.S. From your provided link, it seems you are located in Iran. To follow the provided links which refer to Delphi's online documentation, be aware that Embarcadero does not like anybody located in Iran access most parts of their website, including their online documentation, EDN, their blogs, Quality Central, and Code Central. So if you try to open these links using an IP located in Iran, the web pages won't load! You can read the same documentation from Delphi's installed help files. Just drop each component on the form, and press F1.

vcldeveloper