Level Extreme platform
Subscription
Corporate profile
Products & Services
Support
Legal
Français
Updating a grid when index value changes
Message
From
28/09/2005 03:00:52
 
 
To
27/09/2005 19:13:15
General information
Forum:
Visual FoxPro
Category:
Forms & Form designer
Environment versions
Visual FoxPro:
VFP 9
OS:
Windows XP
Network:
Windows 2003 Server
Database:
Visual FoxPro
Miscellaneous
Thread ID:
01053648
Message ID:
01053753
Views:
11
>Hi
>I don't think you understand the question.

I have understood very well.
But I cannot know the code that you have written.

>The user is never leaving the
>grid.

For this reason you have problems..
When the grid doesn't have focus,
it is the current recno that drive the refresh,
but when it has focus it is the recno of the top visible row.
But the grid::refresh reload the records only when you change
the


>They are changing the value in column1, which should change the order
>of the records in the grid based on the index. How can I get the grid to
>re-display the recordset, with the current record now displayed in this new
>position?
>

Not do use SetFocus in the grid, now I have found a new bug.

A simple solution is to make the editing on the line top:
PUBLIC oform1

oform1=NEWOBJECT("form1")
oform1.Show


DEFINE CLASS form1 AS form

	autocenter = .t.
	caption = "change the first column number"
	
	ADD OBJECT grid1 AS grid WITH ;
		Height = 200, ;
		Left = 5, ;
		Top = 5, ;
		Width = 350,;
		anchor = 15


	PROCEDURE Load
		CREATE CURSOR XX1CB (F1 I,F2 V(30))
		FOR N=100  TO 0 STEP -2
			INSERT INTO (ALIAS()) (F1,F2) VALUES(m.n,'Item n°'+sTR(m.n))
		ENDFOR
		INDEX on f1 TAG t1
	ENDPROC

	PROCEDURE grid1.AfterRowColChange
		LPARAMETERS nColIndex
		GO RECNO()
		PRIVATE rr
		FOR rr=2 TO m.this.RelativeRow
			=grid::doscroll(1)
		ENDFOR
		Grid::Refresh
	ENDPROC

ENDDEFINE
For the editing on an any line and to show the new order
maintaining it, it needs to write enough code.

>Thanks and regards
>Bill
Previous
Next
Reply
Map
View

Click here to load this message in the networking platform