.NET

Reply
Mentor
mzakiralam
Posts: 231
Registered: ‎11-09-2012
Message 1 of 4 (161 Views)

Catch event of a paletteset while changing container inside a palette

161 Views, 3 Replies
09-03-2013 04:49 AM

How can I catch the event when I change the container inside a palette? Is it possible? If yes how can I do that? Any help regarding this issue will be appreciated.

 

Regards

Zakir

*Expert Elite*
norman.yuan
Posts: 1,017
Registered: ‎04-27-2009
Message 2 of 4 (137 Views)

Re: Catch event of a paletteset while changing container inside a palette

09-03-2013 12:50 PM in reply to: mzakiralam

Could you be more specific on what you want to know?

 

What container inside a Palette? A palette is a Windows Form UserControl (assume you use Win Form UserControl, not WPF). So,  do you mean a GroupBox, a Panel... as a container? How do you change the container?

 

Whatever you do, you can bubble up the controls' (text box, panel...whatever) events up to the UserControl and to the PalletteSet level and handles the events at PalletteSet level. Of course, you'd derive your custom PaletteSet from PaletteSet (if you use Acad2009 or later).

 

Mentor
mzakiralam
Posts: 231
Registered: ‎11-09-2012
Message 3 of 4 (124 Views)

Re: Catch event of a paletteset while changing container inside a palette

09-04-2013 12:45 AM in reply to: norman.yuan

Thanks for your reply. Sorry that my question was not so clear. I have a paletteset where there are 2 user control forms like below screen shot. My question is if I change from 'ACAD Mode' to 'EPD Mode' or vice versa, Can I catch that event?

 

Capture.JPG

*Expert Elite*
norman.yuan
Posts: 1,017
Registered: ‎04-27-2009
Message 4 of 4 (112 Views)

Re: Catch event of a paletteset while changing container inside a palette

09-04-2013 06:20 AM in reply to: mzakiralam

PaletteSet has a event PaletteActivated that you can use:

 

void MyPaletteSet_PaletteActivated(object sender, PaletteActivatedEventArgs e)
        {
            MessageBox.Show("Palette \"" + e.Activated.Name + "\" is activated!");
        }

 This event was not available in earlier version of Acad .NET API (Acad2008 or earlier?), just in case you still work with older AutoCAD version.

 

There is also a method to programmatically activate particular palette, rather than activate a palette by user selecting palette tab:

 

PaletteSet.Activate(int index)

Post to the Community

Have questions about Autodesk products? Ask the community.

New Post
Need installation help?

Start with some of our most frequented solutions or visit the Installation and Licensing Forum to get help installing your software.