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

Search within a form 4

Status
Not open for further replies.

Phil Thoms

Programmer
Oct 31, 2005
245
GB
Hi, As most of you will realise with recent queries I am migrating to VFP6 from FP 2.6.
I want to use a textbox in a form to search for a record in a large database, once the record is found I wish to browse the result in a larger form. What is best way of achieving this. This would quite simple in the old FoxPro but not sure where code goes in VFP.
Thanks.
 
While it's true, what wOOdy shows there, it's tedious to transform a browse window at runtime, which is what you're doing, if you BROWSE NAME oBrowse NOWAIT and then change the browse window structure via the oBrowse variable. You can do all this with a grid, have it embedded in a form and do all the manipulations visually within the form or class editor and see what you get 1:1

Browse to me is a developer tool to look inside a dbf with a very sparse user interface I wouldn't want to present a user. Data needs to be normalized for data persistence, but users want to see data in a denormlaized natural composition. That is where the data access layer and business logic should always take the steps to turn the data into more natural objects or cursor to display them in forms in grids or listboxes, in several pages of a pageframe, however complex it needs to be.

You can see a browse as a very simple form, but it has a stoneage appeal, it's too tightly coupled to the data. You also won't use the data sheet of Access to view a table or query as a gui frontend.

It's nice, that you can have a hands on the grid, which is inside a browse window. But then, if you like that, you like a grid, then use a grid on a form. You'll likely find something you want to display outside of the list additional to it, like head record data or a summary, even if the form just has an additional border around the grid and a close or edit button on it, it's already much better than a browse.

Bye, Olaf.
 
Thanks for all your help, my project is progressing slowly but surely.
 
"my project is progressing slowly"

Don't despair.
You are in the new learning curve portion of the conversion process.

Once you begin to understand how/where it might be best to put objects, code, etc. (note - there are MANY, MANY 'right' ways to do something) in the new VFP format things will begin to move more quickly as you do so for other sections of the code.

The end result will be well worth the effort.

Feel free to come back and we'll do our best to continue to help you as you keep 'plowing through' the conversion.

Good Luck,
JRB-Bldr
 
OlafDoschke said:
While it's true, what wOOdy shows there, it's tedious to transform a browse window at runtime, which is what you're doing, if you BROWSE NAME oBrowse NOWAIT and then change the browse window structure via the oBrowse variable. You can do all this with a grid, have it embedded in a form and do all the manipulations visually within the form or class editor and see what you get 1:1

Boiled down even simpler, if you're determined to have the interface provided by BROWSE it's really simple to create your own.

Create a form, drop a grid on it. In the form's INIT:

Code:
this.Resize()

In the form's resize:

Code:
With this.Grid1
  .top = 0
  .left = 0
  .height = this.height
  .width = this.width
Endwith

And then you have a fully functional "browse" in a form that fully participates in the object model and event model. Open any table and DO FORM yourform to see it in action. Your new browse will operate on any table open in the current workarea.

Seven lines of code.

But more important, you can subclass the grid you use and teach it all the tricks you need. That's difficult (and I'm being charitable) to do with a native BROWSE.
 
Thanks for latest help. Things now running smoother.
How do you get rid of the Fox Icon in a form title bar
and switching off the title bar doesn't seem to work properly also I want to delete the closable button in top right-hand corner.
Thanks again for your help and wishing you a prosperous new year.
 
How do you get rid of the Fox Icon in a form title bar

Philthoms, you really should start a new thread for that question. It's got nothing to do with searching within a form.

By putting a question in its own thread, with a meaningful subject line, you enable other forum members to easily find the question - either to answer it or to see someone else's answer.

Mike

__________________________________
Mike Lewis (Edinburgh, Scotland)

Visual FoxPro articles, tips, training, consultancy
 
Yes, it might be okay to ask some side question, but tek-tips is free and we're all here to also read and answer a new thread, so why don't you simply start new treads for each new question?

Bye, Olaf.
 
Philthoms - another reason to ask your new question in a different posting would be that there might be other individuals needing an answer for the same question and they would never have any way of knowing to look into this posting, based on its title, for the answer.

Good Luck,
JRB-Bldr
 
Hi to all!
Talking about good old dBase....
I slightly remember I once started database programming using dBaseII on CP/M OS. <G>
-Bart
 
Philthoms - As you work to come up to speed in VFP, you might find this article useful:


A few of us wrote it to point people making this transition to the key items to learn along the way.

Tamar
 
Tamar,

Your post reminded me that Databased Advisor will close at the end of this month.

If anyone wants to read the article that you mentioned, they need to do so quickly.

I posted more details of the closure here: thread184-1633078

Mike

__________________________________
Mike Lewis (Edinburgh, Scotland)

Visual FoxPro articles, tips, training, consultancy
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top