Level Extreme platform
Subscription
Corporate profile
Products & Services
Support
Legal
Français
Edit, delete records in grid
Message
From
15/06/2004 12:36:59
Hilmar Zonneveld
Independent Consultant
Cochabamba, Bolivia
 
 
To
15/06/2004 12:25:29
General information
Forum:
Visual FoxPro
Category:
Forms & Form designer
Miscellaneous
Thread ID:
00913943
Message ID:
00913950
Views:
20
>Hello,
>
>I have a grid displaying the records of a child table.
>I would like the grid to, when clicked, perform the
>following:
>
>1. When a record (row on grid) is pointed at by the
> mouse and double-clicked, a new form will show
> containing the fields of the selected record
> for editing.

You must intercept the DoubleClick() Event for each of the contained TextBoxes (or other objects). This, of course, can be redirected to a standard method. For example, for the DoubleClick() Eventh, write ThisForm.EditRecord(); the EditRecord() method will call up the desired form.

>2. When a double-click is performed on the blank
> row, the form will show for creating a new record
> to the grid.

What blank row? The grid may easily be full.

>3. When the 'delete' key is pressed, the currently
> focused record is removed.

Use the KeyPress() Event, on the grid.

>Could someone tell me how to do this? Or more specificly,
>how can I detect it when the grid is clicked on a
>selected record or on a blank row?
>Thank you for any help.
>
>--
>jw

However, I would prefer having buttons on the form, or on a separate toolbar, for the desired actions. You can also have menu commands, for example, "Edit | Delete", with a shortcut such as Ctrl-D. The menu command can call _vfp.ActiveForm.DeleteRecord(), for example.

HTH,

Hilmar.
Difference in opinions hath cost many millions of lives: for instance, whether flesh be bread, or bread be flesh; whether whistling be a vice or a virtue; whether it be better to kiss a post, or throw it into the fire... (from Gulliver's Travels)
Previous
Reply
Map
View

Click here to load this message in the networking platform