Plateforme Level Extreme
Abonnement
Profil corporatif
Produits & Services
Support
Légal
English
Adding code to method at runtime
Message
 
 
À
12/01/2005 14:45:09
Information générale
Forum:
Visual FoxPro
Catégorie:
Classes - VCX
Versions des environnements
Visual FoxPro:
VFP 9
OS:
Windows XP SP2
Network:
Windows 2003 Server
Database:
MS SQL Server
Divers
Thread ID:
00976183
Message ID:
00976600
Vues:
15
>The code will be in the click method of a header object. The code is hardcoded it doesn't come from anywhere in particular. The adding of this code will be done probably when initializing the form.
>
>thanks

I took the code from Barbara Peisch message # 946490 and just modified it a little:
*---------------------- Location Section ------------------------
*   Library: 	Acustomcontrols.vcx
*   Class: 		Grdsorting
*   Method: 	Init()
*----------------------- Usage Section --------------------------
*)  Description: (ideas from message #946490 by Barbara Peisch)
*)

*   Scope:      Public
*   Parameters:
*$  Usage:
*$
*   Returns:
*--------------------- Maintenance Section ----------------------
*   Change Log:
*       CREATED 	01/06/2005 - NN
*		MODIFIED    01/10/05 - JMW Changed the variable names to 
*					Hungarian notation.
*----------------------------------------------------------------
IF NOT DODEFAULT()
   RETURN .f.
ENDIF

LOCAL loColumn, loControl

* Delegate header's click to grid's HeaderClick custom method 
* and column's textbox DblClick to grid's DblClick

FOR EACH loColumn IN THIS.COLUMNS
	FOR EACH loControl IN loColumn.CONTROLS
		IF UPPER(loControl.BASECLASS) = "HEADER"
			BINDEVENT(loControl,"Click",THIS,"HeaderClick")
		ELSE
			IF UPPER(loControl.BASECLASS) = "TEXTBOX"
				BINDEVENT(loControl,"DblClick",THIS,"DblClick")
			ENDIF
		ENDIF
	ENDFOR
ENDFOR

*---------------------- Location Section ------------------------
*   Library: 	Acustomcontrols.vcx
*   Class: 		Grdsorting
*   Method: 	Headerclick()
*----------------------- Usage Section --------------------------
*)  Description: Custom method which fires when Header is clicked (idea from Barbara Peisch)
*)
*   Scope:      Public
*   Parameters:
*$  Usage:
*$
*   Returns:
*--------------------- Maintenance Section ----------------------
*   Change Log:
*       CREATED 	01/06/2005 - NN
*		MODIFIED
*----------------------------------------------------------------
LOCAL loCalledBy AS OBJECT

AEVENTS[aCurEvent,0]
loCalledBy = aCurEvent[1] && should be a Header object

IF VARTYPE(m.loCalledBy)= "O" AND NOT EMPTY(m.loCalledBy.PARENT.CONTROLSOURCE)
	THIS.SetOrder(m.loCalledBy.PARENT.CONTROLSOURCE)
ENDIF
If it's not broken, fix it until it is.


My Blog
Précédent
Suivant
Répondre
Fil
Voir

Click here to load this message in the networking platform