Level Extreme platform
Subscription
Corporate profile
Products & Services
Support
Legal
Français
Inserting rows in grids
Message
From
24/09/1997 09:43:16
 
 
To
24/09/1997 09:02:27
General information
Forum:
Visual FoxPro
Category:
Forms & Form designer
Miscellaneous
Thread ID:
00051369
Message ID:
00051378
Views:
30
>I am relatively new to VFP 5.0. I am currently developing an application that has a form consisting of 2 combo boxes, several text boxes and a grid. The data environment of my form has 6 linked tables and my initial selected alias in the data environment is the table I am displaying in the grid on the form.
>
>I make a selection in each combo box and the grid displays the filtered information by set filter to ... statements in the InteractiveChange events of the combo boxes.
>
>In the right click event of the grid, and its columns, code exists to allow add/removal of grid records. This is set up almost the same way it is in the TasTrade application that comes with VFP 5.0.
>
>Let's say the grid already has 4 rows displayed on it. When I right click on the grid and select add, I am placed in the 5th row and in column on the grid that has a combo box control. That's OK. Once I've made my selection in the combo box, the 5th row becomes the top displayed row in the grid. That's not OK. I want the current row added to remain the last row displayed on the grid. I can still display the first four rows if I press the up vertical scroll bar arrow.
>
>How do I get the grid to continue displaying the first so many records already entered while I append a new row? In addition, if I fill the grid, I want make sure that each row scrolls up one row, the top displayed row goes off the display and I can append my new row on the bottom row of the grid. Thanks.

There are two things you have to remember and use:
1. Inserting a row in grid you actually insert a record into RecordSource, and if recordsource is ordered, new record position is not always the last. Therefore you have to create new record (using Insert-SQL) with default values providint the last position in active index sequence.
2. In regard to Grid behaviour, moving active row on top of display. This is normal result of Grid.Refresh. You can make a trick here firing Grid.Doscroll(2) in code to imitate scroll page up.
Edward Pikman
Independent Consultant
Previous
Reply
Map
View

Click here to load this message in the networking platform