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 not accepting key strokes on a form 1

Status
Not open for further replies.

coldan

Programmer
Oct 19, 2008
98
AU
I have created a simple form with a single column grid to accept numbers typed in.

It's controlling table is a single field table with a n (10) to which I have appended 100 empty records.

This table with added numbers is used in a SQL JOIN to extract the required number's records from a much larger table.

At the moment the grid on the form displays but is not 'active' ie I cannot make any entries in a cell and the cell is not shown as active ( I presume an active cell will show as 'black').

An [Exit] button on the form operates correctly.

I have removed the 'deleted' column also but I may include it to allow the user to reuse the table and make deletions as well as additions.

A second small detail is that whilst the vertical scroll bar is useful at present the horizontal one is not required as the grid is the width of the single field.

I presume any added records ( with a numeric entry) will be 'saved' when I exit the form.

When this is working I intend to base the grid on a single record table and add an APPEND BLANK when the focus is moved to another cell.

Has anyone any suggestions as to what I am missing? I have not created a form with a grid before - all of my grids in my other applications are created programmatically.

Thanks

Coldan
 
Coldan,

I'll try to answer you various points:

At the moment the grid on the form displays but is not 'active' ie I cannot make any entries in a cell and the cell is not shown as active ( I presume an active cell will show as 'black').

No, an active cell is not black. It is the same colour as all the other cells. By default, the cell will receive focus when the user clicks in it, or tabs to it. The user can then start typing.

If that's not happening, check the grid's AllowCellSelect property.

I have removed the 'deleted' column also but I may include it to allow the user to reuse the table and make deletions as well as additions.

I'd suggest you don't include the "deleted" column. It's better to provide a button for deleting the selected record. In the button's click event, delete the current record in the underlying table, then either refresh the grid or simply set focus to it (using the grid's SetFocus method).

This is far more intuitive then getting the user to click on the "deleted" column, the appearance of which doesn't really convey its function.

A second small detail is that whilst the vertical scroll bar is useful at present the horizontal one is not required as the grid is the width of the single field.

Use the grid's Scrollbars property to control this. You might also need to slightly adjust the width of the grid's column, to prevent the grid scrolling when you hit the Tab key.

I presume any added records ( with a numeric entry) will be 'saved' when I exit the form.

Yes - if the grid is bound directly to a physical table (that is, if the column's ControlSource points the relevant field in the table). But if the table is buffered, you will need to issue a TableUpdate() to commit the changes.

I hope this will get you started.

Mike

__________________________________
Mike Lewis (Edinburgh, Scotland)

Visual FoxPro tips, advice, training, consultancy
Custom software for your business
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top