Plateforme Level Extreme
Abonnement
Profil corporatif
Produits & Services
Support
Légal
English
Grid changes record pointer
Message
Information générale
Forum:
Visual FoxPro
Catégorie:
Codage, syntaxe et commandes
Versions des environnements
Visual FoxPro:
VFP 8 SP1
OS:
Windows XP SP2
Network:
Windows 2003 Server
Database:
Visual FoxPro
Application:
Desktop
Divers
Thread ID:
01409326
Message ID:
01409364
Vues:
38
Following code works Ok, maybe it will help you to find some discrepancies in yours, e.g. I don' like lnRec = RECNO() line without checking the alias.
Function resetgridorder
Lparameter cAlias,cTagname,oHeader
Local nRecno,cError,lErrorflag
cTagname=Upper(Alltrim(cTagname))
Select (cAlias)
If Tagno(cTagname)=0
	=Messagebox('Invalid Index Tag!',0+16,oApp.msgtitle)
	Return
Endif
nRecno=Recno()
If cTagname=Tag()	&& the same tag, change direction
	If Descending()=.T.
		Set Order To Tag &cTagname. Ascending
	Else
		Set Order To Tag &cTagname. Descending
	Endif
Else				&& new tag, change it
	Set Order To Tag &cTagname.
Endif
oHeader.Parent.Parent.Refresh
cError=On('error')
On Error lErrorflag=.T.
Go nRecno In &cAlias.
On Error &cError.
If lErrorflag=.T.
	Go Top In &cAlias.
Endif
=paintgridheaders(oHeader.Parent.Parent,oHeader)
Return
Endfunc
>I was doing that but in a local variable. Changing to a form property did not make a difference. I did notice that if I set break points, the record pointer stays on the selected record. I cannot seem to pin-point where or what is moving the record pointer.
>
>*clmAddDate.header1.click
>LOCAL lnRec, lsOrder, lnColor
>STORE "" to lsOrder, lnColor
>lnRec = RECNO()
>
>* tag is the field name
>lsOrder=ThisForm.mGetTag(This.Tag)
>lnColor = This.ForeColor
>* get current text color
>IF lnColor = RGB(128,0,128)	&& purple color
>     lnColor = RGB(0,0,0) && black color
>     SET ORDER TO
>ELSE
>     WITH This.Parent.Parent
>          IF TAGNO(lsOrder)>0 && This index already exists (assume simple indexes tagname=fieldname)
>	SET ORDER TO (lsOrder)
>          ENDIF && TAGNO(
>          lnColor = RGB(128,0,128)	&& purple color
>          .clmUserId.header1.ForeColor = RGB(0,0,0)
>          .clmEmpId.header1.ForeColor = RGB(0,0,0)
>          .clmFullName.header1.ForeColor = RGB(0,0,0)
>          .clmOrg.header1.ForeColor = RGB(0,0,0)
>          .clmClasses.header1.ForeColor = RGB(0,0,0)
>          .clmCity.header1.ForeColor = RGB(0,0,0)
>          .clmBldg.header1.ForeColor = RGB(0,0,0)
>          .clmDates.header1.ForeColor = RGB(0,0,0)
>     ENDWITH
>ENDIF && lnColor = RGB(
>This.ForeColor = lnColor
>This.Parent.Parent.Refresh()
>
>GOTO lnRec
>This.Parent.Parent.clmAddDate.SetFocus
>
>
>>Actually, I looked at my 'resetgridorder' base method that I wrote many years ago and still use in all places. For some reason (maybe the same as in this thread) I stored recno() in variable before SET ORDER, so ...
Edward Pikman
Independent Consultant
Précédent
Suivant
Répondre
Fil
Voir

Click here to load this message in the networking platform