Level Extreme platform
Subscription
Corporate profile
Products & Services
Support
Legal
Français
VFP 3.0 - How Do You Make Grid Show Current Record
Message
From
08/05/1998 12:03:11
Cetin Basoz
Engineerica Inc.
Izmir, Turkey
 
General information
Forum:
Visual FoxPro
Category:
Forms & Form designer
Miscellaneous
Thread ID:
00098099
Message ID:
00098104
Views:
24
>With a simple flat database, indexed on one key field (i.e. name),
>
>I created a grid where a user can select a record, hit 'select' and
>then be brought to the correct record on a dataentry form.
>
>A enhancement was to add a text box where you can do a incremental
>search. After each letter is entered, the grid is refreshed to
>show the record found.
>
>PROBLEM: In the grid, numerous records are shown. I would like
>to have the current record highlighted either with a arrow or color change.
>
>Any hints as to what method I should be trying to implement?
>
>Thanks!!
Try with this grid class and call its recchange() method when outside of grid (ie:after seek). Alternatively you could use ingrid class (ingrid.zip in files section)
**************************************************
*-- Class:        highlighted (c:\temp\test.vcx)
*-- ParentClass:  grid
*-- BaseClass:    grid
*-- Current row highlighted grid.
*
DEFINE CLASS highlighted AS grid


	Height = 200
	Width = 320
	ccurrecbackcolor = (RGB(0,0,255))
	ccurrecforecolor = (RGB(255,255,0))
	PROTECTED lingrid
	lingrid = .T.
	ncurrec = .F.
	Name = "highlighted"


	PROCEDURE When
		this.lInGrid = .T.
	ENDPROC


	PROCEDURE Valid
		this.lInGrid = .F.
	ENDPROC


	PROCEDURE Init
		WITH this
			IF !empty(.RecordSource)
				.nCurRec = recno(this.RecordSource)
				.SetAll("DynamicBackColor", "IIF(RecNo(This.RecordSource) = This.nCurRec," + ;
					str(this.cCurRecBackColor)+","+str(this.BackColor)+")", "Column")
				.SetAll("DynamicForeColor", "IIF(RecNo(This.RecordSource) = This.nCurRec," + ;
					str(this.cCurRecForeColor)+","+str(this.ForeColor)+")", "Column")
			ENDIF
		ENDWITH
	ENDPROC


	PROCEDURE BeforeRowColChange
		LPARAMETERS nColIndex
		thisform.LockScreen = this.lInGrid
	ENDPROC


	PROCEDURE AfterRowColChange
		LPARAMETERS nColIndex
		this.nCurRec = recno(This.RecordSource)
		thisform.LockScreen = .F.
		IF !this.lInGrid
			this.refresh()
		ENDIF
	ENDPROC


	*-- Refresh when recpointer moves. For calling outside of grid.
	PROCEDURE recchange
		This.nCurRec = recno()
		This.refresh
	ENDPROC


ENDDEFINE
*
*-- EndDefine: highlighted
**************************************************
Cetin
Çetin Basöz

The way to Go
Flutter - For mobile, web and desktop.
World's most advanced open source relational database.
.Net for foxheads - Blog (main)
FoxSharp - Blog (mirror)
Welcome to FoxyClasses

LinqPad - C#,VB,F#,SQL,eSQL ... scratchpad
Previous
Reply
Map
View

Click here to load this message in the networking platform