Welcome to Foxite.COM Community Weblog Sign in | Join | Help

Bernard Bout

May the Fox be with you...

<August 2008>
SuMoTuWeThFrSa
272829303112
3456789
10111213141516
17181920212223
24252627282930
31123456

Post Categories

Navigation

Some VFP links

Others...

Archives

Who links to this site?

Hey There!!!

Syndication




A Visual Foxpro DataRepeater Class

This is a control that will display your data in a repeated sequence. Unlike a normal grid, this control can show multiple lines from the same record, thus giving you the ability to display data in a scrollable container with no restriction on the number of fields to display. There are a number of examples of a DataRepeater to be found but it is better to visualise it than to describe it, so here is my DataRepeater control in action.



This control is very easy to setup and use as you will see. Just a few steps and a few properties to set. So here goes.

Because of the way classes are implemented in VFP you cannot add an object from a form, only from a class, Therefore there is an additional step required for setting up this class.

Open a new form, resize it and add a datarepeater object to it as shown below






The form above has the DataRepeater control added to it. This is just a container into which you will place your fields. This control is DataBound so all controls dropped into it must also be databound.

The easiest way to add fields, is to open a table in the form DE and drag and drop fields from there into the container. The table can be deleted from the DE after you are done adding fields.

In the image below I have added fields from the CUSTOMER table found in the \SAMPLES\DATA directory of VFP. Notes field was added to show memos in action.




Now re-arrange and resize the fields as well as resize the container as needed. Once you are satisfied with the result, select the container and save it as a class – from the menu File|SaveAs Class and save it into the bbDataRepeater class library. I have saved my class as customerdata.


The class instance along with the fields, can now be deleted from the form once you have saved it as a class..

Next insert a datarepeatergrid object on the form. Since I plan to have 2 panels of repeating data I need to make my form large enough to fit since the grid will expand at runtime to accommodate the 2 panels. This is dependant on the number of fields used since the larger the datarepeater with fields is, the larger will be the grid.



Once that’s done it is now a matter of setting a few properties of the datarepeatergrid object.

The properties that need to be set are shown here as I have made them all favourites
.


That is all. Now the form is ready, so run it..



Clicking on the buttons will fire the custom method buttonclicked and you can see that the class knows which record you are on.


Download the class and a sample form from the link below.


Enjoy.

Published Tuesday, August 26, 2008 10:06 PM by bbout
Attachment(s): bbDataRepeater.zip

Comment Notification

If you would like to receive an email when updates are made to this post, please register here

Subscribe to this post's comments using RSS

Comments

# re: A Visual Foxpro DataRepeater Class @ Wednesday, August 27, 2008 3:30 AM

Thanks Bernard
Its a Cool!
Before i have posted like this class on our Foxite
http://www.foxite.com/archives/multi-objects-in-a-single-column-grid-0000185893.htm

Sorry to disappoint you but your class uses a similar method is all. It is nothing like the functionality of this class.

For instance, does your grid column resize automatically - height and width? There are so many differences that I won't say more.

Arjun D. Bagojikop

# re: A Visual Foxpro DataRepeater Class @ Wednesday, August 27, 2008 5:03 AM

you Right Barnard
if you resize a particular row its become very ultimate class

when user got focus on particular row it will resize automatically as per control and he/she lost focus it will become normal


Arjun D. Bagojikop

# re: A Visual Foxpro DataRepeater Class @ Wednesday, August 27, 2008 7:35 AM

Nice Class Bernard!. well arjun best part of
bernard class is gui and the custom method
which fired on click on red cross. other thing
u have made the class Which use more resource
in case of Bernard he used purely Grid this is
grid's other aspect which is i dont think that
most of vfp guy's know abt it.! my rating to u
bernard!. Keep up your Good Work.

Anil
 

Anil

# re: A Visual Foxpro DataRepeater Class @ Wednesday, August 27, 2008 7:49 AM

Bernard Look Grid.View Property :)
That will inspire your for making new class
use it with split.

Anil

What do you think?

(required) 
required 
(required) 
Powered by Community Server, by Telligent Systems