Message telling that a tag is about to be deleted



  • THE POST BELOW IS MORE THAN 5 YEARS OLD. RELATED SUPPORT INFORMATION MIGHT BE OUTDATED OR DEPRECATED

    On 02/08/2012 at 08:21, xxxxxxxx wrote:

    Is there any way to know, inside a TagData plugin that the tag is about to deleted? Or that the tag is being moved from one object to another?



  • THE POST BELOW IS MORE THAN 5 YEARS OLD. RELATED SUPPORT INFORMATION MIGHT BE OUTDATED OR DEPRECATED

    On 04/08/2012 at 04:49, xxxxxxxx wrote:

    I believe it is a bit hard to look into the future what the
    user is about to be doing:)

    Occasionally I've used a hidden check tag that is added
    by the main tag.
    The check tag is looking for the main tag and is filled
    with selected data from it.
    If then the main tag is deleted, the check tag do what it
    should based on selected data before deleting itself.

    Cheers
    Lennart



  • THE POST BELOW IS MORE THAN 5 YEARS OLD. RELATED SUPPORT INFORMATION MIGHT BE OUTDATED OR DEPRECATED

    On 04/08/2012 at 05:02, xxxxxxxx wrote:

    I was asking this because, for example, in RealBasic, when a user closes a window, that windows receives an event telling that it is about to be closed so that we can decide what to do before actually closing the window.
    I hoped that tags or objects could also receive that type of event message.
    But your solution works, of course. It is just more complex ;-)
    Thank you,

    Rui Batista



  • THE POST BELOW IS MORE THAN 5 YEARS OLD. RELATED SUPPORT INFORMATION MIGHT BE OUTDATED OR DEPRECATED

    On 04/08/2012 at 06:16, xxxxxxxx wrote:

    Originally posted by xxxxxxxx

    Is there any way to know, inside a TagData plugin that the tag is about to deleted?

    Yes. TagData is derived from NodeData, which has a Free() function. The C++ SDK says that Free() is:
    'Called when a node instance is deallocated. You can use this to for example deallocate member variables of your node data class.'

    So when the tag is about to be deleted, you get a call to Free() which you can override and do what you need. One thing you can't do as far as I can see is actually prevent the deletion.

    For when a tag is moved to another object, you would have to poll the tag and check to see if its owner had changed.

    Steve



  • THE POST BELOW IS MORE THAN 5 YEARS OLD. RELATED SUPPORT INFORMATION MIGHT BE OUTDATED OR DEPRECATED

    On 04/08/2012 at 07:09, xxxxxxxx wrote:

    Ok, thank you very much, Steve. This is a great help :-)

    Rui Batista



  • THE POST BELOW IS MORE THAN 5 YEARS OLD. RELATED SUPPORT INFORMATION MIGHT BE OUTDATED OR DEPRECATED

    On 05/08/2012 at 08:14, xxxxxxxx wrote:

    When I try to access the object where the tag is attached with:

    def Free(self,node) :
         obj=node.GetObject()
         print obj
         return

    I always get None. Isn't there a way to know what object the tag is attached before deleting it?



  • THE POST BELOW IS MORE THAN 5 YEARS OLD. RELATED SUPPORT INFORMATION MIGHT BE OUTDATED OR DEPRECATED

    On 05/08/2012 at 08:28, xxxxxxxx wrote:

    Well, I solved it by storing the current object that holds the tag inside the tag container, in the Execute method ;-)

    Rui Batista


Log in to reply