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 gkittelson on being selected by the Tek-Tips community for having the most helpful posts in the forums last week. Way to Go!

Browse vs Grid

Status
Not open for further replies.

David Higgs

Programmer
May 6, 2012
392
GB
I thought it best if I started a new thread to discuss various issues in migrating away from Browse.

My next issue with using a Grid is how to replicate the Browse "CTRL F" (find function). Searching a single field shouldn't be a problem but I'm not too sure how to go about searching all fields.


Regards,
David
 
Remember what I said in your previous thread:

The thing to remember about grids is that the navigation is performed on the underlying table, not on the grid itself.

Doing a search is just like any other way of moving the record pointer. You search the underlying table, using LOCATE or SEEK or whatever other method takes your fancy. Once you have found the desired record, you set focus back to the grid in order for the highlight to appear on the corresponding row.

The only added wrinkle is that you need a way of prompting the user for the search term. INPUTBOX() is one way of doing that.

Mike


__________________________________
Mike Lewis (Edinburgh, Scotland)

Visual FoxPro articles, tips and downloads
 
Actually FFC offers the find dialog in a VFP form class in ffc\_table.vcx _finddialog.
And it also has the code to traverse all fields in ffc\_table.vcx _tablefind, in the dofind().

I would read the code and let it inspire you rather than using it 1:1 as is, but that's up to you. In many ways a general find in all fields is taking longer and less potent than an individual find eg per column, but of course a general find solution doesn't afford individual code per table. The given ffc code could at least be optimized, if you eg search a letter you won't find it in a numeric or date field, even when it's transformed to char strings, as the ffc dofind code does, so there is lot's of searching in data not even a candidate to find something.

Bye, Olaf.
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top