<?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 Re: How to set a focus to AutoCAD main window from my form of C# .NET plug-in? in .NET Forum</title>
    <link>https://forums.autodesk.com/t5/net-forum/how-to-set-a-focus-to-autocad-main-window-from-my-form-of-c-net/m-p/10422285#M46544</link>
    <description>&lt;P&gt;Yes, I can see his is for 2014 and later, they both actually produce the same result in 2017. &amp;nbsp;&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;Its weird if I run the command on the form then move my cursor completely outside of autocad and back again I get the crosshairs. &amp;nbsp;But for the period between the form and the boundary of the acad window it’s just a regular windows cursor.&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;I also have the mouse_leave function on my form so doubt it’s that.&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;</description>
    <pubDate>Sat, 26 Jun 2021 09:36:10 GMT</pubDate>
    <dc:creator>Anonymous</dc:creator>
    <dc:date>2021-06-26T09:36:10Z</dc:date>
    <item>
      <title>How to set a focus to AutoCAD main window from my form of C# .NET plug-in?</title>
      <link>https://forums.autodesk.com/t5/net-forum/how-to-set-a-focus-to-autocad-main-window-from-my-form-of-c-net/m-p/4680059#M46532</link>
      <description>&lt;P&gt;Hello,&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;How to switch focus to AutoCAD document window from my form of C# .NET plug-in.&lt;/P&gt;&lt;P&gt;After user pressed the button, I&amp;nbsp;invite him to input a point, but my form still on top.&lt;/P&gt;&lt;P&gt;And it is nessesary to press minimize button, next to set a Focus on Autocad window, then to pick a point.&lt;/P&gt;&lt;P&gt;It is not handy enough.&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;I did not find a property to set a focus in class of Application.MainWindow.&lt;/P&gt;&lt;P&gt;How can I do it?&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;Thank you, in advance.&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;</description>
      <pubDate>Sat, 07 Dec 2013 15:41:26 GMT</pubDate>
      <guid>https://forums.autodesk.com/t5/net-forum/how-to-set-a-focus-to-autocad-main-window-from-my-form-of-c-net/m-p/4680059#M46532</guid>
      <dc:creator>Anonymous</dc:creator>
      <dc:date>2013-12-07T15:41:26Z</dc:date>
    </item>
    <item>
      <title>Re: How to set a focus to AutoCAD main window from my form of C# .NET plug-in?</title>
      <link>https://forums.autodesk.com/t5/net-forum/how-to-set-a-focus-to-autocad-main-window-from-my-form-of-c-net/m-p/4680097#M46533</link>
      <description>:::Form1.cs:::&lt;BR /&gt;...&lt;BR /&gt;private void Cancel_Click(object sender, EventArgs e)&lt;BR /&gt;{&lt;BR /&gt;this.Close();&lt;BR /&gt;}&lt;BR /&gt;private void Select_Click(object sender, EventArgs e)&lt;BR /&gt;{&lt;BR /&gt;Document doc = Acad.DocumentManager.MdiActiveDocument;&lt;BR /&gt;Database db = doc.Database;&lt;BR /&gt;Editor ed = doc.Editor;&lt;BR /&gt;using (EditorUserInteraction preventFlikkering = ed.StartUserInteraction(this))&lt;BR /&gt;{&lt;BR /&gt;PromptPointOptions getPntPrmpt = new PromptPointOptions("\nGet Center");&lt;BR /&gt;//Modal Form: will hide because of ed.GetPoint&lt;BR /&gt;PromptPointResult getPnt = ed.GetPoint(getPntPrmpt);&lt;BR /&gt;ed.WriteMessage("\nPoint: {0}", getPnt.Value);&lt;BR /&gt;ed.Regen();&lt;BR /&gt;preventFlikkering.End();&lt;BR /&gt;}&lt;BR /&gt;}&lt;BR /&gt;</description>
      <pubDate>Sat, 07 Dec 2013 16:17:38 GMT</pubDate>
      <guid>https://forums.autodesk.com/t5/net-forum/how-to-set-a-focus-to-autocad-main-window-from-my-form-of-c-net/m-p/4680097#M46533</guid>
      <dc:creator>SENL1362</dc:creator>
      <dc:date>2013-12-07T16:17:38Z</dc:date>
    </item>
    <item>
      <title>Re: How to set a focus to AutoCAD main window from my form of C# .NET plug-in?</title>
      <link>https://forums.autodesk.com/t5/net-forum/how-to-set-a-focus-to-autocad-main-window-from-my-form-of-c-net/m-p/4680195#M46534</link>
      <description>&lt;P&gt;Thanks, but I'm using modeless autocad dialog method.&lt;/P&gt;&lt;P&gt;Is there&amp;nbsp;explicit call of any method to change a focus?&lt;/P&gt;</description>
      <pubDate>Sat, 07 Dec 2013 18:51:14 GMT</pubDate>
      <guid>https://forums.autodesk.com/t5/net-forum/how-to-set-a-focus-to-autocad-main-window-from-my-form-of-c-net/m-p/4680195#M46534</guid>
      <dc:creator>Anonymous</dc:creator>
      <dc:date>2013-12-07T18:51:14Z</dc:date>
    </item>
    <item>
      <title>Re: How to set a focus to AutoCAD main window from my form of C# .NET plug-in?</title>
      <link>https://forums.autodesk.com/t5/net-forum/how-to-set-a-focus-to-autocad-main-window-from-my-form-of-c-net/m-p/4680287#M46535</link>
      <description>[DllImport("user32.dll")]&lt;BR /&gt;private static extern System.IntPtr SetFocus(System.IntPtr hwnd);&lt;BR /&gt;...&lt;BR /&gt;&lt;BR /&gt;//For Modeless Forms&lt;BR /&gt;System.IntPtr hwnd = adsw_acadDocWnd();&lt;BR /&gt;SetFocus(hwnd);&lt;BR /&gt;//Required when Modeless form&lt;BR /&gt;using (DocumentLock theLock = Application.DocumentManager.MdiActiveDocument.LockDocument())&lt;BR /&gt;{&lt;BR /&gt;PromptPointResult getPnt = ed.GetPoint(getPntPrmpt);&lt;BR /&gt;}&lt;BR /&gt;&lt;BR /&gt;</description>
      <pubDate>Sat, 07 Dec 2013 21:44:22 GMT</pubDate>
      <guid>https://forums.autodesk.com/t5/net-forum/how-to-set-a-focus-to-autocad-main-window-from-my-form-of-c-net/m-p/4680287#M46535</guid>
      <dc:creator>SENL1362</dc:creator>
      <dc:date>2013-12-07T21:44:22Z</dc:date>
    </item>
    <item>
      <title>Re: How to set a focus to AutoCAD main window from my form of C# .NET plug-in?</title>
      <link>https://forums.autodesk.com/t5/net-forum/how-to-set-a-focus-to-autocad-main-window-from-my-form-of-c-net/m-p/4680459#M46536</link>
      <description>&lt;P&gt;Hi,&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;Assuming the modeless form is launched from an autoCAD command :&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;PRE&gt;        [CommandMethod("Test")]
        public void Test()
        {
            Application.ShowModelessDialog(new ModelesssForm());
        }&lt;/PRE&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;In the ModelessForm class, the button&amp;nbsp; click event handler may be:&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;PRE&gt;        private void button1_Click(object sender, EventArgs e)
        {
            this.Hide(); // this is not mandatory

            Document doc = AcAp.DocumentManager.MdiActiveDocument;
            Editor ed = doc.Editor;

            using (doc.LockDocument()) // this is needed from a modeless form
            {
                // set focus to AutoCAD
                Autodesk.AutoCAD.Internal.Utils.SetFocusToDwgView();

                // do your stuff here
                PromptPointResult ppr = ed.GetPoint("\nPick a point: ");
                // ...
            }

            this.Show(); // this is mandatory if the form have been hidden
        }&lt;/PRE&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;</description>
      <pubDate>Sun, 08 Dec 2013 08:50:07 GMT</pubDate>
      <guid>https://forums.autodesk.com/t5/net-forum/how-to-set-a-focus-to-autocad-main-window-from-my-form-of-c-net/m-p/4680459#M46536</guid>
      <dc:creator>_gile</dc:creator>
      <dc:date>2013-12-08T08:50:07Z</dc:date>
    </item>
    <item>
      <title>Re: How to set a focus to AutoCAD main window from my form of C# .NET plug-in?</title>
      <link>https://forums.autodesk.com/t5/net-forum/how-to-set-a-focus-to-autocad-main-window-from-my-form-of-c-net/m-p/4680463#M46537</link>
      <description>&lt;P&gt;What library should I to import to use adsw_acadDocWnd () function?&lt;/P&gt;</description>
      <pubDate>Sun, 08 Dec 2013 08:59:20 GMT</pubDate>
      <guid>https://forums.autodesk.com/t5/net-forum/how-to-set-a-focus-to-autocad-main-window-from-my-form-of-c-net/m-p/4680463#M46537</guid>
      <dc:creator>Anonymous</dc:creator>
      <dc:date>2013-12-08T08:59:20Z</dc:date>
    </item>
    <item>
      <title>Re: How to set a focus to AutoCAD main window from my form of C# .NET plug-in?</title>
      <link>https://forums.autodesk.com/t5/net-forum/how-to-set-a-focus-to-autocad-main-window-from-my-form-of-c-net/m-p/4680467#M46538</link>
      <description>&lt;P&gt;Thank you very much.&lt;/P&gt;&lt;P&gt;I searched th solution for a month.&amp;nbsp;Now it is exactly what I need.&lt;/P&gt;</description>
      <pubDate>Sun, 08 Dec 2013 09:11:58 GMT</pubDate>
      <guid>https://forums.autodesk.com/t5/net-forum/how-to-set-a-focus-to-autocad-main-window-from-my-form-of-c-net/m-p/4680467#M46538</guid>
      <dc:creator>Anonymous</dc:creator>
      <dc:date>2013-12-08T09:11:58Z</dc:date>
    </item>
    <item>
      <title>Re: How to set a focus to AutoCAD main window from my form of C# .NET plug-in?</title>
      <link>https://forums.autodesk.com/t5/net-forum/how-to-set-a-focus-to-autocad-main-window-from-my-form-of-c-net/m-p/5616588#M46539</link>
      <description>Thank you! It really helps me.</description>
      <pubDate>Sun, 03 May 2015 06:53:09 GMT</pubDate>
      <guid>https://forums.autodesk.com/t5/net-forum/how-to-set-a-focus-to-autocad-main-window-from-my-form-of-c-net/m-p/5616588#M46539</guid>
      <dc:creator>viper_007</dc:creator>
      <dc:date>2015-05-03T06:53:09Z</dc:date>
    </item>
    <item>
      <title>Re: How to set a focus to AutoCAD main window from my form of C# .NET plug-in?</title>
      <link>https://forums.autodesk.com/t5/net-forum/how-to-set-a-focus-to-autocad-main-window-from-my-form-of-c-net/m-p/5619228#M46540</link>
      <description>&lt;P&gt;from AutoCAD 2014 onwards it is&amp;nbsp;&lt;/P&gt;&lt;PRE&gt;Autodesk.AutoCAD.ApplicationServices.Application.MainWindow.Focus();&lt;/PRE&gt;</description>
      <pubDate>Mon, 04 May 2015 00:18:26 GMT</pubDate>
      <guid>https://forums.autodesk.com/t5/net-forum/how-to-set-a-focus-to-autocad-main-window-from-my-form-of-c-net/m-p/5619228#M46540</guid>
      <dc:creator>CADbloke</dc:creator>
      <dc:date>2015-05-04T00:18:26Z</dc:date>
    </item>
    <item>
      <title>Re: How to set a focus to AutoCAD main window from my form of C# .NET plug-in?</title>
      <link>https://forums.autodesk.com/t5/net-forum/how-to-set-a-focus-to-autocad-main-window-from-my-form-of-c-net/m-p/5623528#M46541</link>
      <description>&lt;P&gt;&lt;SPAN&gt;In the solution from SENL1362 you can replace&amp;nbsp;&lt;/SPAN&gt;&lt;EM&gt;adsw_acadDocWnd()&lt;/EM&gt; with:&lt;/P&gt;&lt;P&gt;&lt;EM&gt;Autodesk.AutoCAD.ApplicationServices.Application.DocumentManager.MdiActiveDocument.Window.Handle&lt;/EM&gt;&lt;/P&gt;&lt;P&gt;&lt;SPAN style="line-height: 15px;"&gt;It can be used in AutoCAD 2010 or even earlier I think.&lt;/SPAN&gt;&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;But the other solutions &lt;EM&gt;&lt;SPAN style="white-space: pre-wrap; line-height: 15px; background-color: #f7f7f7;"&gt;Utils.SetFocusToDwgView(&lt;/SPAN&gt;&lt;/EM&gt;&lt;SPAN style="white-space: pre-wrap; line-height: 15px; background-color: #f7f7f7;"&gt;&lt;EM&gt;)&lt;/EM&gt; and &lt;/SPAN&gt;&lt;EM&gt;&lt;SPAN style="white-space: pre-wrap; line-height: 15px; background-color: #f7f7f7;"&gt;M&lt;/SPAN&gt;&lt;/EM&gt;&lt;SPAN style="white-space: pre-wrap; line-height: 15px; background-color: #f7f7f7;"&gt;&lt;EM&gt;ainWindow.Focus()&lt;/EM&gt; are much more straightforward.&lt;/SPAN&gt;&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;</description>
      <pubDate>Wed, 06 May 2015 20:39:35 GMT</pubDate>
      <guid>https://forums.autodesk.com/t5/net-forum/how-to-set-a-focus-to-autocad-main-window-from-my-form-of-c-net/m-p/5623528#M46541</guid>
      <dc:creator>Anonymous</dc:creator>
      <dc:date>2015-05-06T20:39:35Z</dc:date>
    </item>
    <item>
      <title>Re: How to set a focus to AutoCAD main window from my form of C# .NET plug-in?</title>
      <link>https://forums.autodesk.com/t5/net-forum/how-to-set-a-focus-to-autocad-main-window-from-my-form-of-c-net/m-p/10422051#M46542</link>
      <description>&lt;P&gt;When i do this using&amp;nbsp;Autodesk.AutoCAD.Internal.Utils.SetFocusToDwgView(); afterbutton click on modeless form if my form is not over the acad window i go straight into the editor, if my form was even partially over the acad window i have to click in the window once to get into the editor.&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;Any ideas?&lt;/P&gt;</description>
      <pubDate>Sat, 26 Jun 2021 06:15:57 GMT</pubDate>
      <guid>https://forums.autodesk.com/t5/net-forum/how-to-set-a-focus-to-autocad-main-window-from-my-form-of-c-net/m-p/10422051#M46542</guid>
      <dc:creator>Anonymous</dc:creator>
      <dc:date>2021-06-26T06:15:57Z</dc:date>
    </item>
    <item>
      <title>Re: How to set a focus to AutoCAD main window from my form of C# .NET plug-in?</title>
      <link>https://forums.autodesk.com/t5/net-forum/how-to-set-a-focus-to-autocad-main-window-from-my-form-of-c-net/m-p/10422150#M46543</link>
      <description>&lt;BLOCKQUOTE&gt;&lt;HR /&gt;@Anonymous&amp;nbsp; a écrit&amp;nbsp;:&lt;BR /&gt;
&lt;P&gt;When i do this using&amp;nbsp;Autodesk.AutoCAD.Internal.Utils.SetFocusToDwgView(); afterbutton click on modeless form if my form is not over the acad window i go straight into the editor, if my form was even partially over the acad window i have to click in the window once to get into the editor.&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;Any ideas?&lt;/P&gt;
&lt;HR /&gt;&lt;/BLOCKQUOTE&gt;
&lt;P&gt;Did you try &lt;a href="https://forums.autodesk.com/t5/user/viewprofilepage/user-id/510537"&gt;@CADbloke&lt;/a&gt;'s suggestion in &lt;A href="https://forums.autodesk.com/t5/net/how-to-set-a-focus-to-autocad-main-window-from-my-form-of-c-net/m-p/5619228#M44332" target="_blank" rel="noopener"&gt;its upper reply&lt;/A&gt;?&lt;/P&gt;</description>
      <pubDate>Sat, 26 Jun 2021 07:43:01 GMT</pubDate>
      <guid>https://forums.autodesk.com/t5/net-forum/how-to-set-a-focus-to-autocad-main-window-from-my-form-of-c-net/m-p/10422150#M46543</guid>
      <dc:creator>_gile</dc:creator>
      <dc:date>2021-06-26T07:43:01Z</dc:date>
    </item>
    <item>
      <title>Re: How to set a focus to AutoCAD main window from my form of C# .NET plug-in?</title>
      <link>https://forums.autodesk.com/t5/net-forum/how-to-set-a-focus-to-autocad-main-window-from-my-form-of-c-net/m-p/10422285#M46544</link>
      <description>&lt;P&gt;Yes, I can see his is for 2014 and later, they both actually produce the same result in 2017. &amp;nbsp;&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;Its weird if I run the command on the form then move my cursor completely outside of autocad and back again I get the crosshairs. &amp;nbsp;But for the period between the form and the boundary of the acad window it’s just a regular windows cursor.&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;I also have the mouse_leave function on my form so doubt it’s that.&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;</description>
      <pubDate>Sat, 26 Jun 2021 09:36:10 GMT</pubDate>
      <guid>https://forums.autodesk.com/t5/net-forum/how-to-set-a-focus-to-autocad-main-window-from-my-form-of-c-net/m-p/10422285#M46544</guid>
      <dc:creator>Anonymous</dc:creator>
      <dc:date>2021-06-26T09:36:10Z</dc:date>
    </item>
    <item>
      <title>Re: How to set a focus to AutoCAD main window from my form of C# .NET plug-in?</title>
      <link>https://forums.autodesk.com/t5/net-forum/how-to-set-a-focus-to-autocad-main-window-from-my-form-of-c-net/m-p/10422836#M46545</link>
      <description>&lt;P&gt;From &lt;A href="https://www.keanw.com/2011/02/managing-drag-drop-from-a-palette-into-autocad-using-net.html" target="_blank" rel="noopener"&gt;Kean Walmsley blog&lt;/A&gt;:&lt;/P&gt;
&lt;P&gt;"&lt;EM&gt;Once again there’s our important &lt;A href="https://en.wikipedia.org/wiki/Rule_of_thumb" target="_blank" rel="noopener"&gt;rule of thumb&lt;/A&gt; when it comes to implementing a modeless UI: rather than manually locking the current document, it’s safer to define a command – which will implicitly lock the current document – and call that from the UI via SendStringToExecute().&lt;/EM&gt;"&lt;/P&gt;</description>
      <pubDate>Sat, 26 Jun 2021 17:28:16 GMT</pubDate>
      <guid>https://forums.autodesk.com/t5/net-forum/how-to-set-a-focus-to-autocad-main-window-from-my-form-of-c-net/m-p/10422836#M46545</guid>
      <dc:creator>_gile</dc:creator>
      <dc:date>2021-06-26T17:28:16Z</dc:date>
    </item>
    <item>
      <title>Re: How to set a focus to AutoCAD main window from my form of C# .NET plug-in?</title>
      <link>https://forums.autodesk.com/t5/net-forum/how-to-set-a-focus-to-autocad-main-window-from-my-form-of-c-net/m-p/10423170#M46546</link>
      <description>&lt;P&gt;nice one that does the trick.&lt;/P&gt;&lt;P&gt;thanks very much that was a head scratcher.&lt;/P&gt;</description>
      <pubDate>Sat, 26 Jun 2021 22:19:07 GMT</pubDate>
      <guid>https://forums.autodesk.com/t5/net-forum/how-to-set-a-focus-to-autocad-main-window-from-my-form-of-c-net/m-p/10423170#M46546</guid>
      <dc:creator>Anonymous</dc:creator>
      <dc:date>2021-06-26T22:19:07Z</dc:date>
    </item>
  </channel>
</rss>

