Default Dock location for Palette Sets

By Madhukar Moogala

I’ve received a query from a ADN partner on how to set default dock location for Paletteset for the first time when palette is activated and user should be able to dock Paletteset in all directions : Bottom,Left,Top,Right later on.

Here is the simple code to illustrate the same.

public static PaletteSet ps = null;    [CommandMethod("MyPalette")]    public void MyPalette()    {               if (ps == null)    {    ps = new PaletteSet("My Palette 1",    new Guid("229E43DB-E76F-48F9-849A-CC8D726DF257"));    ps.SetLocation(new System.Drawing.Point(312, 763));    ps.SetSize(new System.Drawing.Size(909, 40));    /*For the first time we 'll enable on Bottom*/    ps.DockEnabled = DockSides.Bottom;         }    ps.Visible = true;    /*Add Handler*/    ps.PaletteSetMoved += ps_PaletteSetMoved;    }         void ps_PaletteSetMoved(object sender, PaletteSetMoveEventArgs e)    {    PaletteSet pt = sender as PaletteSet;    /*Remove Handler*/    pt.PaletteSetMoved -= ps_PaletteSetMoved;    pt.DockEnabled = DockSides.Bottom | DockSides.Left | DockSides.Top | DockSides.Right;         }    Sample Video :

Comments

5 responses to “Default Dock location for Palette Sets”

  1. Hi.
    I don´t want a dockable palette, I have this:
    ps.Dock = DockSides.None;
    ps.DockEnabled = DockSides.None;
    But it always appear under the ribbon. (Top side).
    How can I fix it?
    Thanks.

  2. This is important:
    Note that if you add a GUID to your call that creates the Palette set, Autocad will remember the location and size of the palette, even when you shut down and restart Autocad.

  3. Thanks your comment Joan!, sorry it took so long to get back at you.
    Yes if you add GUID, it get collected in profile.aws and application remembers loc and size, once you rename profile.aws, application no more recollects your palette pos & size.

  4. Can you try renaming profile.aws and check this problem persists.

  5. I’m interested to know if there’s an interface option that implements autocad “theme” to the Palette Set.
    ATTM, it used the default colors I set in the VS – buttons are gray, background white,etc…etc..
    is there a way for dark theme to be applied automatically to my objects.

Leave a Reply

Discover more from Autodesk Developer Blog

Subscribe now to keep reading and get access to the full archive.

Continue reading