Level Extreme platform
Subscription
Corporate profile
Products & Services
Support
Legal
Français
A grid problem everyone has grown to accept.
Message
 
General information
Forum:
Visual FoxPro
Category:
Forms & Form designer
Miscellaneous
Thread ID:
00691173
Message ID:
00691621
Views:
18
>Not an answer on your question, but here is a code, which may help: (method is called LocateRecordOnTop)
>
>*--------------------------------------------------------------------------
>* -- NSL 3/2/00
>* -- Added this method per Nadya's request
>* -- It is not automatically called but is available if the user would like to use.
>* -- It is intended to be called on return from the search button to place the intended record
>* -- at the top of the grid.
>* -- NSL 10/10/01  Nadya wanted to be sure that Walter Meester is appropriately credited for this change
>*--------------------------------------------------------------------------
>
>thisform.lockscreen=.t.
>nHeight = this.height
>this.height = this.headerheight + this.rowheight
>this.refresh
>this.height=nHeight
>thisform.lockscreen=.f.
Thank you for this excellent code tip. Today I have played around with a sample TEST form with a textbox and a grid. I have put your code into the lostfocus of the textbox. The code works very well. I don't have any code in the grid. The backcolor stays green while the user is in the textbox, goes grey if the entry typed is not found, and goes yellow if the user clicks outside the textbox (lost focus). The Lastkey() = 13 prevents the textbox from losing focus each time enter is pressed. Users can search by Code order or Item order in the same textbox.
The code does seem easier and possibly faster than the doscroll code.
If NOT EMPTY(THIS.VALUE)
Select ITEM
Set ORDER TO ITEM
Seek ALLTRIM(THIS.VALUE)
If FOUND()
	Thisform.lockscreen=.T.
	With THISFORM.GRID1
		nHeight = .height
		.height = .headerheight + .rowheight
		.refresh
		.height=nHeight
	Endwith
	Thisform.lockscreen=.f.
	Thisform.TEXT1.SETFOCUS()
Else
	Set ORDER TO CODE
	Seek ALLTRIM(THIS.VALUE)
	If FOUND()
		Thisform.lockscreen=.T.
		With THISFORM.GRID1
			nHeight = .height
			.height = .headerheight + .rowheight
			.refresh
			.height=nHeight
		Endwith
		Thisform.lockscreen=.f.
		Thisform.TEXT1.SETFOCUS()
	Else
		*? chr(7)
		Thisform.GRID1.REFRESH() && show table is at end of file
		This.VALUE = "  "
		This.backcolor=rgb(192,192,192) && grey out textbox 
	Endif
 Endif
 If LASTKEY() = 13 && IF enter pressed, do not move out
	Nodefault
 Endif
Else
  This.BACKCOLOR = RGB(255,255,128) && yellow
Endif
Thank you again
David Wheeldon
Previous
Next
Reply
Map
View

Click here to load this message in the networking platform