Avoid immediately deleting objectsAvoid immediately deleting objectsRE: Avoid immediately deleting objectsMateusz Dziedzichttps://www.adoxx.org/live/c/message_boards/find_message?p_l_id=&messageId=14384152018-12-10T08:13:24Z2018-12-10T08:06:49ZOne possibility is to use the "<a href="https://www.adoxx.org/AdoScriptDoc/files/Events/Core/BeforeDeleteInstance-js.html#BeforeDeleteInstance">BeforeDeleteInstance</a>" event to execute a script before an instance is deleted. Within the script you can define a query for the user. Thereafter you can use the returned value as an input for the <a href="https://www.adoxx.org/AdoScriptDoc/files/General_AdoScript_Commands/EXIT-js.html#EXIT">EXIT</a> command to either stop the execution of the code and thus preventing the deletion of an instance or not.<br /><br />The code for this purpose would look the following (You place the event in the external coupling of your library): <br /><div class="code"><span class="code-lines">1</span>ON_EVENT "BeforeDeleteInstance" {<br /><span class="code-lines">2</span>EXECUTE file: ("db:\\EVENT_before_delete_instance.asc") scope:same <br /><span class="code-lines">3</span>EXIT(nBeforeDeleteInstanceExit)<br /><span class="code-lines">4</span>}<br /></div><br />In this case the content of the EVENT_before_delete_instance.asc AdoScript file looks the following:<br /><div class="code"><span class="code-lines">1</span>CC "AdoScript" QUERYBOX "Ary you really sure that you want to delete this object?" yes-no def-no<br /><span class="code-lines">2</span># -->RESULT endbutton:strValue<br /><span class="code-lines">3</span>IF(endbutton = "no") {<br /><span class="code-lines">4</span> SET nBeforeDeleteInstanceExit: -1<br /><span class="code-lines">5</span>} ELSE{<br /><span class="code-lines">6</span> SET nBeforeDeleteInstanceExit: 0<br /><span class="code-lines">7</span>}<br /></div><br />Thus,depending on what option the user selects on the querybox the variable “nBeforeDeleteInstanceExit” will hold either -1 or 0. The value serves as a parameter for the EXIT command within the “ON_EVENT” scope. EXIT (0) means that there will be no abortion and the instance will be deleted. EXIT (-1) means that the execution will be aborted without an error and the instance will not be deleted. <br /><br />See attached an example library with the included event and the corresponding AdoScript file.Mateusz Dziedzic2018-12-10T08:06:49ZAvoid immediately deleting objectshttps://www.adoxx.org/live/c/message_boards/find_message?p_l_id=&messageId=14351802018-12-07T13:51:49Z2018-12-07T13:50:46ZHi!<br /><br />It sometimes happens to me that I accidentally delete an object when moving too fast through the context menu. The problem is that if the object has some connectors all the connectors are also deleted and I have to model it once again. But if one just cuts the object, then a message is displayed warning that there are some connectors associated with this particular object. This is not the case if one simply selects Delete from the context menu. Is there a possibility to avoid the deleting of the connectors or at least to warn the user before all the objects will be deleted?2018-12-07T13:50:46Z