<?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: unable to pan and orbit while run from modal dialog in .NET Forum</title>
    <link>https://forums.autodesk.com/t5/net-forum/unable-to-pan-and-orbit-while-run-from-modal-dialog/m-p/9561346#M19442</link>
    <description>&lt;P&gt;Hi,&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;Difficult to reply without seeing the code.&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;Just a guess, do you explicitly set the focus to the document window?&lt;/P&gt;
&lt;LI-CODE lang="csharp"&gt;        private void button1_Click(object sender, EventArgs e)
        {
            var doc = AcAp.DocumentManager.MdiActiveDocument;
            var ed = doc.Editor;
            doc.Window.Focus();
            var result = ed.GetPoint("\nPick a point: ");
            if (result.Status == PromptStatus.OK)
                textBox1.Text = $"{result.Value:0.00}";
        }&lt;/LI-CODE&gt;</description>
    <pubDate>Thu, 04 Jun 2020 19:20:16 GMT</pubDate>
    <dc:creator>_gile</dc:creator>
    <dc:date>2020-06-04T19:20:16Z</dc:date>
    <item>
      <title>unable to pan and orbit while run from modal dialog</title>
      <link>https://forums.autodesk.com/t5/net-forum/unable-to-pan-and-orbit-while-run-from-modal-dialog/m-p/9561303#M19441</link>
      <description>&lt;P&gt;Hi,&lt;/P&gt;&lt;P&gt;I was wondering if anyone could point me in a right direction here,&lt;/P&gt;&lt;P&gt;I'm writing a small cad application and when I call out my form as ModelessDialog then I'm having this issue where when I click on my button to GetPoints from autocad I cannot pan or orbit, only zoom would work&lt;/P&gt;&lt;P&gt;but if I call my form as ModalDialog the GetPoint button clicked gives me the option to pan and orbit while looking for a point to click,&lt;/P&gt;&lt;P&gt;also I have noticed that when run as ModelessDialog I can get the pan and orbit working only if I run my command using SendStringToExecute, and if it's called out as a function is again does not give me an option to midmousebutton pan or orbit,&lt;/P&gt;&lt;P&gt;any chance for some help at all?&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;</description>
      <pubDate>Thu, 04 Jun 2020 19:01:06 GMT</pubDate>
      <guid>https://forums.autodesk.com/t5/net-forum/unable-to-pan-and-orbit-while-run-from-modal-dialog/m-p/9561303#M19441</guid>
      <dc:creator>autojinx</dc:creator>
      <dc:date>2020-06-04T19:01:06Z</dc:date>
    </item>
    <item>
      <title>Re: unable to pan and orbit while run from modal dialog</title>
      <link>https://forums.autodesk.com/t5/net-forum/unable-to-pan-and-orbit-while-run-from-modal-dialog/m-p/9561346#M19442</link>
      <description>&lt;P&gt;Hi,&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;Difficult to reply without seeing the code.&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;Just a guess, do you explicitly set the focus to the document window?&lt;/P&gt;
&lt;LI-CODE lang="csharp"&gt;        private void button1_Click(object sender, EventArgs e)
        {
            var doc = AcAp.DocumentManager.MdiActiveDocument;
            var ed = doc.Editor;
            doc.Window.Focus();
            var result = ed.GetPoint("\nPick a point: ");
            if (result.Status == PromptStatus.OK)
                textBox1.Text = $"{result.Value:0.00}";
        }&lt;/LI-CODE&gt;</description>
      <pubDate>Thu, 04 Jun 2020 19:20:16 GMT</pubDate>
      <guid>https://forums.autodesk.com/t5/net-forum/unable-to-pan-and-orbit-while-run-from-modal-dialog/m-p/9561346#M19442</guid>
      <dc:creator>_gile</dc:creator>
      <dc:date>2020-06-04T19:20:16Z</dc:date>
    </item>
    <item>
      <title>Re: unable to pan and orbit while run from modal dialog</title>
      <link>https://forums.autodesk.com/t5/net-forum/unable-to-pan-and-orbit-while-run-from-modal-dialog/m-p/9561376#M19443</link>
      <description>&lt;P&gt;I don't &lt;SPAN&gt;explicitly&lt;/SPAN&gt; focus on any window, I don't use focus at all, maybe I should?&lt;/P&gt;&lt;P&gt;the code is as follows:&lt;/P&gt;&lt;P&gt;call up my main window with various buttons and as described modeless does not function for pan and orbit&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;LI-CODE lang="general"&gt;Dim Form As Form1
