Method SetDeleteMode()  Class TSBrowse 

 

 

Sintax: oBrw:SetDeleteMode( lOnOff  , lConfirm , bDelete , bPostDel  )

 

Description:

 

It allows the user to delete the active row of the Browse by pressing the [Del] key. This Method only activates this feature. Deletion is done by method DeleteRow().

 

Parameters:

 

LOnOff             ( Optional )  A value of .T. activates the automatic delete feature, a value of .F., deactivates it.

                       

If omitted it is assumed .T.

 

lConfirm          ( Optional )  A value of .T. makes TSBrowse to ask the user to confirm the deletion of the row (record).

                                           A value of .F. permits to delete the row (record) without confirmation.

 

If  lConfirm is omitted, will be assumed .T.

 

bDelete           ( Optional )  Code Block that TSBrowse will evaluate BEFORE the deletion of the row, passing 3 parameters:

 

1. - RecNo() in case of databases, nAt in case of Arrays.

 

2. - Self ( Reference to the TSBrowse object).

 

3. - lRecall  .T. if the record has been previously deleted. ( See Note).

 

In addition to the user confirmation, if this Block returns a value of .F., the record will NOT be deleted, or recalled.

 

Note: When the record has been previously deleted, and the use presses the key [Del], TSBrowse will recall the record using the function DbRecall() (Obviously only if SET DELETEDis = OFF).

 

bPostDel          ( Optional )  Code Block that TSBrowse will evaluate AFTER the row deletion, receiving as unique parameter a reference to the TSBrowse object.

 

Returns: A reference to the same TSBrowse modified object.

 

Example:

 

bMyBlock   := { | nRecNo,oBrw,lRecall | YesYouMay( nRecNo, oBrw, lRecall ) }

                        bPostBlock := { | oBrw | WhatEverUpdate( oBrw ) }

 

oBrw:SetDeleteMode( .T., .T., bMyBlock, bPostBlock )

 

In this example, TSBrowse will ask for the user’s confirmation and will delete or recall the record only when YesYouCan() function returns TRUE. After the row deletion, TSBrowse will execute the function WhatEverUpdate().