Level Extreme platform
Subscription
Corporate profile
Products & Services
Support
Legal
Français
Grid refresh
Message
From
01/04/2000 15:20:38
 
 
To
01/04/2000 14:31:24
General information
Forum:
Visual FoxPro
Category:
Other
Title:
Miscellaneous
Thread ID:
00353931
Message ID:
00353944
Views:
19
>I am using the keypress event in a textbox to move the record pointer in a grid. The app I am writing requires a simple browse screen that allows input from the user to incrementally search the file or to move the pointer with the normal navigation keys.

Here's a runnable example that might help you. BTW, notice that I'm using the interactiveChange() method and not keypress().
*!* Begin Code
ox = CREATEOBJECT( 'form1' )
ox.show()
READ EVENTS
**************************************************
*-- Form:         form1 (c:\nec\library\classes\refreshgridexample.scx)
*-- ParentClass:  form
*-- BaseClass:    form
*-- Time Stamp:   04/01/00 01:20:00 PM
*
DEFINE CLASS form1 AS form


	DataSession = 2
	Top = 0
	Left = 0
	Height = 272
	Width = 403
	DoCreate = .T.
	Caption = "Form1"
	Name = "Form1"


	ADD OBJECT txtpsi AS textbox WITH ;
		Comment = "", ;
		ControlSource = "", ;
		Height = 23, ;
		Left = 9, ;
		MaxLength = 12, ;
		TabIndex = 4, ;
		Top = 36, ;
		Width = 122, ;
		Name = "txtPsi"


	ADD OBJECT command4 AS commandbutton WITH ;
		Top = 67, ;
		Left = 40, ;
		Height = 27, ;
		Width = 30, ;
		Caption = "<<", ;
		Name = "Command4"


	ADD OBJECT command5 AS commandbutton WITH ;
		Top = 67, ;
		Left = 71, ;
		Height = 27, ;
		Width = 30, ;
		Caption = ">>", ;
		Name = "Command5"


	ADD OBJECT command7 AS commandbutton WITH ;
		Top = 67, ;
		Left = 9, ;
		Height = 27, ;
		Width = 30, ;
		Caption = "|<<", ;
		Name = "Command7"


	ADD OBJECT command8 AS commandbutton WITH ;
		Top = 67, ;
		Left = 103, ;
		Height = 27, ;
		Width = 30, ;
		Caption = ">>|", ;
		Name = "Command8"


	ADD OBJECT grid1 AS grid WITH ;
		Height = 76, ;
		Left = 9, ;
		RecordSource = "daysofweek", ;
		Top = 148, ;
		Width = 385, ;
		Name = "Grid1"

	PROCEDURE QueryUnload
		this.release
		CLEAR EVENTS
		RETURN .T.	
	ENDPROC

	PROCEDURE Load
		SET SAFE OFF
		CREATE TABLE DaysOfWeek( nID N (8), cDayOfWeek C (9) )
		INSERT INTO DaysOfWeek(nID, cDayOfWeek) VALUES ( SECONDS()*1000, CDOW( DATE() ) )
		INSERT INTO DaysOfWeek(nID, cDayOfWeek) VALUES ( SECONDS()*1000 + RECNO(), CDOW( DATE() + RECNO() ) )
		INSERT INTO DaysOfWeek(nID, cDayOfWeek) VALUES ( SECONDS()*1000 + RECNO(), CDOW( DATE() + RECNO() ) )
		INSERT INTO DaysOfWeek(nID, cDayOfWeek) VALUES ( SECONDS()*1000 + RECNO(), CDOW( DATE() + RECNO() ) )
		INSERT INTO DaysOfWeek(nID, cDayOfWeek) VALUES ( SECONDS()*1000 + RECNO(), CDOW( DATE() + RECNO() ) )
		INSERT INTO DaysOfWeek(nID, cDayOfWeek) VALUES ( SECONDS()*1000 + RECNO(), CDOW( DATE() + RECNO() ) )
		INSERT INTO DaysOfWeek(nID, cDayOfWeek) VALUES ( SECONDS()*1000 + RECNO(), CDOW( DATE() + RECNO() ) )
	ENDPROC


	PROCEDURE txtpsi.InteractiveChange
		SET EXACT OFF
		SELECT daysofweek
		LOCATE FOR UPPER( cDayOfWeek )= UPPER( TRIM(this.value) )
		SET EXACT ON
		thisform.refresh()
	ENDPROC


	PROCEDURE command4.Click
		SKIP -1 IN DaysOfWeek
		IF BOF('DaysOfWeek')
			GO TOP IN DaysOfWeek
		ENDIF
		THISFORM.REFRESH()
	ENDPROC


	PROCEDURE command5.Click
		SKIP 1 IN DaysOfWeek
		IF EOF('DaysOfWeek')
			GO BOTTOM IN DaysOfWeek
		ENDIF
		THISFORM.REFRESH()
	ENDPROC


	PROCEDURE command7.Click
		GO TOP IN DaysOfWeek
		THISFORM.REFRESH()
	ENDPROC


	PROCEDURE command8.Click
		GO BOTTOM IN DaysOfWeek
		THISFORM.REFRESH()
	ENDPROC


ENDDEFINE
*
*-- EndDefine: form1
**************************************************
*!* End Code
Previous
Reply
Map
View

Click here to load this message in the networking platform