Home General
New Blog Posts: Merging Reports - Part 1 and Part 2

Prevent end user from deleting a component

edited February 2002 in General
Can you add a property to the TTppComponent that would prevent an end
user from deleting that component at run time? The work around using
OnSelectionChanged would prevent the end user from editing other
properties of the component and that fix is worse than the problem.

We have reports that use the OnCalc event to set the value some
tppVariable components based on some other components. If the end
user deletes the wrong component, the OnCalc event throws an AV
because the source component was deleted. Our work around is to the
user to right-click on the component and set visible to false. That
wouldn't work if the user couldn't select the component.

The desired behaviour would be to be able to set a property at design
time that would protect the user from deleting the component. At
runtime, a message dialog would be displayed saying that the component
was protected from deletion. It would be really nice if the
programmer could set the message text at runtime.

thanks,
Chris Miller
VersaTrans Solutions Inc

Comments

  • edited February 2002
    Yes, I agree. A locked style feature would be nice, so that they couldn't
    move it or delete it.

    TppLabel.Locks := [lkMovable, lkDeletable];

    Then you could override the OnDeleteAttemptMsgCreate event of the
    component...

    Something like this is on the ToDo list. Thanks for the suggestion.


    Cheers,

    Jim Bennett
    Digital Metaphors

  • edited February 2002
    Until then, you can create a "Repair" routine that browses through the whole
    report and recreates components that should always be present. Run this
    whenever the designer has been in use.

This discussion has been closed.