on 03-23-2018 4:46 PM
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
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.
You must be a registered user to add a comment. If you've already registered, sign in. Otherwise, register and sign in.
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
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.
You must be a registered user to add a comment. If you've already registered, sign in. Otherwise, register and sign in.
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"
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š
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"
According to the metamodel help, there is a RemoveObjects method on cls_ObjectSelection. Is that what you need?
You must be a registered user to add a comment. If you've already registered, sign in. Otherwise, register and sign in.
User | Count |
---|---|
89 | |
10 | |
10 | |
10 | |
7 | |
7 | |
6 | |
5 | |
4 | |
3 |
You must be a registered user to add a comment. If you've already registered, sign in. Otherwise, register and sign in.