Level Extreme platform
Subscription
Corporate profile
Products & Services
Support
Legal
Français
Sample grid builder
Message
From
02/08/2001 11:28:03
 
 
To
02/08/2001 10:42:55
Hilmar Zonneveld
Independent Consultant
Cochabamba, Bolivia
General information
Forum:
Visual FoxPro
Category:
Coding, syntax & commands
Miscellaneous
Thread ID:
00538818
Message ID:
00538876
Views:
10
Hi Hilmar.

>Can someone provide a simple sample for a grid builder - or any other builder, for that matter?
>
>I want something like: for each column, reset a certain property; assign another property; write some method code.

Builders are pretty simple to create (well, they can be as complex as you want, of course). The key is to get a reference to the selected object in the Form or Class Designer. You can do that using ASELOBJ() (see the VFP help topic for syntax). Once you've done that, you can talk to the object in designer mode just as you would at runtime. You can even call its WriteMethod method to add some code to an existing method (in VFP 7, you can pass .T. to a new third parameter to create the method if it doesn't exist).

Here's an example. This assumes you've selected a grid in the designer. It changes the Caption of each Header to the current DBC Caption property of the field in the column, or just a cleaned up field name if the DBC Caption is empty. Note: this doesn't do any error checking, which really should be done <s>.
aselobj(laObjects)
loGrid = laObjects[1]
for each loColumn in loGrid.Columns
  lcField   = loColumn.ControlSource
  lcCaption = dbgetprop(lcField, 'Field', 'Caption')
  lcCaption = iif(empty(lcCaption), ;
    proper(strtran(justext(lcField), '_', ' ')), ;
    lcCaption)
  loColumn.Header1.Caption = lcCaption
next loColumn
Doug
Previous
Reply
Map
View

Click here to load this message in the networking platform