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!

Why Does The Builder Change My Grid To A "Read Only Control" 1

Status
Not open for further replies.

drosenkranz

Programmer
Sep 13, 2000
360
US
Hello Again,

I have a form with a grid on it. The dataenvironment has a local view which works fine when the select statement was started as "Select *...". THE DATA IS STILL EDITABLE AT THIS POINT

I used the grid builder to change the order of the fields as they appear in the column but the fields still appeared in the same order as before, but the column headers were in the correct order. The CaseID column now had a date instead of the case...etc.

I rewrote the Select statement with the fields in the order I had designed the builder columns and everything came out alligned correctly. The problem is that I can not edit any data in the grid anymore. The .ReadOnly property of my grid is set to false. If I create a second (new) grid and link it to the local view, I can edit the data there.

Any info on what's causing (or how) the the "Builder" changed my original grid so I can no longer edit the data that appears in it?

As Always, Thank you all very much.
The 2nd mouse gets the cheese.
 
Hi!

Look to ReadOnly, ControlSource properties of the column and control inside of column. If you want columns appear in the different order than fields in the record source, you require to open the record source before grid initialization (either in the data environment or in the Load method of the form). Also record source should be assigned in design time and columnscount should be greater zero. If your view have parameters, open it without data, that requery with parameters as soon as you have them (usually, Init method of the form).

Grid could be read-only if it is based on the SQl Statemet. the result of any SQL Statement in VFP is a read-only cursor. Grid becomes read-only automatically when record source is read-only. This way is rarely used because a lot of troubles. Better use a view in the databas that you open as a table. Views are specially useful for data editing for the subset of the data from teh main table.

More about grid reconstruction you can read at the Search for FAQ article "Grid Reconstruction"

Vlad Grynchyshyn
vgryn@softserve.lviv.ua
The professional level of programmer could be determined by level of stupidity of his/her bugs
 
Hey There Vlad,

Thanks for the response. Are you telling me that I should use the table instead of the view in the dataenvironment, and just change the filter condition on the table?

Will this technique (set filter) cost me in the performance of this form if the table is very large?

Any info on a better approach here would be appreciated. I haven't used FoxPro since version 1.? (circa 1992) multiuser mfoxplus in DOS. I'm not up to speed on the ins and outs of VFP yet.

Thanks again for all your time my friend.
The 2nd mouse gets the cheese.
 
Hi!

No, the view is just fine. I tried to explain why it may be read-only and all things related with use of views for grid.

I really do not use builder at all for grids and set all properties manually.


Vlad Grynchyshyn
vgryn@softserve.lviv.ua
The professional level of programmer could be determined by level of stupidity of his/her bugs
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top