@Anonymous wrote:
thanks Gile
I'm on my nth start with NET, pushed by the threat of VBA being abandoned sometime in the (next?) future
maybe this is the good one!
back to the present issue, your piece of advice let me have a compiling code, along with the addition of
using System.Reflection;
using System.Linq.Expressions;
and I'll go on and watch what happens...
meanwhile, since I was brought here by this thread, I'd like to know your feedback on ActivistInvestor post #11 where he proposed his PaletteSet managing pattern as opposed to yours and Juergen_Becke one: do you agree with him? If not, why?
Finally do you think that the PaletteSet pattern is the best way to build some tool and make people use some AutoCAD "custom program"?
thank you
The patterns that you see repeated in 'basic examples' are often a result of someone else using the pattern in earlier examples. They tend to propagate,
In the case of the PaletteSet, I would give through-the-interface, and possibly others from Autodesk the credit for the very first examples, none of which used what I consider the 'best practice' of inheritance (all of the PaletteSet-based UI's that come in the box, like the ribbon, do use inheritance). But in their defense, many of those early published examples were written back when the PaletteSet class was sealed, which means that deriving classes from it was not possible. As I mentioned in the thread you referenced, around the time the Ribbon appeared, the PaletteSet class was unsealed, and also had some of its members made virtual/overridable, which was done largely in support of the ribbon (although IMO, the PaletteSet shouldn't have been sealed from the beginning).
A PaletteSet is not too different from a Windows Form in terms of its purpose and use. When you build a Windows Form, the IDE generates the derived class for you, and places its initialization code in a method called InitializeComponent(), which is called from the constructor of the derived class. That's really how a component should be implemented, so that it has no dependence on other code outside its class. Because the PaletteSet class is not sealed, it also has virtual, overridable members which can only be leveraged through inheritance, so the intent of the design was clearly that the consumer of the PaletteSet class use inheritance as the means of gaining full access to the functionality it provides.
You might also want to see this thread for a more-complete example that includes the code you where having problems with above.