Author Topic: Custom Palette Blank  (Read 2664 times)

0 Members and 1 Guest are viewing this topic.

flowerrobot

  • Guest
Custom Palette Blank
« on: February 04, 2013, 12:43:10 AM »
Hey guys

For some reason, When I create a custom Palette it comes out blank.
I thought maybe it was my code. So I created a test app, however same result

Code: [Select]
        <CommandMethod("ad")> _
        Public Sub MyCommand() ' This method can have any name
            Dim PalSet As PaletteSet = Nothing
            PalSet = New PaletteSet("CustPalette")
            Dim test As New CustPalette
            PalSet.Add("CustPalette", test)
            PalSet.Visible = True

        End Sub

My form just has a label but is not shown in AutoCAD. nor add items added to it.

I would really appreciate your help


Panzee

  • Mosquito
  • Posts: 2
Re: Custom Palette Blank
« Reply #1 on: February 04, 2013, 08:39:20 AM »
Try this:

Code: [Select]
      <CommandMethod("ad")> _
        Public Sub MyCommand() ' This method can have any name
            Dim PalSet As PaletteSet = New PaletteSet("CustPalette")
            Dim test As CustPalette = New CustPalette

            PalSet.Add("CustPalette", test)
            PalSet.Visible = True

        End Sub


Its from http://forums.autodesk.com/autodesk/attachments/autodesk/152/26712/1/CP205-2_Mike_Tuersley.pdf
Creating a Docking Palette for AutoCADŽ with VB.NET

MexicanCustard

  • Swamp Rat
  • Posts: 705
Re: Custom Palette Blank
« Reply #2 on: February 04, 2013, 08:43:11 AM »
I wrap my palettes in an ElementHost object

Your example in C# sorry Im not a VB guy

Code: [Select]
[CommandMethod("ad")]
        public void MyCommand()
        {
            var PalSet = new PaletteSet("CustPalette");
            var test = new CustPalette();
            var host = new ElementHost { AutoSize = true, Dock = DockStyle.Fill, Child = test };
            PalSet.Add("CustPalette", host);
            PalSet.Visible = True;

        }
Revit 2019, AMEP 2019 64bit Win 10

TheMaster

  • Guest
Re: Custom Palette Blank
« Reply #3 on: February 04, 2013, 11:24:33 AM »
Hey guys

For some reason, When I create a custom Palette it comes out blank.
I thought maybe it was my code. So I created a test app, however same result

Code: [Select]
        <CommandMethod("ad")> _
        Public Sub MyCommand() ' This method can have any name
            Dim PalSet As PaletteSet = Nothing
            PalSet = New PaletteSet("CustPalette")
            Dim test As New CustPalette
            PalSet.Add("CustPalette", test)
            PalSet.Visible = True

        End Sub

My form just has a label but is not shown in AutoCAD. nor add items added to it.

I would really appreciate your help

A Palette requires a Control. You don't show what 'CustPalette' is, and you referred to a 'form', which I don't think can be added to a Palette.

BlackBox

  • King Gator
  • Posts: 3770
Re: Custom Palette Blank
« Reply #4 on: February 04, 2013, 06:58:52 PM »
"How we think determines what we do, and what we do determines what we get."

flowerrobot

  • Guest
Re: Custom Palette Blank
« Reply #5 on: February 04, 2013, 10:19:35 PM »
Thanks guys TT is the winner.  I was using the Form not a container. such a simple mistake and so easily overlooked.


MexicanCustard why do you encapsulate your container? I couldn't get the library to "ElementHost" so I gave up trying that.

Thanks alot guys


flowerrobot

  • Guest
Re: Custom Palette Blank
« Reply #6 on: February 04, 2013, 11:51:32 PM »
I just noticed there is no "close" for containers

On the term of "container" class, What are they really? Are forms derived from these?


MexicanCustard

  • Swamp Rat
  • Posts: 705
Re: Custom Palette Blank
« Reply #7 on: February 06, 2013, 08:06:52 AM »
MexicanCustard why do you encapsulate your container? I couldn't get the library to "ElementHost" so I gave up trying that.

I use WPF to create my palettes and the ElementHost handles filling the palette. So I can make my form any size I want and the element host always controls filling the palette so things look good.

ElementHost is in System.Windows.Forms.Integration
Revit 2019, AMEP 2019 64bit Win 10

TheMaster

  • Guest
Re: Custom Palette Blank
« Reply #8 on: February 06, 2013, 08:30:59 AM »
I just noticed there is no "close" for containers

On the term of "container" class, What are they really? Are forms derived from these?

If you mean ContainerControl, this is not a designable control. You should create a UserControl (WinForms) to use as the control on your Palette.