LAnnToolBar::FreeToolBarButtons
#include "ltwrappr.h"
virtual L_INT LAnnToolBar::FreeToolBarButtons(pButtons, uButtons)
pANNBUTTON pButtons; |
/* array of buttons to include in the toolbar */ |
L_UINT uButtons; |
/* number of buttons in the toolbar */ |
Frees the memory allocated by LAnnToolBar::GetToolBarButtons for the pButtons array. This function is available in the Document/Medical Toolkits.
Parameter |
Description |
pButtons |
An array of ANNBUTTON structures that contain information about the buttons in the annotation toolbar. |
uButtons |
Number of buttons in the toolbar. (Number of entries in the pButtons array.) |
Returns
SUCCESS |
The function was successful. |
< 1 |
An error occurred. Refer to Return Codes. |
Required DLLs and Libraries
LTANN For a listing of the exact DLLs and Libraries needed, based on the toolkit version, refer to Files To Be Included With Your Application. |
See Also
Example
//This example uses the following member variables:
// LAnnotationWindow m_AnnotationWindow
// m_AnnotationWindow should be created and initialized prior to the example
//
// LAnnToolBar m_annToolBar
// mAnnToolBar should be created and initialized prior to the example
void CVCAnnotationToolbar11Dlg::OnButtonToolbarTest()
{
L_UINT uButtons;
pANNBUTTON pButtons;
L_INT nRet;
HGLOBAL hGlobal;
LBitmap myBitmap;
//Assume declaration: LAnnToolBar m_annToolBar
myBitmap.Load(TEXT("d:\\work\\images\\rgbw.bmp"));
myBitmap.Size(TOOLBARIMAGECX, TOOLBARIMAGECY);
// get the number of buttons in the toolbar
nRet = m_annToolBar.GetToolBarButtons(NULL,sizeof(ANNBUTTON),
&uButtons);
if (nRet == SUCCESS)
{
// allocate an array big enough to
hold the number of existing buttons + 1
hGlobal = ::GlobalAlloc(GMEM_MOVEABLE,
(uButtons+1)*sizeof(ANNBUTTON));
pButtons = (pANNBUTTON)::GlobalLock(hGlobal);
if (pButtons)
{
// get the
existing buttons
nRet = m_annToolBar.GetToolBarButtons(pButtons,sizeof(ANNBUTTON),
&uButtons);
if (nRet ==
SUCCESS)
{
// add a new user defined tool button
pButtons[uButtons].uFlags = 0;
pButtons[uButtons].uTool = ANNTOOL_USER;
pButtons[uButtons].pBitmapUp = myBitmap.GetHandle();
pButtons[uButtons].pBitmapDown = pButtons[uButtons].pBitmapUp;
pButtons[uButtons].nToolTipTextID = -1;
pButtons[uButtons].pToolTipText = TEXT("Tool Tip");
m_annToolBar.SetToolBarButtons(pButtons,
uButtons+1);
// free uButtons
m_annToolBar.FreeToolBarButtons(pButtons,
uButtons);
::GlobalUnlock(pButtons);
::GlobalFree(hGlobal);
//Change
the number of rows and columns
ANNTOOLBARINFO
annToolBarInfo;
m_annToolBar.GetToolBarInfo(&annToolBarInfo,
sizeof(annToolBarInfo));
if
(annToolBarInfo.uRows > 1)
{
m_annToolBar.SetToolBarColumns(annToolBarInfo.uColumns
+ 1);
//
or do the line below
//m_annToolBar.SetToolBarRows(annToolBarInfo.uRows
-1);
}
}
else
AfxMessageBox(TEXT("Error
getting toolbar buttons."));
}
else
AfxMessageBox(TEXT("Not
enough memory to allocate pButtons."));
}
else
AfxMessageBox(TEXT("Error getting
uButtons."));
}