I don't want the palette to appear to shutdown but I have no idea on how to access the controls outside of the class.
How do I go about either running code to reload palette containers or pushing data into controls in the container.
Probably more of a basic .net question rather than AutoCAD specific but hope someone can help me.
I'm not sure what the Sub Initialize..is used for in the Palette class to be honest.
Code I have is
Public Sub Initialize() Implements Autodesk.AutoCAD.Runtime.IExtensionApplication.Initialize 'Load Palette Loading = True pal = New Palette() pal.LoadPalette() Loading = False End Sub
Public Class Palette Implements Autodesk.AutoCAD.Runtime.IExtensionApplication 'ensure single instance of this app... Friend Shared ps As Autodesk.AutoCAD.Windows.PaletteSet = Nothing Private ViewContainer As ViewCntr = Nothing Private RangeContainer As RangeCntr = Nothing Private LabelContainer As LabelCntr = Nothing Public Sub LoadPalette() If ps Is Nothing Then ps = New Autodesk.AutoCAD.Windows.PaletteSet("RC Detailer") 'Add containers ViewContainer = New ViewCntr() ps.Add("View", ViewContainer) End If 'turn it on ps.Visible = True End Sub Public Sub Initialize() Implements IExtensionApplication.Initialize 'add anything that needs to be instantiated on startup End Sub Public Sub Terminate() Implements IExtensionApplication.Terminate 'handle closing down a link to a database/etc. End Sub End Class
I think I worked it out. I needed to make the containers Public instead of Private to be able to call the subroutines within the container.
pal.ViewContainer.LoadViewData()
You should set the sub to friend shared. This will keep it public within the scope of the project.
And allow you access it from another class.
Public allows you to reference the file from another external .dll.
The objects that you are adding into the palette can be stored.
For example I am using a user control to add to a palette.
Friend Shared ps As Autodesk.AutoCAD.Windows.PaletteSet = Nothing
Friend Shared psControls As New List(Of Control)
so when i add the control
psControls.Add(New ucPartList())
I can iterate the psControls and look at the objects in it.