Plateforme Level Extreme
Abonnement
Profil corporatif
Produits & Services
Support
Légal
English
Sparse?
Message
De
23/03/2006 23:17:36
 
 
Information générale
Forum:
Visual FoxPro
Catégorie:
Autre
Titre:
Versions des environnements
Visual FoxPro:
VFP 8 SP1
OS:
Windows XP SP2
Network:
Windows 2000 Server
Database:
Visual FoxPro
Divers
Thread ID:
01107245
Message ID:
01107260
Vues:
29
Ok,

I can see I'm going to have to digest that. It seems like I might have to go the custom control route as I don't think I'll be able to bind to the events in the grid.

I'm guessing of course, but that's based on my observations and the reason I've resorted to coding the grid. As my control source is a cursor, I didn't want it to be displaying deleted items and potentially chewing up a lot of memory holding deleted items either, so when it came time to redisplay the grid again, I just recreated the cursor.

So when that happened, all the embedded controls and header names etc disappeared. So my thinking is that the same thing would happen with any code I insert into the grid events.

Does that sound logical to you?



>>Thanks Naomi,
>>
>>I would have responded sooner. But I had to cry first.
>>
>>As an aside.
>>
>>What would you see as being the easiest way to implement a click event in one of those embedded controls?
>>
>>I'm looking at it and wondering if I shouldn't define an object and then add that in with the click event already created.
>>
>>To be honest... I don't care sometimes as long as it works, but readability and reusability are kinda important too I guess.
>>
>>
>>Cheers
>>John
>>
>Two quite simple ways: either have your own control with predefined code or BindEvents.
>
>Here is the sample of the second approach from our grdSorting class:
>
>*---------------------- 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.
>*      MODIFIED     03/11/2005 - NN
>*----------------------------------------------------------------
>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
>   m.loColumn.AddProperty("cOriginalControlSource",m.loColumn.ControlSource)
>	FOR EACH loControl IN loColumn.CONTROLS
>		IF UPPER(loControl.BASECLASS) = "HEADER"
>			BINDEVENT(loControl,"Click",THIS,"HeaderClick")
>			m.loControl.AddProperty("CurrentTag","") && Adds CurrentTag property
>			IF this.lCreateIndexes && Adds indexes on the fly
>			   this.CreateTag (m.loControl)
>			endif			
>		ELSE
>			IF UPPER(loControl.BASECLASS) = "TEXTBOX"
>				BINDEVENT(loControl,"DblClick",THIS,"DblClick")
>			ENDIF
>		ENDIF
>	ENDFOR
>ENDFOR
>
>IF this.lManualHighlight
>   this.SetAll("DynamicBackColor","iif(recno(this.RecordSource)=this.nRecno,this.HighlightBackColor,this.BackColor)", "Column")
>   this.SetAll("DynamicForeColor","iif(recno(this.RecordSource)=this.nRecno,this.HighlightForeColor,this.ForeColor)", "Column")
>   this.HighlightStyle = 0
>ENDIF
>
>IF this.lSaveGridProperties
>	this.SaveGridProperties()
>ENDIF
>
>
>As you see, we are binding Click on the header and double click on the cells to grids methods.
>
>Here is HeaderClick method:
>
>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.cOriginalControlSource)
>	local lcOrder, lcRecSource, llDirection
>	lcRecSource = this.recordsource
>	llDirection = this.lAscending
>
>	lcOrder = order(m.lcRecSource) && Saves current tag
>	this.SetOrder(m.loCalledBy.parent.cOriginalControlSource, m.loCalledBy.CurrentTag)
>	if this.lShowSortingArrows
>* Check, if we changed the order
>		if not order(m.lcRecSource)== m.lcOrder or m.llDirection <> this.lAscending
>** Clear the picture of the previously sorted column
>			m.loCalledBy.CurrentTag = this.cTagName
>			this.ClearHeaderPictures()
>			this.SetHeaderPicture(m.loCalledBy)
>		endif
>	endif
>endif
>this.mousepointer = 0
>
>
>HTH
Précédent
Suivant
Répondre
Fil
Voir

Click here to load this message in the networking platform