Welcome to Telelogic Product Support
  Home Downloads Knowledgebase Case Tracking Licensing Help Telelogic Passport
Telelogic DOORS (steve huntington)
Decrease font size
Increase font size
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
Search Topic Search Topic
Topic Tools Topic Tools
Quick Reply Quick Reply
Subscribe to this topic Subscribe to this topic
E-mail this topic to someone. E-mail this topic
Bookmark this topic Bookmark this topic
View similar topics View similar topics
View topic in raw text format. Print this topic.
Answer This question was answered by Louie Landale, on Tuesday, October 18, 2005 3:48 PM

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"
 13-Oct-2005 07:00
User is offline View Users Profile Print this message


Mikael Bendtsen

Posts: 11
Joined: 18-Feb-2003

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?
Report this to a Moderator Report this to a Moderator
 13-Oct-2005 22:13
User is offline View Users Profile Print this message


Louie Landale

Posts: 2070
Joined: 12-Sep-2002

Answer 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"
Report this to a Moderator Report this to a Moderator
 18-Oct-2005 15:49
User is offline View Users Profile Print this message


Mikael Bendtsen

Posts: 11
Joined: 18-Feb-2003

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
Report this to a Moderator Report this to a Moderator
Statistics
20925 users are registered to the Telelogic DOORS forum.
There are currently 0 users logged in.
The most users ever online was 15 on 15-Jan-2009 at 16:36.
There are currently 0 guests browsing this forum, which makes a total of 0 users using this forum.
You have posted 0 messages to this forum. 0 overall.

FuseTalk Standard Edition v3.2 - © 1999-2009 FuseTalk Inc. All rights reserved.