cancel
Showing results for 
Search instead for 
Did you mean: 

Creating a multi-object selection dialog/form

eduardo_marques2
Explorer
0 Kudos

Has anyone used the method ShowAdvancedObjMultiSelection ? I've used ShowObjMultiSelection before, to create a selection of objects from a single list (tables or columns or references or even a  single list containing objects from different classes ....). But ShowAdvancedObjMultiSelection is supposed to provide the ability of selecting from more than one list, like most selection dialogs available in PD. I can't find any example of how to use it. Googling it returns no results and there's no example in PowerDesigner Docs on creating a selection dialog with two or more object lists (tables and views, for example). Thanks, Eduardo.

Accepted Solutions (0)

Answers (1)

Answers (1)

Former Member
0 Kudos

Hi Eduardo,

I have no answer to your question. I have more a question to you.

I used the ShowObjMultiSelection and this method shows a dialog with a cancel button. I don't know how to retrieve the cancel event like the ShowDialog function does.  It returns false if the cancel button is selected.

Any idea?

Thanks for help,

Inken

eduardo_marques2
Explorer
0 Kudos

Hi Inken, ShowObjMultiSelection does not return a result. At least we're unable to find a way to get it. Instead of trying to determine if the user has cancelled, we check the number of selected objects. Something like this:


dim oObjList as PdCommon.ObjectSelection         'The list of objects shown. May contain all kinds of objects

dim oSelection as PdCommon.ObjectSelection     'A list of selected objects


' Add objects to the list

oObjList.Objects.Add obj1

oObjList.Objects.Add obj2

....

oObjList.Objects.Add objNNN


' Show the dialog. Note that we'll get a new list (oSelection) from the initial one

oSelection.ShowObjMultiSelection oObjList, "Objects"


' Since oSelection is initially empty, if Count = 0 then no objects have been selected or user cancelled

' (User could click on Cancel or select nothing and click OK). In both cases, nothing to do.

If (oSelection.Objects.Count > 0) Then

....

End If

.....


The code above is just an example.  You'll have to take care of initialization and cleanup.

And there's something else. ShowObjMultiSelection has only one tab. If you add different classes of objects, they will be added to a single list, prefixed with object class name ('Table Tb1', 'Column col1', 'View vw1', 

and so on...).

To have each class listed in a separate tab, one should use ShowAdvancedObjMultiSelection instead. Just

like most PD selection dialogs. But we had no success using it. That's why the original post.


PD metamodel help needs some improvement

Hope it helps.

Regards,

Eduardo.

Former Member
0 Kudos

Thanks Eduardo

If I do not add the objects to the selection it works also. The object is a process and I want to list all the input flows

dim flowSelection

set flowSelection = obj.Model.CreateSelection()

flowSelection.ShowObjMultiSelection obj, "InputFlows"

--> Then the dialog window appears with all  input flows but they are not selected. Which is better for my use case

But I would prefere to have a function instead of a method. 🙂