Plateforme Level Extreme
Abonnement
Profil corporatif
Produits & Services
Support
Légal
English
Hourglasses when clicking on the Header
Message
De
28/01/2005 09:48:19
Mike Yearwood
Toronto, Ontario, Canada
 
 
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:
00981702
Vues:
50
Hi Nadya

This seems to be part of some framework. Debugging and optimizing framework code can be complex. However, the refresh of the grid can be time consuming. Especially with a filter. Either GOTO command can also be a problem with a filter. If this is some framework, how are you making changes? You'd have to copy the parent code to a subclass and change that, or risk losing your changes when the next version of the framework comes out.

>>Hi Nadya,
>>
>>I look it, but i don't investigate on it.
>>
>>However, when VFP show of the behaviors of end user application during the development, is not incorrect
>>( the developer is the End User here );
>>but when, to runtime, the VFP's Virtual Machine do actions outside from the developer's control
>>then these are incorrect for definition.
>>
>>You have observed the hourglass at runtime ?
>>
>>Fabio
>
>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 ------------------------
>*   Library: CContrls.vcx
>*   Class:   CGrid
>*   Method:  SetOrder()
>*----------------------- Usage Section --------------------------
>*)  Description:
>*)		This method checks if there is a tag for the current
>*)		column's RowSource (specified in tcControlSource),
>*)		and if so, sets the order to it AND sets cGrid.cTagName
>*)		to the tag name of the index. If the optional second
>*)		parameter is passed, it simply issues a SET ORDER
>*)		on the tag.
>*
>*   Scope:      Public
>*   Parameters:
>*		1. tcControlSource - Name of the ControlSource
>*		2. tcTagName - 		(optional)Name of an index tag to
>*					   		be used to SET ORDER
>*
>*$  Usage:      Typically called from the Click() method of
>*					 a grid header.
>*					
>*   Returns:  Logical .T. by default
>*--------------------- Maintenance Section ----------------------
>*   Change Log:
>*		MODIFIED 10/27/97 - KJM
>*			Moved this method up the hierarchy from CSetOrderGrid
>*			to CGrid so that SetOrder functionality is available
>*			to all grids in the framework. CSetOrderGrid, although
>*			no longer necessary is left in the framework for
>*			backward compatibility.
>*			Also enhanced the code to allow for index expressions
>*			that are simply surrounded by an UPPER() statement.
>*		MODIFIED 04/16/98 - KJM
>*			Added a second tcTagName parameter. If a value has
>*			been passed ignore the tcControlSource parameter for
>*			now (may be used in the future) and set the ORDER
>*			to the specified tag.
>*		MODIFIED	07/10/99 - KJM
>*			Enhanced this method so that clicking on a column
>*			header toggles the ascending/descending order of
>*			the currently selected column.
>*		MODIFIED	11/01/99 - KJM
>*			Check if RECCOUNT() > 0 before issuing GOTO lnRecNo
>*		MODIFIED	10/05/00 - KJM
>*			Added a call to ThisForm.SetFilePos() so the
>*			navigation toolbar gets properly refreshed.
>*		MODIFIED	06/25/02 - KJM
>*			Changed "IF NOT tcTagName == UPPER(This.cTagName)"
>*			to "IF NOT UPPER(tcTagName) == UPPER(This.cTagName)"
>*-----------------------------------------------------------------
>*		MODIFIED  01/25/2005 - NN -
>*                 Added two new grid properties to not refresh toolbars and to go top after sorting
>*                 Also do not sort in empty grid
>*----------------------------------------------------------------
>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)
>
>* Change by NN
>IF RECCOUNT(m.lcCursor) = 0 && empty cursor, why bother?
>	RETURN
>ENDIF
>	
>lnRecNo = RECNO(lcCursor)
>
>loSelect = CREATEOBJ('CSelect', lcCursor)
>
>IF PCOUNT() < 2
>
>*----------------------------------------------
>*--- A tag name was not passed. Try to find a
>*--- tag for the current column's ControlSource
>*--- Get the number of indexes for the cursor.
>*----------------------------------------------
>	lnIndexes = AIndexes(@laIndex, lcCursor)
>*----------------------------------------------------------------
>*-- See if the field name is in the leftmost part of an index
>*-- expression OR simply within an UPPER() statement.
>*-- If so, SET ORDER TO the index.
>*----------------------------------------------------------------
>	FOR lnCount = 1 TO lnIndexes
>		lcIndexExpr = UPPER(SYS(14, lnCount, lcCursor))
>
>*--------------------------------------------------
>*--- Allow for character indexes that are simply
>*--- surrounded by "UPPER()". Remove "UPPER()".
>*--------------------------------------------------
>		IF LEFT(lcIndexExpr,6) = 'UPPER('
>			lcIndexExpr = SUBSTR(lcIndexExpr,7)
>			lcIndexExpr = SUBSTR(lcIndexExpr,1,LEN(lcIndexExpr)-1)
>		ENDIF
>
>		IF lcIndexExpr = UPPER(lcField)
>			tcTagName = TAG(lnCount, lcCursor)
>*--- Index found...exit ---*
>			EXIT
>		ENDIF
>	ENDFOR
>
>ENDIF
>
>*----------------------------------
>*--- Determine ASCENDING/DESCENDING
>*----------------------------------
>IF NOT EMPTY(tcTagName)
>	IF NOT UPPER(tcTagName) == UPPER(THIS.cTagName)
>*--- Default to ascending ---*
>		THIS.lAscending = .T.
>	ELSE
>*--- Toggle ascending/descending ---*
>		THIS.lAscending = NOT THIS.lAscending
>	ENDIF
>
>*------------------------
>*--- SET ORDER to the tag
>*------------------------
>	THIS.cTagName = tcTagName
>	lcAscDesc = IIF(THIS.lAscending, 'ASCENDING', 'DESCENDING')
>	SET ORDER TO tcTagName IN (lcCursor) &lcAscDesc
>
>*---------------------------------------------------
>*--- Refresh the grid and restore the record pointer
>*--- If done in the reverse order (GOTO, Refresh),
>*--- the grid is visually on the wrong record.
>*---------------------------------------------------
>	THIS.REFRESH()
>	
>*-- CHANGE - NN - January 25, 2005 - 09:37:53
>	IF THIS.lGoTopAfterSorting
>		GO TOP IN (m.lcCursor)
>	ELSE
>		IF RECCOUNT(m.lcCursor) > 0
>			GOTO m.lnRecNo IN (m.lcCursor)
>		ENDIF
>	ENDIF
>
>*-- CHANGE - NN - January 25, 2005 - 09:38:59 - added a new property
>	IF THIS.lUpdateToolbar
>		THISFORM.SetFilePos() && Note, that this code assumes existance of the SetFilePos method
>	ENDIF
>ENDIF
>
>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.

You may want to record the active column to a grid property, so you could reset the picture to default for the last active column when you switch to a new column, instead of resetting all columns.
Précédent
Suivant
Répondre
Fil
Voir

Click here to load this message in the networking platform