Welcome To The Home Of The Visual FoxPro Experts  
home. signup. forum. archives. search. google. articles. downloads. faq. members. weblogs. file info. rss.
 From: Bhushan Sahni
  Where is Bhushan Sahni?
 Jabalpur/Mumbai
 India
 Bhushan Sahni
 To: Bong Bungalan
  Where is Bong Bungalan?
 gensan
 Philippines
 Bong Bungalan
 Tags
Subject: RE: Adding Header.Click() event at runtime
Thread ID: 268547 Message ID: 268548 # Views: 49 # Ratings: 3
Version: Visual FoxPro 9 Category: Classes and Objects
Date: Tuesday, July 13, 2010 8:20:56 AM         
   


> Hi to the respected members in this awesome Foxpro forum. I would like to express my gratitude to all active members who were and are willing to share their experties thru which I owe you my progress in learning VFP. In my practice project, I am now preparing for report creation. The Forms are completed though there are few features I want to add on my project as soon as I see it right to add.
>
> One of it is adding a Sort Routine in the interactive SearchForm. if the user clicks on the Grid's Header whose Column's ControlSource is indexed and if not, it will do nothing. For you guys to understand better, below is the pseudo code of the class. My questions are:
>
> 1. Do I need to add additional Object like 'Add Object loHeader as Header'? if so, which part of the code will I insert? or
> 2. I should have to have a procedure like
> 'Procedure grdSearch.columns(lnColNo).Header1.Click()? or
> 3. I need to use bindEvent (<--- I find it hard to understand yet) and add custom method to the class? if so, how?
>
> I hope to hear guidance from you once again.
>
> Knd regards,
> bong
>
>
> Define Class SearchForm as Form
> 	Procedure init()
> 	Procedure LOad()
> 	
> 	Add Object txtSearch as Textbox()
> 		Procedure txtSearch.InteractiveChange()
> 		Procedure txtSearch.KeyPress()
> 
> 	Add Object grdSearch as Grid
> 		Procedure grdSearch.Init()
> 		Procedure grdSearch.dblClick()
> 		Procedure grdSearch.RightClick()
> 		Procedure grdSearch.KeyPress()
> 
> 	Add Object cmdClose as CommandButton()
> 		Procedure cmdClose.Click()
> 
> 	Procedure Unload()
> 
> Enddefine
> 


Hi,

You will have to use BINDEVENT and its Simple not complicated :)


The First two parameters are the Object name and its event, in your case it will be the Thisform.Grid1.ColumnX.Header1 and Click. For rest of the two parameters, you can create a method in the form and write the code there and then associate that method to the click event of the header. so the command will be

BINDEVENT(Thisform.Grid1.ColumnX.Header1,"Click",thisform, "YourMethodName")


This is dynamic binding of the event to a method.

PS : You cannot use parameters in BindEvent :(

Also, you can create your header class and use it instead of the native header object

Regards
Bhushan Sahni
Eitzen Group (IT)
bsh@eitzen-group.com
Visual Foxpro a dream house for developers

ENTIRE THREAD

Adding Header.Click() event at runtime Posted by Bong Bungalan @ 7/13/2010 8:15:49 AM
RE: Adding Header.Click() event at runtime Posted by Bhushan Sahni @ 7/13/2010 8:20:56 AM
RE: Adding Header.Click() event at runtime Posted by Bong Bungalan @ 7/13/2010 8:33:49 AM
RE: Adding Header.Click() event at runtime Posted by Bhushan Sahni @ 7/13/2010 8:35:09 AM
RE: Adding Header.Click() event at runtime Posted by Stefan Wuebbe @ 7/13/2010 8:37:29 AM
RE: Adding Header.Click() event at runtime Posted by Bong Bungalan @ 7/13/2010 9:12:34 AM
RE: Adding Header.Click() event at runtime Posted by Stefan Wuebbe @ 7/13/2010 10:00:19 AM
RE: Adding Header.Click() event at runtime Posted by Bong Bungalan @ 7/13/2010 2:18:31 PM
RE: Adding Header.Click() event at runtime Posted by Stefan Wuebbe @ 7/13/2010 3:29:19 PM
RE: Adding Header.Click() event at runtime Posted by Bong Bungalan @ 7/13/2010 3:52:15 PM
RE: Adding Header.Click() event at runtime Posted by Stefan Wuebbe @ 7/13/2010 4:17:35 PM
RE: Adding Header.Click() event at runtime Posted by Bong Bungalan @ 7/13/2010 4:31:10 PM
RE: Adding Header.Click() event at runtime Posted by tushar @ 7/13/2010 4:23:10 PM
RE: Adding Header.Click() event at runtime Posted by Bong Bungalan @ 7/13/2010 4:37:24 PM
RE: Adding Header.Click() event at runtime Posted by tushar @ 7/13/2010 4:43:17 PM
RE: Adding Header.Click() event at runtime Posted by tushar @ 7/13/2010 8:46:25 AM