Tek-Tips is the largest IT community on the Internet today!

Members share and learn making Tek-Tips Forums the best source of peer-reviewed technical information on the Internet!

  • Congratulations biv343 on being selected by the Tek-Tips community for having the most helpful posts in the forums last week. Way to Go!

Grid layout problem 2

Status
Not open for further replies.

Harulem

MIS
Mar 26, 2004
8
BE
Sometimes, the layout of some of my grids change when their datasources are modified. The grid's display switch to the one I'll get if the header's caption and columns width were set to default. Header's captions become the name of the table fields used as datasource, and columns width are scaled to the variables contained in the corresponding fields.
In the present case, the Grid is used to display components from a stock, and the user can choose between various filter (using combo boxes) to access the data more quickly.
The grid, initialy blank, is displayed correctly at the beginning.
The first use of the filters also works fine, the components selected fill the grid's datasource, and the grid keeps it intended display. But from then, if the filters are changed, the grid seems to loose it's settings. The targeted components are displayed, but the grid's headers and columns width get messed up as stated above. Futhermore, the methods associated to the grid's headers are lost (in my case the feature of ordering by ascending or descending value of one variable simply by clicking the column's header).

Any ideas as to what causes the problem?
Thanks in advance.


Pierre Carabin
 
Harulem

What you are experiencing is 'grid reconstruction'.

One way of ensurng that your grid appears the same after data processing is to rebuild it in code, such as
Code:
[COLOR=blue]WITH THISFORM.grid1
[tab].Recordsource = []
[tab][/color][COLOR=green]&& Process data[/color][COLOR=blue]
[tab].RecordSource = [TABLENAME]
[tab].Column1.ControlSource = [TABLENAME.field1]
[tab].Column2.ControlSource = [TABLENAME.field2]
[tab].Column3.ControlSource = [TABLENAME.field3]
ENDW[/color]
You may also need to redefine column widths, header captions, etc.

FAQ184-2483 - answering getting answered.​
Chris [pc2]
PDFcommandertm.com
PDFcommandertm.co.uk


 
harulem,

please check out faq184-937 and faq184-1813; both discusses ways on how to avoid grid reconstruction.

hope this helps. peace! [peace]

kilroy [trooper]
philippines

"Illegitimis non carborundum!"
-Gen. Joseph Stilwell
 
Thanks Chris, that was fast and very helpful, the problem is gone !

Pierre carabin
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top