By Fenton Webb
Issue
Is there a way to programmatically set a palette group as the active palette group?
Solution
The palette group returned by CAcTcUiToolPaletteSet::GetToolPaletteGroup() can be iterated. If the item is not a palette and the palette group has the name you want, you can make it the active palette group with SetActivePaletteGroup().
This example gets all the pallet groups and displays the name of each palette group in a MessageBox. If the name of the palette group is "wbPGroup", it is made into the current group.
static void ASDKtestTpGroup(void)
{
CAcTcUiToolPaletteSet * pTpset = AcTcUiGetToolPaletteWindow();
CAcTcUiToolPaletteGroup * pTpgroup = pTpset->GetToolPaletteGroup(false);
CAcTcUiToolPaletteGroup * pTpSubGroup;
CString groupName;
int iCount = pTpgroup->GetItemCount();
for(int i = 0; i<iCount; i++)
{
if(!pTpgroup->IsItemPalette(i))
{
pTpgroup->GetItem(i, pTpSubGroup);
groupName = pTpSubGroup->GetName();
::MessageBox(NULL, groupName, _T("Summary Information"), MB_OK);
if(groupName == "wbPGroup")
pTpset->SetActivePaletteGroup(pTpSubGroup);
}
}
}