Board index » delphi » Navigator: stopping a (delete) button click.

Navigator: stopping a (delete) button click.

How do you stop a delete button, or any button, action from the Navigator.

I have a master/detail relationship. When they press a delete button on the
Navigator linked to the master table, I want to ask if they want the detail
records, if any, deleted. If they reply no, then I want to stop the delete of
the master record. I.e., I want to customise the confirm delete message.

I have turned off confirmDelete on the Navigator. I am trapping the onDelete
event on the TTable component. If they reply no to my confirm dialog. I cannot
find a way (online help, manuals, and a text book) to stop the delete of the
master record. Therefore, even if they reply yes, it either deletes the
master, or, if there are detail records, generates an EDatabaseError
exception.

I realise that an alternative would be to:

(1) Trap the exception and then delete master records before retrying the
operation, or
(2) get the advanced navigator I saw in another message.

But, this seems to be a regular requirement to 'stop' and event.

TIA.

+---------------------------
| Simon Thompson
| Christchurch
| New Zealand

 

Re:Navigator: stopping a (delete) button click.


Look at the OrderForm in Delphi demo MASTAPP, and search the code
with keyword "Abort". That should do it.  

Quote
Simon Thompson wrote:

> How do you stop a delete button, or any button, action from the Navigator.

> I have a master/detail relationship. When they press a delete button on the
> Navigator linked to the master table, I want to ask if they want the detail
> records, if any, deleted. If they reply no, then I want to stop the delete of
> the master record. I.e., I want to customise the confirm delete message.

> I have turned off confirmDelete on the Navigator. I am trapping the onDelete
> event on the TTable component. If they reply no to my confirm dialog. I cannot
> find a way (online help, manuals, and a text book) to stop the delete of the
> master record. Therefore, even if they reply yes, it either deletes the
> master, or, if there are detail records, generates an EDatabaseError
> exception.

> I realise that an alternative would be to:

> (1) Trap the exception and then delete master records before retrying the
> operation, or
> (2) get the advanced navigator I saw in another message.

> But, this seems to be a regular requirement to 'stop' and event.

> TIA.

> +---------------------------
> | Simon Thompson
> | Christchurch
> | New Zealand

Other Threads