Level Extreme platform
Subscription
Corporate profile
Products & Services
Support
Legal
Français
Grid Headaches
Message
From
06/05/2015 19:54:53
 
 
To
06/05/2015 18:07:54
General information
Forum:
Visual FoxPro
Category:
Forms & Form designer
Title:
Environment versions
Visual FoxPro:
VFP 9 SP2
OS:
Windows 7
Network:
Windows 2008 Server
Database:
Visual FoxPro
Application:
Desktop
Miscellaneous
Thread ID:
01619483
Message ID:
01619484
Views:
104
This message has been marked as the solution to the initial question of the thread.
>Hi All:
>
>I put a grid on my form.
>
>Two problems:
>
>1. I can't set the color of the header. I drill down to 'Header1' in a particular column and set the fore color and backcolor to blue, with no effect. It works if I do it for the column, but I can't get it to work for the header.
>
>2. How can I allow the user to enter values in the cells? The grid I'm creating is based on a sql statement, with one column. I then add columns in the init thus:
>
>
>LOCAL lnColumns, i
>
>lnColumns = RECCOUNT('curCustomers') + 1
>this.grdOrders.ColumnCount = lnColumns
>
>i = 0
>
>SELECT curCustomers
>
>SCAN
>
>	i = i + 1
>	lcColumn = 'Column' + ALLTRIM(STR(i + 1))
>
>	this.grdOrders.&lcColumn..header1.Caption = desc
>	this.grdOrders.&lcColumn..header1.Wordwrap = .t.
>	this.grdOrders.&lcColumn..width = 75
>	
>ENDSCAN
>
>
>I can't enter data in the first column or in any other column.

Grid header colour: you can set it only if the Grid.Themes = .F.

Data entry in grid: The first question is whether you want to be able to save the values that users may enter into the grid. If so, the Grid.RecordSource needs to be updatable. The result of a type 4 query is not updatable.

Since you also need as many columns in the .RecordSource as you have grid columns, I'd be inclined to build an updatable cursor and use that to drive the grid. Use your SCAN loop to build a command something like
CREATE CURSOR SomeCursor ( Col1 C( 10 ), Col2 C( 10 ), ... )
Or, if you can use SELECT - SQL to create a cursor with one column per customer, you could add the READWRITE clause at the end to make it updatable.
Regards. Al

"Violence is the last refuge of the incompetent." -- Isaac Asimov
"Never let your sense of morals prevent you from doing what is right." -- Isaac Asimov

Neither a despot, nor a doormat, be

Every app wants to be a database app when it grows up
Previous
Next
Reply
Map
View

Click here to load this message in the networking platform