Level Extreme platform
Subscription
Corporate profile
Products & Services
Support
Legal
Français
BindEvent() and This
Message
From
07/05/2009 11:31:04
 
 
To
07/05/2009 10:11:08
Hilmar Zonneveld
Independent Consultant
Cochabamba, Bolivia
General information
Forum:
Visual FoxPro
Category:
Coding, syntax & commands
Environment versions
Visual FoxPro:
VFP 9
Miscellaneous
Thread ID:
01398345
Message ID:
01398381
Views:
57
>I want to put the same code in headers and textboxes for several columns. The current approach is to copy the same code, but I thought BindEvent() might be a better approach. Now, the current commands include references to This, and I assume that in the delegate code, This would refer to the delegate object. Is there a way to find out the original object (e.g., some grid column, or Grid Header in the column) from which object the delegate method was called?

Why not use the MemberClass and MemberClassLibrary properties on the Grid. The below is an example MemberClassLibrary from the VFP Toolbox:
#include "foxpro.h"

* used to define custom grid columns & headers
* for the Toolbox components
DEFINE CLASS ComponentColumn AS Column
	FontName = "Tahoma"
	FontSize = 8
	CurrentControl = "ColumnTextBox"
	
	HeaderClass = "ComponentHeader"
	HeaderClassLibrary = "ToolboxUI.prg"
	
	ADD OBJECT ColumnTextBox AS Textbox WITH ;
		FontName = "Tahoma", ;
		FontSize = 8, ;
		BorderStyle = BORDER_NONE
	
	PROCEDURE ColumnTextbox.RightClick
		THISFORM.ShowGridMenu()	
	ENDPROC
ENDDEFINE

DEFINE CLASS ComponentHeader AS Header
	FontName = "Tahoma"
	FontSize = 8
ENDDEFINE

DEFINE CLASS MyTextBox AS Textbox
	FontName = "Tahoma"
	FontSize = 8
	BorderStyle = BORDER_NONE
ENDDEFINE
Previous
Next
Reply
Map
View

Click here to load this message in the networking platform