Form = New Form1
Autodesk.AutoCAD.ApplicationServices.Application.ShowModelessDialog(Form)&lt;/LI-CODE&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;then under the button there's following code to select a point:&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;LI-CODE lang="general"&gt;Private Sub ButtonGetPoint_Click(sender As Object, e As EventArgs) Handles ButtonGetPoint.Click
            Dim ed As Editor = Autodesk.AutoCAD.ApplicationServices.Application.DocumentManager.MdiActiveDocument.Editor
            Dim n As Integer = 0
            Dim acDoc As Document = Autodesk.AutoCAD.ApplicationServices.Application.DocumentManager.MdiActiveDocument
            Dim pPtRes As PromptPointResult
            Dim pPtOpts As PromptPointOptions = New PromptPointOptions("")
            Dim pts As Point3dCollection = New Point3dCollection
            
            pPtOpts.AllowNone = True

            Me.Hide()
            
            pPtOpts.Message = vbLf &amp;amp; "Pick a point: "
            pPtRes = acDoc.Editor.GetPoint(pPtOpts)
            Dim pt As Point3d = pPtRes.Value
            
            If pPtRes.Status = PromptStatus.OK Then
                TextBoxFX.Text = (Math.Round(pt.X, 2)).ToString
                TextBoxFY.Text = (Math.Round(pt.Y, 2)).ToString
                TextBoxFZ.Text = (Math.Round(pt.Z, 2)).ToString
            Else
            End If
            Me.Show()
        End Sub&lt;/LI-CODE&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;</description>
      <pubDate>Thu, 04 Jun 2020 19:43:41 GMT</pubDate>
      <guid>https://forums.autodesk.com/t5/net-forum/unable-to-pan-and-orbit-while-run-from-modal-dialog/m-p/9561376#M19443</guid>
      <dc:creator>autojinx</dc:creator>
      <dc:date>2020-06-04T19:43:41Z</dc:date>
    </item>
    <item>
      <title>Re: unable to pan and orbit while run from modal dialog</title>
      <link>https://forums.autodesk.com/t5/net-forum/unable-to-pan-and-orbit-while-run-from-modal-dialog/m-p/9561661#M19444</link>
      <description>&lt;P&gt;just a guess. try without "Hide()" and "Show()". Editor.Getpoint will handle the focus. is it necessary to hide your form?&lt;/P&gt;</description>
      <pubDate>Thu, 04 Jun 2020 22:09:09 GMT</pubDate>
      <guid>https://forums.autodesk.com/t5/net-forum/unable-to-pan-and-orbit-while-run-from-modal-dialog/m-p/9561661#M19444</guid>
      <dc:creator>fieldguy</dc:creator>
      <dc:date>2020-06-04T22:09:09Z</dc:date>
    </item>
    <item>
      <title>Re: unable to pan and orbit while run from modal dialog</title>
      <link>https://forums.autodesk.com/t5/net-forum/unable-to-pan-and-orbit-while-run-from-modal-dialog/m-p/9562592#M19445</link>
      <description>&lt;P&gt;Hiding my form is more of a cosmetic so not that important to maintain, but not using it does not help the problem,&lt;/P&gt;</description>
      <pubDate>Fri, 05 Jun 2020 12:17:40 GMT</pubDate>
      <guid>https://forums.autodesk.com/t5/net-forum/unable-to-pan-and-orbit-while-run-from-modal-dialog/m-p/9562592#M19445</guid>
      <dc:creator>autojinx</dc:creator>
      <dc:date>2020-06-05T12:17:40Z</dc:date>
    </item>
    <item>
      <title>Re: unable to pan and orbit while run from modal dialog</title>
      <link>https://forums.autodesk.com/t5/net-forum/unable-to-pan-and-orbit-while-run-from-modal-dialog/m-p/9562816#M19446</link>
      <description>&lt;P&gt;my windows "forms" are instances of "usercontrol" and added to paletteset. never had a problem with editor interaction.&amp;nbsp;&amp;nbsp;&lt;/P&gt;</description>
      <pubDate>Fri, 05 Jun 2020 13:48:15 GMT</pubDate>
      <guid>https://forums.autodesk.com/t5/net-forum/unable-to-pan-and-orbit-while-run-from-modal-dialog/m-p/9562816#M19446</guid>
      <dc:creator>fieldguy</dc:creator>
      <dc:date>2020-06-05T13:48:15Z</dc:date>
    </item>
    <item>
      <title>Re: unable to pan and orbit while run from modal dialog</title>
      <link>https://forums.autodesk.com/t5/net-forum/unable-to-pan-and-orbit-while-run-from-modal-dialog/m-p/9564158#M19447</link>
      <description>&lt;P&gt;hmm, maybe that's where I'm going wrong then? my form probably isn't what you say it maybe should be.&lt;/P&gt;&lt;P&gt;where can I get a bit more info on how to built my form as&lt;SPAN&gt;&amp;nbsp;an instance of "usercontrol" and add to paletteset?&lt;/SPAN&gt;&lt;/P&gt;</description>
      <pubDate>Sat, 06 Jun 2020 08:05:54 GMT</pubDate>
      <guid>https://forums.autodesk.com/t5/net-forum/unable-to-pan-and-orbit-while-run-from-modal-dialog/m-p/9564158#M19447</guid>
      <dc:creator>autojinx</dc:creator>
      <dc:date>2020-06-06T08:05:54Z</dc:date>
    </item>
    <item>
      <title>Re: unable to pan and orbit while run from modal dialog</title>
      <link>https://forums.autodesk.com/t5/net-forum/unable-to-pan-and-orbit-while-run-from-modal-dialog/m-p/9564209#M19448</link>
      <description>&lt;P&gt;Hi,&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;Here's the translation of a "tutorial" about AutoCAD and user interfaces, I hope it helps:&lt;/P&gt;
