ColorSelectionDialog - API Error, or am I doing it wrong?

ColorSelectionDialog - API Error, or am I doing it wrong?

orosztamas
Contributor Contributor
683 Views
3 Replies
Message 1 of 4

ColorSelectionDialog - API Error, or am I doing it wrong?

orosztamas
Contributor
Contributor

When I click cancel on an API called ColorSelectionDialog, I get RGB(0,0,0) color as "SelectedColor" property, when I would expect nothing. (It is also RGB(0,0,0), if I select a color, then I hit Cancel)l Am I doing it wrong, or is this the expected behavior?

0 Likes
Accepted solutions (1)
684 Views
3 Replies
Replies (3)
Message 2 of 4

jeremytammik
Autodesk
Autodesk
Accepted solution

TheColorSelectionDialog.Show method returns an ItemSelectionDialogResult object that enables you to determine whether the dialogue was cancelled or confirmed:

 
https://www.revitapidocs.com/2020/8f9ca1fe-744c-924a-5e83-31e9d730065d.htm

 

  • Confirmed -- The user selected one or more item(s) from the prompted dialog and confirmed the selection. The selected item(s) are available from the dialog interfaces.
  • Canceled -- The user canceled the prompted dialog. No selected item(s) are available from the dialog interfaces.

 

Does that not solve the problem you describe?

 



Jeremy Tammik
Developer Technical Services
Autodesk Developer Network, ADN Open
The Building Coder

Message 3 of 4

orosztamas
Contributor
Contributor

I just received an answer from @jeremytammik  ❤️ ❤️ 😄 😄

 

Yes, thank you! I wasn't aware of the returned object. This solved my problem.

0 Likes
Message 4 of 4

jeremytammik
Autodesk
Autodesk

Thank you for your appreciation.

 

Well, a quick look at the documentation can save you hours of work and frustration.

 

And others, as well.

 

Please take heed.

 



Jeremy Tammik
Developer Technical Services
Autodesk Developer Network, ADN Open
The Building Coder

0 Likes