Plateforme Level Extreme
Abonnement
Profil corporatif
Produits & Services
Support
Légal
English
Sample grid builder
Message
De
02/08/2001 18:18:28
Hilmar Zonneveld
Independent Consultant
Cochabamba, Bolivie
 
 
À
02/08/2001 12:06:34
Cetin Basoz
Engineerica Inc.
Izmir, Turquie
Information générale
Forum:
Visual FoxPro
Catégorie:
Codage, syntaxe et commandes
Divers
Thread ID:
00538818
Message ID:
00539128
Vues:
13
Thanks; I got several samples, and I will have to do the checking in a few days, since I currently have other urgent work.

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.
>>
>>And I don't have a clear idea how to get started.
>>
>>TIA, Hilmar.
>
>Hi Hilmar,
>This is one I use as a nonregistered builder (I just select one or more grids on form, go to command window and call BuildGrid(..) )
>
Lparameters lcOldClass, lcNewClass, lcClassLib, lcApplyTo, lcKeepProperty, lcParams
>*
>* Quick and dirty builder for grid columns(ix).controls
>* gridbuild(lcOldClass, lcNewClass, lcClassLib [,lcApplyTo] [,lcKeepProperty] [,lcParams])
>* Author : Cetin Basoz
>* lcOldClass = Class to change ie: header
>* lcNewClass = New Class ie: myheader
>* lcClassLib = vcx or prg containing definition - if prg extension is required
>* lcApplyTo  = Apply to columns list ie: 1,4,5 - all assumed if empty or ignored
>* lcKeepProperty - A property to keep as is if any ie: Caption
>* lcParams - Params passed to new class if any - ie : lnLeft, lnTop
>*
>* Sample calls :
>* 1)Replace all header class with myheader class (from myheaderset.prg) and keep caption property
>* =gridbuild("header","myheader","myheaderset.prg",,"caption")
>*
>* 2)Replace all textbox class with mytextbox class (from myclasses.vcx)
>* =gridbuild("textbox","mytextbox","myclasses")
>*
>* 3)Replace all textbox class with mytextbox class (from myclasses.vcx) in columns 1,3,5
>* gridbuild("textbox","mytextbox","myclasses","1,3,5")
>*
>* Select one or more grids on form and call
>*
>If type("lcOldClass") # "C" ;
>  or type("lcNewClass") # "C" ;
>  or type("lcClassLib") # "C"
>  Or empty("lcOldClass") ;
>  or empty("lcNewClass") ;
>  or empty("lcClassLib")
>  Wait window nowait "Required params missing."
>  Return
>Endif
>
>lcApplyTo = iif(type("lcApplyTo")#"C","0",lcApplyTo)
>lcKeepProperty = iif(type("lcKeepProperty")="C",lcKeepProperty,"name")
>lcParams = iif(type("lcParams")="C",","+lcParams,"")
>If ratc(".prg",lcClassLib)>0
>  If !upper(lcClassLib)$set("Procedure")
>    Set proc to (lcClassLib) additive
>  Endif
>Else
>  If !upper(lcClassLib)$set("classlib")
>    Set classlib to  (lcClassLib) additive
>  Endif
>Endif
>Aselobj(oGrids)
>For each oGrid in oGrids
>  If !oGrid.baseclass = "Grid"
>    Loop
>  Endif
>  For each oColumn in oGrid.columns
>    If lcApplyTo=="0" or inlist(oColumn.columnorder, &lcApplyTo)
>      For each oControl in oColumn.controls
>        If upper(oControl.class) = upper(lcOldClass)
>          lcKeepName = oControl.name
>          lcKeepPropValue = oControl.&lcKeepProperty
>          oColumn.removeobject(lcKeepName)
>          oColumn.addobject(lcKeepName,lcNewClass &lcParams)
>          With eval("oColumn."+lcKeepName)
>            .&lcKeepProperty = lcKeepPropValue
>          Endwith
>        Endif
>      Endfor
>    Endif
>  Endfor
>Endfor
>
Cetin
Difference in opinions hath cost many millions of lives: for instance, whether flesh be bread, or bread be flesh; whether whistling be a vice or a virtue; whether it be better to kiss a post, or throw it into the fire... (from Gulliver's Travels)
Précédent
Répondre
Fil
Voir

Click here to load this message in the networking platform