&lt;P&gt;&lt;A href="http://gilecad.azurewebsites.net/UserInterfaces_EN.aspx" target="_blank"&gt;http://gilecad.azurewebsites.net/UserInterfaces_EN.aspx&lt;/A&gt;&lt;/P&gt;</description>
      <pubDate>Sat, 06 Jun 2020 08:48:14 GMT</pubDate>
      <guid>https://forums.autodesk.com/t5/net-forum/unable-to-pan-and-orbit-while-run-from-modal-dialog/m-p/9564209#M19448</guid>
      <dc:creator>_gile</dc:creator>
      <dc:date>2020-06-06T08:48:14Z</dc:date>
    </item>
    <item>
      <title>Re: unable to pan and orbit while run from modal dialog</title>
      <link>https://forums.autodesk.com/t5/net-forum/unable-to-pan-and-orbit-while-run-from-modal-dialog/m-p/9567041#M19449</link>
      <description>&lt;P&gt;Hello&amp;nbsp;&lt;a href="https://forums.autodesk.com/t5/user/viewprofilepage/user-id/4423044"&gt;@autojinx&lt;/a&gt;&amp;nbsp; !&lt;BR /&gt;&lt;BR /&gt;Great to see you here on .NET Forum.&lt;BR /&gt;&lt;BR /&gt;Did you find a solution? &lt;BR /&gt;If yes, please click on the &lt;FONT color="#008000"&gt;"Accept as Solution"&lt;/FONT&gt; button as then also other community users can easily find and benefit from the information.&lt;BR /&gt;If not please don't hesitate to give an update here in your topic so all members know what ́s the progression on your question is and what might be helpful to achieve what you ́re looking for. &lt;span class="lia-unicode-emoji" title=":slightly_smiling_face:"&gt;🙂&lt;/span&gt;&lt;/P&gt;</description>
      <pubDate>Mon, 08 Jun 2020 14:14:58 GMT</pubDate>
      <guid>https://forums.autodesk.com/t5/net-forum/unable-to-pan-and-orbit-while-run-from-modal-dialog/m-p/9567041#M19449</guid>
      <dc:creator>lena.talkhina</dc:creator>
      <dc:date>2020-06-08T14:14:58Z</dc:date>
    </item>
    <item>
      <title>Re: unable to pan and orbit while run from modal dialog</title>
      <link>https://forums.autodesk.com/t5/net-forum/unable-to-pan-and-orbit-while-run-from-modal-dialog/m-p/9567266#M19450</link>
      <description>&lt;P&gt;Please excuse maybe a little slow reply, but I'm an amateur programmer and it took me a while to study the suggestions from the guys,&amp;nbsp;&lt;/P&gt;&lt;P&gt;her's what I found further,&amp;nbsp;&lt;/P&gt;&lt;P&gt;I have rewritten the same code to an autocad palette and calling a get point function from a button from the autocad palette gives me the same issue, and maybe another clue here, please see attached screenshot - after I click on my GetPoint button the hint by the cursor says "pick point..." and when I try to pan (which still doesn't work) and hit middle mouse button it adds "invalid point" ,&amp;nbsp; &amp;nbsp;&lt;/P&gt;&lt;P&gt;orbit obviously still gives the same issue,&lt;/P&gt;&lt;P&gt;any further clues at all Guys?&lt;/P&gt;&lt;P&gt;&lt;span class="lia-inline-image-display-wrapper lia-image-align-inline" image-alt="Screen.png" style="width: 671px;"&gt;&lt;img src="https://forums.autodesk.com/t5/image/serverpage/image-id/781276iA7372AF5D026CF1A/image-size/large?v=v2&amp;amp;px=999" role="button" title="Screen.png" alt="Screen.png" /&gt;&lt;/span&gt;&lt;/P&gt;</description>
      <pubDate>Mon, 08 Jun 2020 15:42:52 GMT</pubDate>
      <guid>https://forums.autodesk.com/t5/net-forum/unable-to-pan-and-orbit-while-run-from-modal-dialog/m-p/9567266#M19450</guid>
      <dc:creator>autojinx</dc:creator>
      <dc:date>2020-06-08T15:42:52Z</dc:date>
    </item>
    <item>
      <title>Re: unable to pan and orbit while run from modal dialog</title>
      <link>https://forums.autodesk.com/t5/net-forum/unable-to-pan-and-orbit-while-run-from-modal-dialog/m-p/9567739#M19451</link>
      <description>&lt;P&gt;Here's a way, following Kean Walmsley advice:&lt;/P&gt;
&lt;P&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;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;The CustomPalette class which exposes the control as property:&lt;/P&gt;
&lt;LI-CODE lang="csharp"&gt;using Autodesk.AutoCAD.Windows;

using System;

namespace ModalModelessDialog
{
    internal class CustomPaletteSet : PaletteSet
    {
        public UserControl1 GetPointControl { get; }

        /// &amp;lt;summary&amp;gt;
        /// Crée une nouvelle instance de CustomPaletteSet
        /// &amp;lt;/summary&amp;gt;
        public CustomPaletteSet()
            : base("Palette", "CMD_PALETTE", new Guid("{ABC4C47C-16A9-4C82-98CD-6636C02B1A4E}"))
        {
            Style =
                PaletteSetStyles.ShowAutoHideButton |
                PaletteSetStyles.ShowCloseButton |
                PaletteSetStyles.ShowPropertiesMenu;
            MinimumSize = new System.Drawing.Size(250, 150);
            GetPointControl = new UserControl1();
            Add("Get Point", GetPointControl);
        }
    }
}&lt;/LI-CODE&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;The UserControl1 class with a read/write Point property and the Button1.Click handler which calls a custom command:&lt;/P&gt;
&lt;LI-CODE lang="csharp"&gt;using Autodesk.AutoCAD.Geometry;
using System;
using System.Windows.Forms;

using AcAp = Autodesk.AutoCAD.ApplicationServices.Core.Application;

namespace ModalModelessDialog
{
    public partial class UserControl1 : UserControl
    {
        Point3d point;

        public UserControl1()
        {
            InitializeComponent();
        }

        public Point3d Point
        {
            get { return point; }
            set
            {
                point = value;
                textBoxX.Text = $"{point.X:0.00}";
                textBoxY.Text = $"{point.Y:0.00}";
                textBoxZ.Text = $"{point.Z:0.00}";
            }
        }

        private void button1_Click(object sender, EventArgs e)
        {
            var doc = AcAp.DocumentManager.MdiActiveDocument;
            if (doc != null)
            {
                doc.SendStringToExecute("GetPointFromPaletteCommand ", false, false, true);
            }
        }
    }
}&lt;/LI-CODE&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;The commands class with a command to show the palette and another one to prompt the use to specify a point and pass the result to the palette user control property:&lt;/P&gt;
&lt;LI-CODE lang="csharp"&gt;using Autodesk.AutoCAD.EditorInput;
using Autodesk.AutoCAD.Runtime;

using AcAp = Autodesk.AutoCAD.ApplicationServices.Core.Application;

namespace ModalModelessDialog
{
    public class Commands
    {
        static CustomPaletteSet palette;

        [CommandMethod("CMD_PALETTE")]
        public void ShowPaletteSet()
        {
            if (palette == null)
                palette = new CustomPaletteSet();
            palette.Visible = true;
        }

        [CommandMethod("GetPointFromPaletteCommand")]
        public void GetPointFromPaletteCommand()
        {
            var ed = AcAp.DocumentManager.MdiActiveDocument.Editor;
            var ppo = new PromptPointOptions("\nPick a point: ");
            ppo.AllowNone = true;
            var ppr = ed.GetPoint(ppo);
            if (ppr.Status == PromptStatus.OK)
            {
                palette.GetPointControl.Point = ppr.Value;
            }
        }
    }
}
&lt;/LI-CODE&gt;</description>
      <pubDate>Mon, 08 Jun 2020 18:58:44 GMT</pubDate>
      <guid>https://forums.autodesk.com/t5/net-forum/unable-to-pan-and-orbit-while-run-from-modal-dialog/m-p/9567739#M19451</guid>
      <dc:creator>_gile</dc:creator>
      <dc:date>2020-06-08T18:58:44Z</dc:date>
    </item>
    <item>
      <title>Re: unable to pan and orbit while run from modal dialog</title>
      <link>https://forums.autodesk.com/t5/net-forum/unable-to-pan-and-orbit-while-run-from-modal-dialog/m-p/9571135#M19452</link>
      <description>&lt;P&gt;Thank You for an extensive answer in this matter, I've tried to got through the code in my own pace and as far as I understand we are back to using&amp;nbsp;SendStringToExecute,&amp;nbsp;&lt;/P&gt;&lt;P&gt;this has worked before but there were two issues I came across with this:&lt;/P&gt;&lt;P&gt;1.&amp;nbsp;SendStringToExecute run command/code a&lt;SPAN&gt;synchronously&lt;/SPAN&gt;, and other stuff from my routines gets messed up,&lt;/P&gt;&lt;P&gt;2.&amp;nbsp;SendStringToExecute does not allow me to pass some arguments which comes in handy later on in my code, not critical I suppose, but nice to have and running it via function works all good, apart from the mentioned problem with pan/orbit,&lt;/P&gt;&lt;P&gt;What I'm trying to achieve is something like - click-&amp;gt; getpointfromuser-&amp;gt;function does some calcs based on received coordinates -&amp;gt; function changes view-&amp;gt; ask user for more points -&amp;gt; do further calculations in the routing-&amp;gt; draw entity i.e. circle (saved in temp item list) and on and on few times changing views and asking for more points from user,&amp;nbsp;&lt;/P&gt;&lt;P&gt;Any other way to bring the mouse pan/orbit functionality back?&lt;/P&gt;</description>
      <pubDate>Wed, 10 Jun 2020 07:24:21 GMT</pubDate>
      <guid>https://forums.autodesk.com/t5/net-forum/unable-to-pan-and-orbit-while-run-from-modal-dialog/m-p/9571135#M19452</guid>
      <dc:creator>autojinx</dc:creator>
      <dc:date>2020-06-10T07:24:21Z</dc:date>
    </item>
    <item>
      <title>Re: unable to pan and orbit while run from modal dialog</title>
      <link>https://forums.autodesk.com/t5/net-forum/unable-to-pan-and-orbit-while-run-from-modal-dialog/m-p/9573912#M19453</link>
      <description>&lt;P&gt;after further insight into the topic I must admit that this is a solution, and probably the only one as whatever I've tried other than this wouldn't work.&amp;nbsp;&lt;/P&gt;&lt;P&gt;In this case calling a function via sendcommandtoexecute results in full mouse functionality while "in running command" and a function can be defined more extensively/multiple steps etc and it still works ok,&amp;nbsp;&lt;/P&gt;&lt;P&gt;thank You very much for support,&lt;/P&gt;</description>
      <pubDate>Thu, 11 Jun 2020 10:29:01 GMT</pubDate>
      <guid>https://forums.autodesk.com/t5/net-forum/unable-to-pan-and-orbit-while-run-from-modal-dialog/m-p/9573912#M19453</guid>
      <dc:creator>autojinx</dc:creator>
      <dc:date>2020-06-11T10:29:01Z</dc:date>
    </item>
  </channel>
</rss>

