Tek-Tips is the largest IT community on the Internet today!

Members share and learn making Tek-Tips Forums the best source of peer-reviewed technical information on the Internet!

  • Congratulations biv343 on being selected by the Tek-Tips community for having the most helpful posts in the forums last week. Way to Go!

Find text inside a grid 1

Status
Not open for further replies.

JaneJantz

Programmer
Sep 13, 2000
55
US
Is it possible to use the Find (_med_find) inside a grid like we can inside a browse? I have a menu on top of the form with the system menu options of _med_find,_med_finda,_med_cut... but only the _med_cut works.
 
have used grids and text search's alot in foxpro, best way i found is to use text box to do incremental search, is fast, check out universalthread.com, goto download section, and search on grid they have a sample code snippet there
 
Thanks much... I had put in a txtbox, but was not doing the incremental search... I will try it... thanks again for taking the time to help!
 
You can set the InterActiveChange event of the text box to make a soft seek for the grids text control. You can make the incremental search by adding the lastkey() to the cumulated text value stored as a property to the form.

You can also do a soft seek using KeyPress event.

If the KeyPress event of the form needs to control over that of a textbox, remeber to set the Forms KeyPreView property to .t. This tip will help if you want to expand the interactive change event to capture the down arrow, up arrow, tab, enter or esc keys to do just their default function and not participate in the incremental change. ... example
KeyPree Event of a form.......
LPARAMETERS nKeyCode, nShiftAltCtrl

IF nKeyCode = 13
ThisForm.Nav_search1.cmdExit.Click()
ENDIF

IF nKeyCode = 5 .AND. !BOF()
ThisForm.Nav_search1.cmdPrevious.Click()
NODEFAULT
ENDIF
IF nKeyCode = 24 .AND. !EOF()
ThisForm.Nav_search1.cmdNext.Click()
NODEFAULT
ENDIF
IF nKeyCode = 18 .AND. !BOF()
SKIP - WROWS()
ThisForm.Nav_search1.cmdPrevious.Click()
NODEFAULT
ENDIF
IF nKeyCode = 3 .AND. !EOF()
SKIP WROWS()
ThisForm.Nav_search1.cmdNext.Click()
NODEFAULT
ENDIF
=================================
There are number of ways to do this search. I hope the above helps.
Ramani
 
wow, great stuff... thanks much. I am starting to really get into this stuff!
Jane
 
You might want to explore:

Heres the description:
Remember using +F in browse windows for a quick and dirty way to search every field? Its the one feature of the standard grid class that I miss.

This class will allow you to enter a value and then will search column by column, row by row until it finds a match or has gone the whole way around.

There is room for TONS of improvment, but this will get you started!
Jon Hawkins

The World Is Headed For Mutiny,
When All We Want Is Unity. - Creed
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top