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

Grid question.

Status
Not open for further replies.

738262

Programmer
Mar 3, 2002
41
CY
Hi all,

I need your help on grid control.

I have a grid on a form with the AllowAddNew set to .t.
I have two questions.
1. How can I add a new record without having to be positioned on the last record in the grid and pressing the down arrow? Just by clicking with the mouse on the row after the last record displayed by the grid.

and

2. If the table is empty how can I add a new record with the mouse or keyboard?

Thank you.
 
In the Grids Click event,

APPEND BLANK

OR more safely..

Set the ALlowAddNew property to .t. as you said above.
and add the code in the Grids click event
GO BOTTOM
KEYBOARD '{DOWNARROW}'

The grids click event will work only when you click on the grids non row area.. i.e. plain bottom area of the grid.

The next alternative is to have a separate button and thru its click event, append a record and set the focus to the grid.

:)

____________________________________________
ramani - (Subramanian.G) :)
When you ask VFP questions, please add VFP version.
 
I mix with common users. They have observed their tendency to click on and off on the form. So it is better to provide RightClick for appending new record instead of Click. Best way would be to have a menu or toolbar with New, Save, Abot changes buttons.

Please refer Order Entry form in Transtrade in the VFP Help.

TO answer the second question,

Check whether the table is empty.
If no,
usual procedure as suggested by Ramani (APPE BLAN),
else,
display a message while launching the form that "Table is empty. Start entering data when the form appears." Here situation will be the same as that while entering 10th record. Enforce validation if user tries to save blank record.

Puru
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top