Plateforme Level Extreme
Abonnement
Profil corporatif
Produits & Services
Support
Légal
English
Assigning code to Grid methods
Message
De
16/09/2003 02:12:27
Dorin Vasilescu
ALL Trans Romania
Arad, Roumanie
 
Information générale
Forum:
Visual FoxPro
Catégorie:
Gestionnaire d'écran & Écrans
Divers
Thread ID:
00829171
Message ID:
00829261
Vues:
24
>I have a grid with up to 100 columns (undetermined initially).
>I am using visual form designer. Is there some simple way
>to assign common code to a method - for example the
>ThisForm.Grid1.Column(I).Text1.MouseDown method - for each
>column without having to bring up each Text1.MouseDown method
>and writing the same lines in each case for all columns?
>
>Thanks for your help.

You can use the procedure below, the method code must be tested to be sintactically correct and copied to clipboard/memory variable
You only need to select the grid in form designer and run the program from command line
ChangeGridMethod('Text1','MouseDown',_ClipText)
or
ChangeGridMethod('Text1','MouseDown','') to clear method code from all textboxes
PROCEDURE ChangeGridMethod
LPARAMETERS tcControlName,tcMethodName,tcMethodCode
LOCAL lnSelObjectCount, loGridRef, lnCnt, loControlRef
LOCAL ARRAY laSelectedObject[1]
lnSelObjectCount = ASELOBJ(laSelectedObject)
IF lnSelObjectCount = 0
	WAIT WINDOW 'Select a grid in Form Designer first' nowait
	RETURN
ENDIF
loGridRef = laSelectedObject[1]
IF loGridRef.BaseClass # 'Grid'
	WAIT WINDOW 'One Grid object must be selected' nowait
	RETURN
ENDIF
FOR lnCnt = 1 TO loGridRef.ColumnCount
	IF type("loGridRef.Columns(lnCnt)."+tcControlName) = 'O'
		loControlRef = EVALUATE("loGridRef.Columns(lnCnt)."+tcControlName)
		loControlRef.WriteMethod(tcMethodName,tcMethodCode) 
	ENDIF
NEXT
RETURN
Précédent
Répondre
Fil
Voir

Click here to load this message in the networking platform