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 Chris Miller on being selected by the Tek-Tips community for having the most helpful posts in the forums last week. Way to Go!

Multi-line Grid

Status
Not open for further replies.

Paco75

Programmer
Oct 11, 2001
239
US
Hi,

I want to know how to put more than one line into a grid's row? Actually a grid is like this:

Code:
*******************************
* header1 * header2 * header3 *
*******************************
* field1  * field2  * field3  *
*******************************
* field1  * field2  * field3  *
*******************************
*  ...    *  ...    *  ...    *
*******************************
what im looking for is like this:

Code:
*******************************
* header1 * header2 * header3 *
* header4 * header5 * header6 *
*******************************
* field1  * field2  * field3  *
* field4  * field5  * field6  *
*******************************
* field1  * field2  * field3  *
* field4  * field5  * field6  *
*******************************
*  ...    *  ...    *  ...    *
*******************************

I want to do this because im limited in screen width and i must display a grid with too many fields to fit in the screen.

thanks
 
The native grid was not built to do that.

You might look around for 3rd party ActiveX grids which offer more flexibility, but I don't recall seeing one that will do what you want.
 
if you do a Google search for: vfp multi-line grid you will find a number of 'finds' - mostly 3rd party possibilities.

Perhaps something there will do what you need to get done.

Good Luck,
JRB-Bldr
 
There is no real multi-line grid, but a way to get this nevertheless is to exchange the control of the grid cell from the normal textbox to a container with several controls.

In extreme you'd have one container class for a whole record. You put all controls resembling a full record in the container, layouted as you like in multiple lines or whatever. Then define a grid with just one column and set it's currentcontrol to that container, which you add to the grid via grid.addobject() or visually at design time (which is a little hard to describe).

Consequently you'd only have one header. You can also do that with many columns of course, needing a container with two textboxes, one on top of the other.

Binding the Controlsources to grid columns is a bit harder then, as the grid will bind to the container, which in itself has no controlsource and value, of course. But the container controls can be bound to the grid recordsource alias and that will work, too, even if the grid column isn't bound to anything at all, the grid always scans it's recordsource records and renders a line for each record, and that also works with a container as currentcontrol.

Bye, Olaf.
 
I have done this.

I have a multi-line grid class. It has one column. The column contains a container object, and the container contains several labels and images, spread over two lines.

The effect is quite attractive, but the overall design is clumsy, and it needs several steps just to populate the grid. In my case, the grid is read-only, which simplifies things a little, but it is still awkward to use.

I haven't used the multi-grid for quite a while now. In my recent projects, I have favoured a third-party grid control. Paco, I would suggest you do the same.

Mike

__________________________________
Mike Lewis (Edinburgh, Scotland)

Visual FoxPro articles, tips, training, consultancy
 
Ok thanks i will look 3rd party grid controls availiable.
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top