![]() |
Telelogic DOORS (steve huntington) | ![]() |
new topic :
profile :
search :
help :
dashboard :
calendar :
home
|
||
Latest News:
|
|
Topic Title: Trigger problem when using apply to all in view or to selected objects Topic Summary: Created On: 13-Oct-2005 07:00 Status: Post and Reply |
Linear : Threading : Single : Branch |
![]() |
![]()
|
![]() Answer: I ran a test using a post-save attribute trigger that acknowledged the ID of the object being changed. It works. When I select 2 objects and use the object editor to modify the attribute and opting to do all selected objects, the trigger fired twice but displayed the first object twice, instead of displaying the 2nd object the 2nd time. That looks like a clear bug. But Wait!! The trigger code used the notion of the "current object" which, it turns out, is incorrect. That's the last one you selected and NOT the one being modified. The Trigger code needs to first get a handle on the trigger itself via "Trigger trg =current", and then get a handle on the object being modified via "Object obj = object(trg)". Then set the value of your control attribute using handle "obj". Try the dynamic trigger code run from a module open Exclusive. Notice the info box gets the current object and then the object being modified by the trigger. void DoTrig(Trigger trg) { infoBox(identifier(current Object) "\t" object(trg) "\tChanged ") } trigger(attribute, save, 2, DoTrig) - Louie Perhaps you also need to get a handle on the attribute being modified, via "AttrDef ad=attrdef(trg); string NameAttr = ad.name" | |
![]() |
|
Hi all,
I'm writing a trigger that fires post modification of certain attributes. The actual trigger code is very simple as it sets another attribute to a specific value on the object being modified. This all works fine. My problem occurs when the user wants to apply changes to multiple objects by right-clicking an object, selecting the attributes tab, selecting the attribute and clicking the edit button. As you all know, in this dialog it's possible to apply changes to the current object, selected objects or all objects in the current view. This is a case my trigger code doesn't handle since it makes changes to the current object only. What I want to achieve is that the trigger would change the attribute it sets even if objects are changed through the dialog in question. Does anyone have a good solution for this problem? |
|
![]() |
|
![]() |
|
I ran a test using a post-save attribute trigger that acknowledged the ID of the object being changed. It works. When I select 2 objects and use the object editor to modify the attribute and opting to do all selected objects, the trigger fired twice but displayed the first object twice, instead of displaying the 2nd object the 2nd time.
That looks like a clear bug. But Wait!! The trigger code used the notion of the "current object" which, it turns out, is incorrect. That's the last one you selected and NOT the one being modified. The Trigger code needs to first get a handle on the trigger itself via "Trigger trg =current", and then get a handle on the object being modified via "Object obj = object(trg)". Then set the value of your control attribute using handle "obj". Try the dynamic trigger code run from a module open Exclusive. Notice the info box gets the current object and then the object being modified by the trigger. void DoTrig(Trigger trg) { infoBox(identifier(current Object) "\t" object(trg) "\tChanged ") } trigger(attribute, save, 2, DoTrig) - Louie Perhaps you also need to get a handle on the attribute being modified, via "AttrDef ad=attrdef(trg); string NameAttr = ad.name" |
|
![]() |
|
![]() |
|
Louie,
Thanks so much for your help. I had made the mistake to use the handle to the currently selected object instead of the object handle available through the trigger itself. It seems to be working well now. Best regards, -- Mikael |
|
![]() |
FuseTalk Standard Edition v3.2 - © 1999-2009 FuseTalk Inc. All rights reserved.