Plateforme Level Extreme
Abonnement
Profil corporatif
Produits & Services
Support
Légal
English
A grid problem everyone has grown to accept.
Message
Information générale
Forum:
Visual FoxPro
Catégorie:
Gestionnaire d'écran & Écrans
Divers
Thread ID:
00691173
Message ID:
00691647
Vues:
15
Hi David,

The code belongs to Walter Meester. I asked my colleague to add a proper credit to him. She put it in the comment to this method, but not the way I hoped... I usually put a header in every method, where I attributed code to its creator...

Anyway, I'm glad, you find his tip useful. I like it too for its simplicity.

>>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
If it's not broken, fix it until it is.


My Blog
Précédent
Répondre
Fil
Voir

Click here to load this message in the networking platform