<?xml version="1.0" encoding="UTF-8"?>
<rss xmlns:content="http://purl.org/rss/1.0/modules/content/" xmlns:dc="http://purl.org/dc/elements/1.1/" xmlns:rdf="http://www.w3.org/1999/02/22-rdf-syntax-ns#" xmlns:taxo="http://purl.org/rss/1.0/modules/taxonomy/" version="2.0">
  <channel>
    <title>topic 回复： Dockable pane focus in Revit API Forum</title>
    <link>https://forums.autodesk.com/t5/revit-api-forum/dockable-pane-focus/m-p/8887496#M41295</link>
    <description>&lt;P&gt;unfortunately it does not work&lt;BR /&gt;debugger coming in the method&lt;BR /&gt;and the SetForegroundWindow return true&lt;BR /&gt;but the focus is always on the panel&lt;BR /&gt;until I myself click on the mouse in the view&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;I get RevitWindowHandle from the commandData.Application.MainWindowHandle&lt;/P&gt;</description>
    <pubDate>Wed, 03 Jul 2019 10:35:24 GMT</pubDate>
    <dc:creator>Anonymous</dc:creator>
    <dc:date>2019-07-03T10:35:24Z</dc:date>
    <item>
      <title>Dockable pane focus</title>
      <link>https://forums.autodesk.com/t5/revit-api-forum/dockable-pane-focus/m-p/8887307#M41293</link>
      <description>&lt;P&gt;Hi&lt;BR /&gt;I created a dockable pane with some functionality.&lt;/P&gt;&lt;P&gt;I need to automatically change focus on the model viewer when the panel disappears from the cursor field, as it is done in properties panel.&amp;nbsp;&lt;/P&gt;&lt;P&gt;When you do something on properties panel&lt;BR /&gt;and then moves the cursor to the model then the focus will also automatically change.&lt;BR /&gt;Can you help me, please.&lt;/P&gt;</description>
      <pubDate>Wed, 03 Jul 2019 09:14:03 GMT</pubDate>
      <guid>https://forums.autodesk.com/t5/revit-api-forum/dockable-pane-focus/m-p/8887307#M41293</guid>
      <dc:creator>Anonymous</dc:creator>
      <dc:date>2019-07-03T09:14:03Z</dc:date>
    </item>
    <item>
      <title>回复： Dockable pane focus</title>
      <link>https://forums.autodesk.com/t5/revit-api-forum/dockable-pane-focus/m-p/8887438#M41294</link>
      <description>&lt;P&gt;Hi:&lt;/P&gt;&lt;P&gt;Suppose inside the dockable pane, you are using a WPF Page.&lt;/P&gt;&lt;OL&gt;&lt;LI&gt;&amp;nbsp;Subscribe the Page.MouseLeave&lt;/LI&gt;&lt;LI&gt;&lt;PRE&gt;// Add the following lines in you own Page class&lt;/PRE&gt;&lt;OL&gt;&lt;LI&gt;&lt;PRE&gt;public partial class YourPage : Page
    {
        [DllImport("user32.dll")]
        [return: MarshalAs(UnmanagedType.Bool)]
        public static extern bool SetForegroundWindow(IntPtr hWnd);

        public IntPtr RevitWindowHandle { get; set; }

        void Page_MouseLeave (object sender, MouseEventArgs e)
        {
              SetForegroundWindow (RevitWindowHandle);
        }&lt;/PRE&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;/LI&gt;&lt;/OL&gt;&lt;/LI&gt;&lt;LI&gt;About how to get the correct Revit window handle, Please refer the link: &lt;A href="https://thebuildingcoder.typepad.com/blog/2009/02/revit-window-handle-and-modeless-dialogues.html" target="_blank" rel="noopener"&gt;revit-window-handle-and-modeless-dialogues.html&amp;nbsp;&lt;/A&gt; . Notice that with Revit 2018 or ealier, you can also add reference AdWindows.dll inside the Revit program folder (C:\Program Files\Autodesk\Revit201X\), and use the Autodesk.Windows.ComponentManager.ApplicationWindow to grab Revit window pointer. In Revit 2019, it's much easier, Revit API provides a property: UIApplication.MainWindowHandle.&lt;/LI&gt;&lt;/OL&gt;</description>
      <pubDate>Wed, 03 Jul 2019 10:13:08 GMT</pubDate>
      <guid>https://forums.autodesk.com/t5/revit-api-forum/dockable-pane-focus/m-p/8887438#M41294</guid>
      <dc:creator>jlpgy</dc:creator>
      <dc:date>2019-07-03T10:13:08Z</dc:date>
    </item>
    <item>
      <title>回复： Dockable pane focus</title>
      <link>https://forums.autodesk.com/t5/revit-api-forum/dockable-pane-focus/m-p/8887496#M41295</link>
      <description>&lt;P&gt;unfortunately it does not work&lt;BR /&gt;debugger coming in the method&lt;BR /&gt;and the SetForegroundWindow return true&lt;BR /&gt;but the focus is always on the panel&lt;BR /&gt;until I myself click on the mouse in the view&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;I get RevitWindowHandle from the commandData.Application.MainWindowHandle&lt;/P&gt;</description>
      <pubDate>Wed, 03 Jul 2019 10:35:24 GMT</pubDate>
      <guid>https://forums.autodesk.com/t5/revit-api-forum/dockable-pane-focus/m-p/8887496#M41295</guid>
      <dc:creator>Anonymous</dc:creator>
      <dc:date>2019-07-03T10:35:24Z</dc:date>
    </item>
    <item>
      <title>回复： Dockable pane focus</title>
      <link>https://forums.autodesk.com/t5/revit-api-forum/dockable-pane-focus/m-p/8892060#M41296</link>
      <description>&lt;P&gt;Hi,&lt;/P&gt;&lt;P&gt;&lt;BR /&gt;there is a related thread:&lt;/P&gt;&lt;P&gt;&lt;A href="https://forums.autodesk.com/t5/revit-api-forum/click-on-dock-pane-deselects-elements/m-p/5279637" target="_blank"&gt;https://forums.autodesk.com/t5/revit-api-forum/click-on-dock-pane-deselects-elements/m-p/5279637&lt;/A&gt;&lt;/P&gt;&lt;P&gt;&lt;BR /&gt;As you mention the Properties palette, in the SetupDockablePane method, you may assign EditorInteractionType.KeepAlive.&lt;/P&gt;&lt;P&gt;&lt;BR /&gt;RevitAPI.chm says:&lt;/P&gt;&lt;P&gt;Keeps the active editor alive during pane activation. This results in the current selection being kept active and available to the pane. One example built-in dockable pane that uses this mode is the Revit Property Palette.&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;Revitalizer&lt;/P&gt;</description>
      <pubDate>Fri, 05 Jul 2019 11:39:43 GMT</pubDate>
      <guid>https://forums.autodesk.com/t5/revit-api-forum/dockable-pane-focus/m-p/8892060#M41296</guid>
      <dc:creator>Revitalizer</dc:creator>
      <dc:date>2019-07-05T11:39:43Z</dc:date>
    </item>
    <item>
      <title>回复： Dockable pane focus</title>
      <link>https://forums.autodesk.com/t5/revit-api-forum/dockable-pane-focus/m-p/8892075#M41297</link>
      <description>&lt;P&gt;Great!&lt;/P&gt;&lt;P&gt;Thanks for sharing.&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;I re-tested the "SetForegroundWindow" solution again, and it TRULY did not work.&lt;/P&gt;&lt;P&gt;@AnonymousOOPs for giving you the wrong answer.&lt;/P&gt;</description>
      <pubDate>Fri, 05 Jul 2019 11:44:06 GMT</pubDate>
      <guid>https://forums.autodesk.com/t5/revit-api-forum/dockable-pane-focus/m-p/8892075#M41297</guid>
      <dc:creator>jlpgy</dc:creator>
      <dc:date>2019-07-05T11:44:06Z</dc:date>
    </item>
  </channel>
</rss>

