Plateforme Level Extreme
Abonnement
Profil corporatif
Produits & Services
Support
Légal
English
Hourglasses when clicking on the Header
Message
 
 
À
28/01/2005 10:21:00
Information générale
Forum:
Visual FoxPro
Catégorie:
Gestionnaire d'écran & Écrans
Versions des environnements
Visual FoxPro:
VFP 8 SP1
OS:
Windows XP SP2
Divers
Thread ID:
00981532
Message ID:
00981741
Vues:
66
Fabio,

Thanks. I'm going to implement some fixes. BTW, your lcField suggestion would not work if I pass just field name as a controlsource.

><snip>
>>No, we're still in the early stage of the development, so we're running from the VFP environment. Here is the SetOrder method code:
>>
>>*---------------------- Location Section ------------------------
><snip>
>>*----------------------------------------------------------------
>>LPARAMETERS tcControlSource, tcTagName
>>LOCAL lnCount, lcField, lcIndexExpr, lcCursor, lnIndexes, ;
>>	lcAscDesc, lnRecNo, loSelect
>>LOCAL ARRAY laIndex[1]
>>
>>*----------------------------------------------------------
>>*-- Get the field, cursor name for the ControlSource cursor
>>*----------------------------------------------------------
>>lcField = SUBSTR(tcControlSource, AT(".", tcControlSource) + 1)
>>lcCursor = JUSTSTEM(tcControlSource)
>>
>
>
>a little change, more readable:
>
>*lcField = SUBSTR(tcControlSource, AT(".", tcControlSource) + 1)
>lcField = JUSTEXT(tcControlSource)
>
>
>
>>* Change by NN
>>IF RECCOUNT(m.lcCursor) = 0 && empty cursor, why bother?
>> RETURN
>>ENDIF
>
>Put check reccout() before, because it is a precondition.
>
>
>> >lnRecNo = RECNO(lcCursor)
>>
><snip>
>
>>
>>Which is called from the HeaderClick method
>>
>>*---------------------- 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)
>>	LOCAL lcOrder
>>	lcOrder = SET('order') && Save current tag
>>	THIS.SetOrder(m.loCalledBy.PARENT.CONTROLSOURCE)
>>	IF this.lShowSortingArrows AND NOT SET('order')== m.lcOrder
>>** Clear the picture of the previously sorted column
>>		this.ClearHeaderPictures()
>>		this.SetHeaderPicture(m.loCalledBy)
>>	endif
>>ENDIF
>>
>>Now, the ClearHeaderPictures method could be a possible slowdown. I thought, do I want to store last clicked header in grid's property and decided it's not worth it. What do you think?
>>
>>*---------------------- Location Section ------------------------
>>*   Library: 	Acustomcontrols.vcx
>>*   Class: 		Grdsorting
>>*   Method: 	Clearheaderpictures()
>>*----------------------- Usage Section --------------------------
>>*)  Description:
>>*)
>>
>>*   Scope:      Public
>>*   Parameters:
>>*$  Usage:
>>*$
>>*   Returns:
>>*--------------------- Maintenance Section ----------------------
>>*   Change Log:
>>*       CREATED 	01/24/2005 - NN
>>*		MODIFIED
>>*----------------------------------------------------------------
>>LOCAL loColumn, loControl
>>FOR EACH loColumn IN THIS.COLUMNS
>>	FOR EACH loControl IN loColumn.CONTROLS
>>		IF UPPER(loControl.BASECLASS) = "HEADER"
>>			loControl.resettodefault('picture')
>>		ENDIF
>>	ENDFOR
>>ENDFOR
>>
>>So, do you see a problem in this code? What could be a reason for slowdown? I have all indexes for the cursor created in advance.
>
>This is not a good solution.
>
>It is simple because it is stateless.
>you can write it better with :
>
>* for each is slow
>FOR iColumn=1 to m.THIS.COLUMNcount
>   this.Columns[m.iColumn].Control[1].resettodefault('picture')
>ENDFOR
>
>
>Best is a "with state" solution:
>
>save Ordered column header reference into a grid property
>this.OrderHeader = header
>when you clear it:
>=VARTYPE('m.this.OrderHeader')=='O' AND this.OrderHeader.resettodefault('picture')
>
>
>More elegant ( BUT current VFP is insufficient ):
>
>this.ClearHeaderPictures("Picture") && a empty procedure
>* on this.SetHeaderPicture(m.loCalledBy)
>* unfortunately on VFP is not possible this very usefull command:
>*=UNBINDEVENTS(m.this,"ClearHeaderPicture") && REMOVE ALL DELEGATE OF ClearHeaderPicture
>=BINDEVENT(m.this,"ClearHeaderPicture",m.loCalledBy,"resettodefault")
>loCalledBy.Picture = ....
>
>
>However I see the hourglasses moreover for the fast execution,
>then i'm not sure you I can remove it with certainty
>
>Fabio
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