cancel
Showing results for 
Search instead for 
Did you mean: 

PowerDesigner - ShowObjMultiSelection

0 Kudos

Hi,

I am trying to find the properties of ShowObjMultiSelection. Do you know how I can catch the Cancel event?

Looking for something like selObj.ShowObjMultiSelection.Cancel ...

Thank you so much,

Michal Skoda

Accepted Solutions (0)

Answers (3)

Answers (3)

former_member200945
Contributor
0 Kudos

You can try this

Assume you have table and column selected.

result = selObj.ShowObjMultiSelection ( table, "Columns")

Click Cancel button, result is false.

Click OK button, result is true.

former_member541630
Discoverer
0 Kudos

It seems that result does not have a value. So neither True or False. It's simply empty.
Is there another way to check if the user pressed OK or CANCEL?

Ondrej_Divis
Contributor
0 Kudos

I had the same experience. It should return boolean value, but it doesn`t. It sounds like a bug to me.

I solved it by browsing the resulting selection. If at least one object was selected by user in the ShowObjMultiSelection dialog, my script continues and if no object was selected, my script ends. Regardless of the button pressed. It is not perfect, but it worked for me.

Selection.ShowObjMultiSelection sel, "Objects"

If Selection.Objects.Count > 0 then
' do something here - script continues
else
' do something else here - script ends
End if

Regards,

Ondrej Divis

0 Kudos

Hi George,

not really. On ShowObjMultiSelection is button Cancel. I am trying to catch the moment when user clicks on Cancel button. Problem is that I cannot find the property. Do you know where I could find that?

Thank you,

M.

GeorgeMcGeachie
Active Contributor
0 Kudos

Try this in a PDM. When I tried it, after pressing 'Cancel' the selection count was zero

' Create a selection object
dim Selected
set Selected = ActiveModel.CreateSelection()
output Selected.Objects.Count & " BEFORE"
Selected.AddObjects Selected.Model, PdPDM.cls_Table, False, True
Selected.ShowObjMultiSelection Selected, "Objects"
output Selected.Objects.Count & " AFTER"
former_member438037
Participant
0 Kudos

Hello Michal,

I tried to figure this out by myself in the past too. According to the description in the documentation, you cannot treat this ShowObjMultiSelection method in the same way as ShowDialog function for example. ShowDialog returns TRUE, if you click OK button and it returns FALSE if you click Cancel button, but ShowObjMultiSelection doesn`t return such value. So unfortunately the only way how to deal with it was described by George. You have to count members of the final selection. Which means, that in fact you won`t know, whether the user pressed Cancel button or selected 0 objects in the multiselection window and pressed OK button.

Regards,

Ondřej Diviš

GeorgeMcGeachie
Active Contributor
0 Kudos

I've done a little more experimenting today, and extended yesterday's script to include an example of the more advanced selection dialogue

' Create a selection object
dim Selected, Selected2
set Selected = ActiveModel.CreateSelection()
set Selected2 = ActiveModel.CreateSelection() output Selected.Objects.Count & " BEFORE" Selected.AddObjects Selected.Model, PdPDM.cls_Table, False, True
Selected.ShowObjMultiSelection Selected, "Objects" output Selected.Objects.Count & " AFTER" output "Now listing the tables that weren't selected before"
output " - note that this dialogue gives more selection and filtering options in the dialogue"
output Selected2.Objects.Count & " BEFORE" 'ActiveModel.ShowObjMultiSelection ActiveModel, "Tables" selected2.ShowAdvancedObjMultiSelection activemodel, cls_Table, "", Selected.Objects
'show all tables in ActiveModel, any stereotype,
'if they were excluded from the original selection output Selected2.Objects.Count & " AFTER"
GeorgeMcGeachie
Active Contributor
0 Kudos

According to the metamodel help, there is a RemoveObjects method on cls_ObjectSelection. Is that what you need?