Level Extreme platform
Subscription
Corporate profile
Products & Services
Support
Legal
Français
Wrong with ActiveRow
Message
From
21/07/2005 03:05:32
 
General information
Forum:
Visual FoxPro
Category:
Coding, syntax & commands
Environment versions
Visual FoxPro:
VFP 8 SP1
OS:
Windows XP SP1
Network:
Windows XP
Database:
Visual FoxPro
Miscellaneous
Thread ID:
01034016
Message ID:
01034560
Views:
21
>Hi Fábio !
>
>>This way every time that ActiveRow is invoked owes recompute the position,
>>and to do this uses the command count all while recno#currentRecord;
>
>Where did you discover that ActiveRow has this behavior?
>
>Help doesn't speak anything about this
>
>Thanks in advance,
>
>Dionísio

Hi Dionísio,

Using the grid and verifying the behavior of it,
it is not difficult to understand as the code C++ it is written.

try this:
PUBLIC oform1

oform1=NEWOBJECT("form1")
oform1.Show
RETURN

DEFINE CLASS form1 AS form


	Top = 0
	Left = 0
	Height = 314
	Width = 479
	DoCreate = .T.
	Caption = "Form1"
	AllowOutput = .F.
	Name = "Form1"


	ADD OBJECT command1 AS commandbutton WITH ;
		Top = 16, ;
		Left = 26, ;
		Height = 27, ;
		Width = 178, ;
		Caption = "RecCount/2 ActiveRow", ;
		Alignment = 0, ;
		Name = "Command1"


	ADD OBJECT command2 AS commandbutton WITH ;
		Top = 16, ;
		Left = 224, ;
		Height = 27, ;
		Width = 178, ;
		Caption = "RecCount ActiveRow", ;
		Alignment = 0, ;
		Name = "Command2"


	ADD OBJECT grid1 AS grid WITH ;
		Height = 200, ;
		Left = 52, ;
		Top = 104, ;
		Width = 320, ;
		Name = "Grid1"


	ADD OBJECT command3 AS commandbutton WITH ;
		Top = 54, ;
		Left = 26, ;
		Height = 27, ;
		Width = 178, ;
		Caption = "RecCount/2 COUNT", ;
		Alignment = 0, ;
		Name = "Command3"


	ADD OBJECT command4 AS commandbutton WITH ;
		Top = 54, ;
		Left = 224, ;
		Height = 27, ;
		Width = 178, ;
		Caption = "RecCount COUNT", ;
		Alignment = 0, ;
		Name = "Command4"


	PROCEDURE Load
		CREATE CURSOR testGrid (f1 i)
		FOR k=1 TO 1000000
			APPEND BLANK
		NEXT
	ENDPROC


	PROCEDURE command1.Click
		GO RECCOUNT()/2
		thisform.grid1.Refresh	&& sync grid
		thisform.grid1.SetFocus && ActiveRow = 0 without Focus
		t1=seconds()
		FOR k=1 TO 10
		=thisform.grid1.ActiveRow && eval
		next
		t1=SECONDS()-t1
		this.Caption = GETWORDNUM(THIS.Caption,1,"=")+'= '+STR(t1,6,3)
		this.SetFocus
	ENDPROC


	PROCEDURE command2.Click
		GO RECCOUNT()
		thisform.grid1.Refresh	&& sync grid
		thisform.grid1.SetFocus && ActiveRow = 0 without Focus
		t1=seconds()
		FOR k=1 TO 10
		=thisform.grid1.ActiveRow && eval
		next
		t1=SECONDS()-t1
		this.Caption = GETWORDNUM(THIS.Caption,1,"=")+'= '+STR(t1,6,3)
		this.SetFocus
	ENDPROC


	PROCEDURE command3.Click
		GO RECCOUNT()/2
		rn=RECNO()
		t1=seconds()
		FOR k=1 TO 10
		COUNT ALL WHILE RECNO()#m.rn
		next
		t1=SECONDS()-t1
		this.Caption = GETWORDNUM(THIS.Caption,1,"=")+'= '+STR(t1,6,3)
	ENDPROC


	PROCEDURE command4.Click
		GO RECCOUNT()
		rn=RECNO()
		t1=seconds()
		FOR k=1 TO 10
		COUNT ALL WHILE RECNO()#m.rn
		next
		t1=SECONDS()-t1
		this.Caption = GETWORDNUM(THIS.Caption,1,"=")+'= '+STR(t1,6,3)
	ENDPROC


ENDDEFINE
Previous
Next
Reply
Map
View

Click here to load this message in the networking platform