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: Triggering on selecting an Object
Topic Summary: I want to always know what the "current Object" is even before any operations are performed on it
Created On: 27-Sep-2007 01:19
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 Tony Goodman, on Thursday, September 27, 2007 7:06 PM

Answer:
This can work successfully with dynamic triggers.

The attached code is one of my scripts thats had all the interesting stuff ripped out.
This shows how to use object sync triggers to update the dialog.
I beleive this to be quite robust as the original script gets well used by a lot of users.

Points to note are:
1. You need a pre-sync AND a post-sync trigger. This protects you against setting a current object that is not in the current module, which is usually disasterous.

2. There is another dynamic trigger to close the dialog when the module closes.

3. Prev and Next buttons on the dialog make the synchronnisation work both ways.

Enjoy.
 27-Sep-2007 01:19
User is offline View Users Profile Print this message


jason haury

Posts: 39
Joined: 20-Feb-2007

Hi All,

I'd like to write a simple GUI that (among other things) shows the Absolute Number of the current Object.  The script will be called from within a module, so from its perspective, the "current Module" will never change.  But as the user selects different Objects within the module, I'd like the GUI to update some info automatically without the user havint click an update button or something.  I'm new to triggers, but I'm thinking it may be key.  However, the DXL guide makes me think there are only 6 events that can will cause things to trigger: open, read, close, save, modify or sync (what is sync anyways?).  Is there some undocumented event called "clickObject" or something?

Thanks!
Jason
Report this to a Moderator Report this to a Moderator
 27-Sep-2007 08:48
User is offline View Users Profile Print this message


Peter Albert

Posts: 232
Joined: 30-Dec-2005

You want to use object, sync. sync fires the trigger when the current Object changes (which is not the same as selecting an Object, but I guess it is what you actually want). See the attached code for an example.

Cheers,

Peter

Edited: 28-Sep-2007 at 08:39 by Peter Albert
Report this to a Moderator Report this to a Moderator
 27-Sep-2007 16:15
User is offline View Users Profile Print this message


Louie Landale

Posts: 2070
Joined: 12-Sep-2002

The following is beyond you and probably beyond most of us with enough Trigger experience. But I suspect a normal post-sync-object trigger won't work as it will tend to display a new dialog every time you select a new object, without closing the previous one.

I'd be tempted to try this: have a stored (permanant) post-open-module trigger that deplyes a dynamic (temporary, ends when you close the module) post-object-sync trigger that does the work. The stored trigger defines the dialog box and realizes it. The function associated with the dynamic trigger simply gets the current object, updates the info on the existing dialog box, and shows it. This should work since Dynamic triggers use a function as the 'dxl code', and that function can access globabal variables to the main script (the stored trigger), in this case the global 'DB' and 'DBE' variables.

Additional details: the stored trigger would do nothing unless the module was visible. If the dialog is no longer showning then the trigger does nothing (this lets the user close the dialog). There would need to be a 2nd pre-module-close dynamic trigger whose job is simply to close the dialog when the module closes, if that dialog is showing. There would need to be a check for null current object.

- Louie
Report this to a Moderator Report this to a Moderator
 27-Sep-2007 16:42
User is offline View Users Profile Print this message


Tony Goodman

Posts: 1098
Joined: 12-Sep-2002

Answer Answer
This can work successfully with dynamic triggers.

The attached code is one of my scripts thats had all the interesting stuff ripped out.
This shows how to use object sync triggers to update the dialog.
I beleive this to be quite robust as the original script gets well used by a lot of users.

Points to note are:
1. You need a pre-sync AND a post-sync trigger. This protects you against setting a current object that is not in the current module, which is usually disasterous.

2. There is another dynamic trigger to close the dialog when the module closes.

3. Prev and Next buttons on the dialog make the synchronnisation work both ways.

Enjoy.

-------------------------
Tony Goodman
http://www.smartdxl.com
Report this to a Moderator Report this to a Moderator
 27-Sep-2007 19:10
User is offline View Users Profile Print this message


jason haury

Posts: 39
Joined: 20-Feb-2007

Brilliant!  This does exactly what I need  Trigger's are my least-understood part of DXL (I think =) so I appreciate all the help and examples. 

Peter's DXL worked well too, though Tony's code closed the Dialog Box when the Module closed (which is a nice perk!)

Jason
Report this to a Moderator Report this to a Moderator
 27-Sep-2007 22:34
User is offline View Users Profile Print this message


Louie Landale

Posts: 2070
Joined: 12-Sep-2002

I wonder. Perhaps you could suppress the pre-sync trigger by using the "Object oSynched = object(current Trigger)" command in the post-sync trigger (instead of setting current module then getting current object). This should return the Object handle of the object just synched.
Report this to a Moderator Report this to a Moderator
Statistics
20925 users are registered to the Telelogic DOORS forum.
There are currently 2 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 2 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.