Hide and Show the Property Palette

Hide and Show the Property Palette

Keith.Brown
Advisor Advisor
2,825 Views
24 Replies
Message 1 of 25

Hide and Show the Property Palette

Keith.Brown
Advisor
Advisor

Is there anyway in the AutoCAD API to 

1. Determine if the property palette is open, closed, or hidden?

2. Close the property palette.

3. Open the property palette.

0 Likes
Accepted solutions (1)
2,826 Views
24 Replies
Replies (24)
Message 21 of 25

ActivistInvestor
Mentor
Mentor

@Keith.Brown wrote:

So some good news, I implemented your PropertyInspector code above and it did exactly what I needed it to do.  I created a little helper class that implements IDisposible to handle all of the state saving for me.

 

Good, then that completely solves the problem and you can dispense with all of that confusing , overly-complicated code (ExecuteInCommandContextAsync(), Command(), etc.) since the properties palette can be hidden and shown without having to execute commands, and/or handle all sorts of events.

 

Keep in mind what I mentioned above, about showing/hiding a docked PaletteSet, which will cancel any running command or script.

0 Likes
Message 22 of 25

Keith.Brown
Advisor
Advisor

@ActivistInvestor wrote:

Keep in mind what I mentioned above, about showing/hiding a docked PaletteSet, which will cancel any running command or script.


Yes, thank you.

 

For anyone else that comes across this thread I might also add that code runs differently when netloaded vs being automatically loaded by the registry.  When netloaded I believe it runs in the command context and when automatically loaded by the registry it will run in the Application context.  This should be obvious but was not at first for me and is relevant in my case as at the end of the day I create a release version of my code and install and check everything.  The next morning I uninstall by removing the registry entries and netload again.  The first time being ran my code installs itself in the registry so each subsequent start will now be in the Application context.  This can cause trouble shooting issues if not aware.

0 Likes
Message 23 of 25

Keith.Brown
Advisor
Advisor

Just one more quick question,  Will the code you shared need to be changed for future version of AutoCAD?

0 Likes
Message 24 of 25

ActivistInvestor
Mentor
Mentor

I very much doubt that it will change although it could be extended. As far as I know it is only used by the action recorder, because the interfaces are defined in AcMr.dll. 

 

There is an interface missing from the code I posted here.  You can find the updated version here

0 Likes
Message 25 of 25

ActivistInvestor
Mentor
Mentor

@Keith.Brown wrote:

For anyone else that comes across this thread I might also add that code runs differently when netloaded vs being automatically loaded by the registry.  When netloaded I believe it runs in the command context and when automatically loaded by the registry it will run in the Application context.  This should be obvious but was not at first for me and is relevant in my case as at the end of the day I create a release version of my code and install and check everything.  


Yes this is a long standing issue. The way I deal with it is by deferring execution of the initialization code until the first time the idle event is raised. That way the initialization code always runs in the application context.