Mastering PowerBuilder

HomePrevious Lesson: Course 3:: Session 24 :: Page 240
Next Lesson: Course 3:: Session 24 :: Page 260
Deleting the Data from the DataWindow

This is also the basic DataWindow service and is available by default with no code. However, the option to delete the record isn’t available from the Edit menu option, it’s available from the DataWindow’s popup menu.

PFC doesn’t apply the deletes in the database right away. User needs to apply the changes (including deletes) to the database by selecting "File/Save" from the menu. PFC prompts the user if he closes the window without saving the changes.

By default, PFC doesn’t confirm deletes. You can ask PFC to confirm for every delete by writing the following code:

dw_product.inv_RowManager.of_SetConfirmOnDelete( TRUE )

If you have enabled multiple row selection, if user selects "Delete" option from the popup menu when multiple rows are selected, PFC deletes only the last selected row. If you wish to provide the functionality of deleting all the selected rows, you can do so by calling of_DeleteSelected() function:

dw_product.inv_RowManager.of_DeleteSelected()

If you use DataWindow user object "u_dw" for reporting purpose, still this menu is available. You may want to disable delete option by writing the following code to the pfc_PreRmbMenu event of the specific DataWindow user object in the window.

am_dw.m_table.m_delete.enabled = False

Before displaying the popup menu, PFC triggers this event and sends the menu as argument "am_dw"

HomePrevious Lesson: Course 3:: Session 24 :: Page 240
Next Lesson: Course 3:: Session 24 :: Page 260