.NET
cancel
Showing results for 
Show  only  | Search instead for 
Did you mean: 

Deleting items from AutoCAD tool palette

0 REPLIES 0
Reply
Message 1 of 1
Anonymous
423 Views, 0 Replies

Deleting items from AutoCAD tool palette

 

Hi,

 

I open a new topic but I don´t know if it is ok. It is relevant with this topic;

      Delete Palette from AutoCAD Tool Palette

In that topic we can se that it is not posible to delete palettes.

 

 

Now i wan´t to delete a item from a palette but i have errors, the program crash... I am not sure if it is posible to remove a item from a palette or we can´t do that like in palettes.

 

This is the code;

void DeletteItemPalette (CString nameItemPalette, CString namePalette)
{
	AcTcCatalogSet* cs;
	AcTcScheme* sch;
	AcTcCatalogItem * catalog;
        AcTcCatalogItem * itemPalette;
	AcTcCatalogItem * itemPaletteItem;
	AcTcManager* man= AcTcGetManager();

	int numCatalogs;
	int i;

	wchar_t* strPaleta = new wchar_t[100];	

        if (man != NULL)
        {
          sch = NULL;
          cs = NULL; 
          numCatalogs = 0;

	  if (man != NULL) sch = man->GetScheme(0);
	  if (sch != NULL) cs = sch->GetCatalogSet(kCatalog);
	  if (cs != NULL) numCatalogs = cs->GetCatalogCount();
  	
          if (numCatalogs > 0)
          {
	    for(i=0;i<numCatalogs;i++)
	    {
		 catalog = cs->GetCatalog(i);
                 if (catalog != NULL)
                {
                    itemPalette = catalog->FindInChildren(namePalette, true);
                     if (itemPalette != NULL)
                     {
                        itemPaletteItem = itemPalette->FindInChildren(nameItemPalette, false);
                        if (itemPaletteItem != NULL)
                        {
                            if (itemPalette->DeleteChild(itemPaletteItem))
                            {
                                AfxMessageBox(_T("ok"));
                            }
                            else    
                            {
                              AfxMessageBox(_T("false"));
                            }

                            break;
                        }
                    }
                }
	    }
          }
      }
}

 

My Autocad version is 2010, i don´t now if it is relevant.

 

thanks,

 

Ane

 

0 REPLIES 0

Can't find what you're looking for? Ask the community or share your knowledge.

Post to forums  

Autodesk DevCon in Munich May 28-29th


Autodesk Design & Make Report

”Boost