TE Edit Control Win32 / Win64 Help
Product page

TerAddToolbarIcon

Add a new icon to the toolbar

BOOL TerAddToolbarIcon(hWnd, LineNo, TlbId, CmdId, BmpFile, balloon)
HWND hWnd;The handle of the window to be accessed
int LineNo;Set to 0 to add the icon to the top row of the toolbar. Set to 1 to add this icon to the bottom row of the toolbar.
int TlbId;

Set this parameter to one of the toolbar ids. Please refer to TerEditTooltip function for a list of toolbar icon ids. This would add an existing toolbar icon. The CmdId and BmpFile parameters are ignored when this parameter is non-zero.

Set this parameter to 0 to add a new tool bar icon.

int CmdId;

When the TlbId parameter is set to zero, use the CmdId parameter to specify the command id for the new toolbar icon. Please refer to the 'Command' property for a list of existing command ids.

You can use command ids ID_USER1 to ID_USER9 to implement functionality not provided by the existing command ids. For example, you can use ID_USER1 to implement PDF output icon. You would intercept ID_USER1 using the PreProcess event and execute your code there. Then call the TerIgnoreCommand method to tell the editor to ignore this command.

LPBYTE BmpFile;The bitmap file to draw the toolbar icon. The toolbar icon consists of 20x20 pixels. Therefore, the picture must be at least 20 pixels wide and 20 pixels tall. Only first 20x20 pixels are used. The remaining pixels are ignored.
LPBYTE balloon;The tool tip text string.

Example:

// Add a custom icon
TerAddToolbarIcon(hWnd,0,0,ID_PARA_KEEP,"pict.bmp","Keep");

// Add spacers and vertical separating lines
TerAddToolbarIcon(hWnd,0,TLB_SPACER,0,NULL,NULL);
TerAddToolbarIcon(hWnd,0,TLB_LINE,0,NULL,NULL);
TerAddToolbarIcon(hWnd,0,TLB_SPACER,0,NULL,NULL);

// Add an existing icons
TerAddToolbarIcon(hWnd,0,TLB_PASTE,0,NULL,NULL);

// more spacers and vertical lines
TerAddToolbarIcon(hWnd,0,TLB_SPACER,0,NULL,NULL);
TerAddToolbarIcon(hWnd,0,TLB_LINE,0,NULL,NULL);

// display the modified toolbar
TerRecreateToolbar(hWnd,TRUE);

Return Value: This function returns a TRUE value if successful.