I followed (give or take) the example from http://thebuildingcoder.typepad.com/blog/2013/05/a-simpler-dockable-panel-sample.html, planning to use the dock as a way to get a custom view of parameters of the selected elements. The problem is, when I click on the dock, every element I had selected get deselected. Is there any way to avoid this? I don't know where to start.
Maybe I can save a copy of the selected elements and restore it, but then I need to find the right event...
This also happens with my dockable pane which I use as an AutoCAD style console output window (much better than annoying the user with a message box whenever you want to tell them something 🙂 ), I implement mine in a different way to the tutorial, so I don't think it has anything to do with the way you have created it. It just seems to be a side effect of the dockable panel system. Does anyone know why this happens?
The behaviour is quite odd, I also have a similar system to what you propose for displaying custom information for the selected elements, except that I have it in a regular modeless winforms dialog. My system makes use of the Idling events to keep up to date with the current selection. I can click over to it and back into Revit without problem and the selection is not affected. When I click inside my dockable pane though, the selection disapears just as you say, including from my winforms dialog. The odd thing is that if I then click back into the graphical view that was previously displaying my selection, the selection re-appears and is highlighted as normal and also appears back in my dialog as if nothing happened.
If I was to implement my selection properties system in a dockable pane, I would again use Revit's idling event to monitor the selection, but I'd also listen for the OnMouseEnter event within the dockable pane. When OnMouseEnter is triggered I'd freeze the selection data I had cached and ignore any selection data provided by the Idling event untill I had again clicked back into Revit. This event should be triggered before the user actually clicks in the pane, so it should have no troubles catching the selection before it is cleared.
The trick would be when to re-enable the selection updating, you don't want to do it untill the user clicks back into Revit, else it could be cleared prematurely.
+ 1 Kudos for AutoCAD style console output window 😉
Implemented and working... some how... :S
It works, but when I restore the selection, although the selection seems to be the same, because I can see them highlighted, I lose the contextual ribbon menu, as if there was nothing selected. Anyone have a hint about this? Maybe we need to tell Revit to refresh the ribbon or something like that?
Dear SuperRey, Scott and Revitalizer,
There is a reason for the behaviour you observe.
The dockable panel is modelled to behave like the project browser.
What you apparently would like is for it to optionally behave like the properties palette instead, which is different.
We now have a wish list item for that: REVIT-44416 [As an add-in developer, I would like Revit API dockable panes to be configurable to behave like the Properties Pallette, so that my application can behave in a similar manner].
Please make a note of this number for future reference.
I added your discussion to the notes for that item.
I hope this helps.
Cheers,
Jeremy
Jeremy,
I'm having a similar problem with an add-in I'm working on. The selection behavior with a dockable dialog doesn't exactly behave like the project browser either. If I have an active selection in a view, and then switch to a project browser, the selection highlighting goes away. However, if I switch back to the view the previous selection is still in effect. If I check the active selection in the Idle event the same elements are still listed as being selected
However, if I switch to a dockable dialog the seleted elements are no longer selected when the Idle event fires.
- Eric Anastas
Dear Eric,
Thank you for your notes.
Have you tried it in Revit 2015 UR4?
One of the API enhancements is listed as:
Cheers,
Jeremy
The dockable panels created using the API currently behave like the Project Browser panel, where selected elements do not show as selected when the focus is moved to ProjectBrowser panel. The elements are in fact still selected, as you can see if you click back on the title of the view window after the focus has been on the dockable panel. The Properties Palette has a different behavior in which the elements still show up as selected when focus is on it. We have a wish list item REVIT-44416 to enable dockable panels to be configured either way.
The fix in UR4 was for the ability to access the selected element ids from the dockable panel, which work in Revit 2014 and failed in Revit 2015 R1.
I hope this clarifies.
Best regards,
Jeremy
I know that select something in DockablePane is working, but the real problem is that any document view didn't show the selected objects as highlighted,
also activate the DockablePane will deselect any selected elements in active document.
So I hope in future version of revit, this behavior can be controlled by DockablePane. For now I have to use the Modeless window to do my job.
Dear All,
It is my pleasure to inform you that the wish list item REVIT-44416 [As an add-in developer, I would like Revit API dockable panes to be configurable to behave like the Properties Pallette, so that my application can behave in a similar manner.] has been marked as resolved and is scheduled for release in the next major release of Revit.
If you have access to the Autodesk beta forum, please try it out in the pre-release right now and use the beta forum to communicate directly with the development team if you encounter any problems or limitations.
Thank you!
Cheers,
Jeremy
Hi Jermey,
I am using Revit 2016 and I have created dockable wpf window and I am having exactly same issue. When I click on the my dockpane the elements gets deselected (it is behaving as Project Explorer). I have searched quite lot to change the behavior as Properties Palette but could not get any clue.
Can you please let me now how to configure the Docakable pane to behave like Properties Palette?
Thanks in advance.
Gangadhar
Hi Jeremy,
Just to clarify re Gangadhar's question above. He is working for a company that is engaged with the Consulting on some joint development for their applications. I explained to him that based on the date of your post is looks like the issue has been fixed in Revit 2017. We have just tested it all and indeed it works fine in 2017 while the issue shows in 2016 that is our "current" baseline 😞 I'm 99% the answer is no, but can someone pls confirm that there is No 2016 version where this subtle issue is fixed?
Thanks!
Miro
Miroslav Schonauer
Senior Solutions Architect / Software Architect
Autodesk Consulting
Same here, I would like to know how to configure the Docakable pane to behave like Properties Palette?
I'm using the Revit API 2018 and I experiment still the same issue.
Hi,
when deriving your panel from IDockablePaneProvider, add:
public void SetupDockablePane(Autodesk.Revit.UI.DockablePaneProviderData data)
{
[...]
data.EditorInteraction = new EditorInteraction(EditorInteractionType.KeepAlive);
}
Revitalizer
Thank you, @Revitalizer
For the clarification.
Indeed, the closing comments on the development issue, now named REVIT-44416 [As an add-in developer, I would like Revit API dockable panes to be configurable to behave like the Properties Pallette, so that my application can behave in a similar manner.], state:
Specification of EditiorActionType of "KeepALive" or "Dismiss" added.
Cheers,
Jeremy
Thank you for your replies. It seems to improve the dockable pane behaviour, but I still have an "issue" (in case of floating pane).
When I show the (floating) pane, the focus is set to the palette and kept. I want to have an "unfocusable pane" or set focus back to Revit's main window (just after the show).
PS: Dockable pane is shown when current selection change
Regards