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

Using a grid as an input screen 1

Status
Not open for further replies.

suec032a

Programmer
Jun 22, 2009
20
AU
Hi,

I am updating a 2.6 app to VFP 9.0 SP2 and I need to design a screen that contains booking information for a customer. There are 20 fields for each booking, 4 of these are memo fields and 7 are logical fields. The client wants to limit the number of bookings (dates), displayed per customer to 6.

I thought I would use a grid as an input screen, but I am not sure if this is advisable given the number of columns to be displayed?

My booking.dbf has only the minimum 20 fields defined, instead of repeating this information 6 times for each booking.

Any assistance would be great.

Sue
 
Sue,

This is a matter of opinion, but personally I would not use a grid for data entry in this case.

With 20 columns, the grid will be akward for the user; it will be difficult to navigate, and would not be able to display all the data for a given booking without horizontal scrolling. There would also be the issue of how to display the memo fields.

I suggest you use the grid purely for navigation, and use text boxes, checkboxes and edit boxes for the data entry.

Let the grid show just the main details of the booking, such as the date or the booking ID. When you move to a new customer, update the grid to show just that customer's bookings. Make the grid read-only.

As the user clicks on the rows within the grid, have the textboxes, etc. show the data for the individual booking. The user would edit the data directly in those controls.

That's how I would do it. But as I say, it's a matter of opinion.

Mike

__________________________________
Mike Lewis (Edinburgh, Scotland)

Visual FoxPro tips, advice, training, consultancy
Custom software for your business
 
The client wants to limit the number of bookings (dates), displayed per customer to 6.
If there are only six bookings on scren then you'd have a very short, fat grid. Could you do it as a form with six tabs across a page frame? That would give you plenty of space on each tab to display the memo fields.

Geoff Franklin
 
I think I'd use a listbox or treeview to let the user navigate through the bookings and show the details for one booking at a time.

Tamar
 
Thank you all so much. I am still learning VFP 9 so all your suggestions are really useful.

I forgot to mention that this screen is page 3 of a pageframe so I have a go at the grid option.

I have not used treeviews yet so I will definitely being reviewing this topic.

thanks again

Sue

 
Hi,

I have been trying to get the grid showing the dates for the customer, that Mike suggested working, but I am having trouble with only displaying this customer's record.

My form is a pageform with 3 pages and a data environment that has 3 tables with the relationships based on customer id. All the text boxes display the correct customer data.

The page3.activate has the following code:

thisform.knpageframe1.page3.grdBooking.Refresh()
thisform.knpageframe1.page3.grdBooking.SetFocus()

However, when the page displays, the grid's focus is on the correct customer, but other customer records are displayed at the top and bottom of the grid. How do I only display the required customer record? I thought since there is a relationship present, this would happen automatically?

Thanks again for all your help.
Sue




 
The raltionship isn't sufficient to filter records. But there is a sample doing what you want:

open the task pane, click on solution samples. Search "relationship", then choose the sample called "Display child records from a relationship".

The form uses the northwind database and displays orders and order items of a customer.

The grids only display the records belonging to the customer or order respectively. The secret is, how the grid properties are set.

If you look into the source code of that form you see the grids ChildOrder, LinkMaster and RelationalExpr are set. This is making the grids act that way and also filter records.

This is very foxpro specific and in the long run you're better off with views or cursoradapters you trigger to retrieve only the data needed, instead of binding to tables using relations and these grid settings. The larger your database grows the more sluggish this will get.

Bye, Olaf.
 
Hi Olaf,

I set the grid properties as the solutions indicated, and I still get the other records appearing.

When I place this grid on a single form, these settings work, so is there a problem perhaps with having the grid within a pageframe?


thanks
sue

 
Hi Olaf,

I found the problem was in my DE on the form with the pageframe. Once I set the relationship in code, it worked.

Thanks again

Sue
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top