.NET

Reply
Active Member
markodjurovic
Posts: 9
Registered: ‎01-13-2006
Message 1 of 3 (175 Views)

PaletteSet and Editor problem

175 Views, 2 Replies
07-14-2006 09:26 AM
I have some problems with PaletteSet object and Editor:
I have one static member variable:

static Autodesk.AutoCAD.Windows.PaletteSet ps;

and on some command I set it to visible and that looks like this:

[CommandMethod("TCG", "TRASA", CommandFlags.Modal)]
public static void InsertTrasa()
{
if (Key.CheckLicence() == false)
{
int count = AcadUtilities.GetEntityCount();
if (count >= Key.MAX_OBJECTS)
{
DialogBox dlg = new DialogBox(DialogMode.NotLicensed);
dlg.TopMost = true;
dlg.ShowDialog();
return;
}
}

if (routeEditorAdded == false)
{
PaletteSet ps = new Autodesk.AutoCAD.Windows.PaletteSet("Osobine segmenta trase", new Guid("{B28F5CF7-AC01-4348-9726-FA02D1A75305}"));

ps.Style = Autodesk.AutoCAD.Windows.PaletteSetStyles.NameEditable |
Autodesk.AutoCAD.Windows.PaletteSetStyles.ShowPropertiesMenu |
Autodesk.AutoCAD.Windows.PaletteSetStyles.ShowAutoHideButton |
Autodesk.AutoCAD.Windows.PaletteSetStyles.ShowCloseButton;

re = new RouteEditor();

routeEditorAdded = true;

re.SizeChanged += new EventHandler(re_SizeChanged);
ps.Add("Segment", re);
ps.Size = new System.Drawing.Size(400, 600);
ps.Location = new System.Drawing.Point(100, 100);
ps.Dock = Autodesk.AutoCAD.Windows.DockSides.Right;
}
ps.Visible = true;

After that I am calling editor method to pick some point:

PromptPointResult ppr = Application.DocumentManager.MdiActiveDocument.Editor.GetPoint("Select point");

and WTF!!!! Editor somehow detects that operation GetPoint is canceled and ppr.Status is equal to PromptStatus.Cancel. Please, if someone have solution for this problem, help. Note: nothing of this happening if comment line ps.Visible = true (when ps stays unvisible editor works fine)
Active Member
markodjurovic
Posts: 9
Registered: ‎01-13-2006
Message 2 of 3 (175 Views)

Re: PaletteSet and Editor problem

07-14-2006 09:38 AM in reply to: markodjurovic
correction I didn't copy/pasted good

static PaletteSet ps; // staic member
.
.
.//in command I have like this:

if (routeEditorAdded == false)
{
ps = new Autodesk.AutoCAD.Windows.PaletteSet("Osobine segmenta trase", new Guid("{B28F5CF7-AC01-4348-9726-FA02D1A75305}"));
ps.Style = Autodesk.AutoCAD.Windows.PaletteSetStyles.NameEditable |
Autodesk.AutoCAD.Windows.PaletteSetStyles.ShowPropertiesMenu |
Autodesk.AutoCAD.Windows.PaletteSetStyles.ShowAutoHideButton |
Autodesk.AutoCAD.Windows.PaletteSetStyles.ShowCloseButton;

re = new RouteEditor();

routeEditorAdded = true;

re.SizeChanged += new EventHandler(re_SizeChanged);
ps.Add("Segment", re);
ps.Size = new System.Drawing.Size(400, 600);
ps.Location = new System.Drawing.Point(100, 100);
ps.Dock = Autodesk.AutoCAD.Windows.DockSides.Right;
}
ps.Visible = true;

//And after that I call:
PromptPointResult ppr = Application.DocumentManager.MdiActiveDocument.Editor.GetPoint("Select point");

And automaticly I get that the GetPoint is Canceled and status is PromptStatus.Cancel. Whe ps stays unvisible everything is fine
Valued Contributor
FRFR1426
Posts: 92
Registered: ‎04-05-2012
Message 3 of 3 (66 Views)

Re: PaletteSet and Editor problem

09-03-2013 11:11 AM in reply to: markodjurovic

I'm a bit late, but I add this for reference. The problem is that when you change the property Visible on the palette set (ps.Visible = true), AutoCAD execute the command associated to the palette set to show or hide it. The workaround is to stop the command and restart it when the palette is visible:

 

if (!ps.Visible)
{
  ps.Visible = true;
  ed.EnteringQuiescentState += ed_EnteringQuiescentState;
  return;
}

[..]

void ed_EnteringQuiescentState(object sender, EventArgs e)
{
    var ed = (Editor) sender;
    try
    {
        ed.Document.SendStringToExecute(CMD + "\n", false, false, false);
    }
    finally
    {
        ed.EnteringQuiescentState -= ed_EnteringQuiescentState;
    }
}

 

Post to the Community

Have questions about Autodesk products? Ask the community.

New Post
Announcements
Are You Going To Be @ AU 2014? Feel free to drop by our AU topic post and share your plans, plug a class that you're teaching, or simply check out who else from the community might be in attendance. Ohh and don't forgot to stop by the Autodesk Help | Learn | Collaborate booths in the Exhibit Hall and meet our community team if you get a chance!