![]() |
Telelogic DOORS (steve huntington) | ![]() |
new topic :
profile :
search :
help :
dashboard :
calendar :
home
|
||
Latest News:
|
|
Topic Title: Getting more than one selected objects Topic Summary: How to get multiple selected objects? Created On: 4-Apr-2006 12:01 Status: Post and Reply |
Linear : Threading : Single : Branch |
![]() |
![]()
|
![]() |
|
Hello,
does anyone know how to retrieve multiple selected objects in a formal module? The DXL reference manual only refers to function "current()" to get the one and only selected object. But how to deal with several selected objects? Any help is appreciated. Best regards, Oliver ------------------------- Greetings,<BR>Oliver<BR><BR><BR>Oliver Roepke<BR>Axis Engineering AG, Munich |
|
![]() |
|
![]() |
|
Hallo,
you can use the following code: Module modTheModule = current Object objStart = null Object objEnd = null int intStartObjAbsNum, intEndObjAbsNum getSelection(modTheModule, objStart, objEnd) intStartObjAbsNum = objStart."Absolute Number" intEndObjAbsNum = objEnd."Absolute Number" Now, you have first selected and last selected object. Then you can loop through this range and get all the selected objects. Please note: Selection of Object heading and DOORS table is diffirent. Many greetings, Rony ===================== Iftakher Uddin (Rony) Iftakher.Uddin@HOOD-Group.com Edited: 4-Apr-2006 at 12:30 by Iftakher Uddin |
|
![]() |
|
![]() |
|
Hi Rony,
many thanks for you reply. The code works but unfortunately not for all use cases. Say we have an object #1 and three objects below #1.1, #1.2, #1.3: #1 #1.1 #1.2 #1.3 The I select the objects from #1 to #1.3. Now the code return for start and end the same value. Maybe the child objects of obj #1 are semantically included if their parent has been selected? This way I cannot distinguish between this case and the case that the user intentionally not selected the child objects. But how to deal with this behaviour? Best, Oliver ------------------------- Greetings,<BR>Oliver<BR><BR><BR>Oliver Roepke<BR>Axis Engineering AG, Munich |
|
![]() |
|
![]() |
|
Hi Rony, ------------------------- Greetings,<BR>Oliver<BR><BR><BR>Oliver Roepke<BR>Axis Engineering AG, Munich |
|
![]() |
|
![]() |
|
I use this and it works for me...
------------------------- Shawn Stepper shawn.e.stepper@wellsfargo.com |
|
![]() |
|
![]() |
|
I like Shawn's approach -- very concise.
I prefer to put objects into a skiplist. ------------------------- Cliff Bly Edited: 4-Apr-2006 at 18:42 by cliff Bly |
|
![]() |
|
![]() |
|
Hi Cliff,
thank you for your code which is working in most cases, but not in all cases. ![]() Your code puts child objects more than once into the skip list if they are explicitly selected by the user. So I took your code and modified it slightly: I do not use an object counter as the key, but the absolute number of the object. This way I can check if this object is already part of the skip list. Furthermore I support single selections, too and I support skipping headline objects (empty heading). Any feedback is appreciated. ------------------------- Greetings,<BR>Oliver<BR><BR><BR>Oliver Roepke<BR>Axis Engineering AG, Munich |
|
![]() |
|
![]() |
|
Hallo Oliver,
here is another thought (pls, see the attached code)... Greetings, Rony ===================== Iftakher Uddin (Rony) Iftakher.Uddin@HOOD-Group.com P.S: If the attached code is not properly visible then use the following (I cant see all in attach box!) int getTotalSelectedObjects(Module modTheModule, Skip &skpList) { Object objTmp int intIndex = 0 for objTmp in modTheModule do { if(isSelected(objTmp)) { intIndex ++ //print objTmp."Absolute Number" " is selected \n" put(skpList, intIndex, objTmp) } } return intIndex } //Test Code Module m = current Object objMySelectedObject Skip skpList = create int intTotal = getTotalSelectedObjects(m, skpList) int intIndex //Verify the stored objects for(intIndex = 1; intIndex <= intTotal; intIndex++) { if (find(skpList, intIndex, objMySelectedObject)) { print objMySelectedObject."Absolute Number" " is selected \n" } } delete(skpList) Edited: 5-Apr-2006 at 17:04 by Iftakher Uddin |
|
![]() |
|
![]() |
|
Hi all,
unfortunalely I got wrong selections in some rare cases with my previous posted code. I explored that the only reliable way to get all selected objects is to find the first selected object and then to iterate over all remaining objects til the end of the module is reached (Shawn's approach). Each of the remaining objects must be checked if it is selected and if it is visible. That's all. Here's the new code: Any test feedback is appreciated! ------------------------- Greetings,<BR>Oliver<BR><BR><BR>Oliver Roepke<BR>Axis Engineering AG, Munich |
|
![]() |
|
![]() |
|
Golly, I did it the odd way: for obj in entire mod do; if (isSelected(obj)) do something with it.
- Louie |
|
![]() |
|
![]() |
|
Hi Louie,
that's indeed a very simple, reduced and effective way. ![]() ------------------------- Greetings,<BR>Oliver<BR><BR><BR>Oliver Roepke<BR>Axis Engineering AG, Munich |
|
![]() |
|
![]() |
|
Hi Louie,
fyi: you code does not deal with objects which are currently hided by an active filter. Not visible objects which are in the range of the visible selected objects will be selected by DOORS automatically :-( and have normally to be filtered out, since the user works on that what's visible. Module mod = current for obj in entire mod do if (isSelected(obj) && isVisible(obj)) { int no = obj."Absolute Number" print no "\n" } Thank you for the simple and effective approach. ("entire" was new to me). ------------------------- Greetings,<BR>Oliver<BR><BR><BR>Oliver Roepke<BR>Axis Engineering AG, Munich |
|
![]() |
|
![]() |
|
Using "entire" is routine for me. Its easier for me to get all objects and explicetely exclude the ones I don't want. Well "easier" means I understand it better 6 months from now. Also, most of my scripts cannot be dependant on whatever is the current view. Some common excludes I use are isDeleted(obj), isVisible(obj), cell(obj), row(obj), table(obj).
In this example, if you want only visible selected objects you can bypass "entire": for obj in mod do; if (isSelected(obj)). - Louie |
|
![]() |
Telelogic DOORS
» DXL Exchange
»
Getting more than one selected objects
|
![]() |
FuseTalk Standard Edition v3.2 - © 1999-2009 FuseTalk Inc. All rights reserved.