Customization
A toolbar has built in customization features that you can make available to
the user by giving the toolbar the CCS_ADJUSTABLE common control style. The
customization features allow the user to drag a button to a new position or to
remove a button by dragging it off the toolbar. In addition, the user can
double-click the toolbar to display the Customize Toolbar dialog box, which allows the
user to add, delete, and rearrange toolbar buttons. An application can display
the dialog box by using the
TB_CUSTOMIZE message.
The toolbar sends notification messages (in the form of
WM_NOTIFY messages) to the parent window at each step in the customization process. If
the user holds the SHIFT key down and begins dragging a button, the toolbar automatically handles the
drag operation. The toolbar sends the
TBN_QUERYDELETE notification message to the parent window to determine whether the button may
be deleted. The drag operation ends if the parent window returns FALSE.
Otherwise, the toolbar captures mouse input and waits for the user to release the
mouse button.
When the user releases the mouse button, the toolbar determines the location
of the mouse cursor. If the cursor is outside the toolbar, the button is
deleted. If the cursor is on another toolbar button, the toolbar sends the
TBN_QUERYINSERT notification message to the parent window to determine if a button may be
inserted to the left of the given button. The button is inserted if the parent
window returns TRUE; otherwise, it is not. The toolbar sends the
TBN_TOOLBARCHANGE notification message to signal the end of the drag operation.
If the user begins a drag operation without holding down the SHIFT key, the toolbar sends the
TBN_BEGINDRAG notification message to the parent window. An application that implements its
own button-dragging code can use this message as a signal to begin a drag
operation. The toolbar sends the
TBN_ENDDRAG notification message to signal the end of the drag operation.
A toolbar sends notification messages when the user customizes a toolbar by
using the Customize Toolbar dialog box. The toolbar sends the
TBN_BEGINADJUST notification message after the user double-clicks the toolbar, but before the
dialog box is created. Next, the toolbar begins sending a series of
TBN_QUERYINSERT notification messages to determine whether the toolbar allows buttons to be
inserted. When the parent window returns TRUE, the toolbar stops sending
TBN_QUERYINSERT notifications. If the parent window does not return TRUE for any
button, the toolbar destroys the dialog box.
Next, the toolbar determines if any buttons may be deleted by sending one
TBN_QUERYDELETE notification message for each button in the toolbar. The parent window
returns TRUE to indicate that a button may be deleted; otherwise, it returns FALSE.
The toolbar adds all toolbar buttons to the dialog box, but it grays those that
may not be deleted.
Whenever the toolbar needs information about a button in the Customize Toolbar
dialog box, it sends the
TBN_GETBUTTONINFO notification message, specifying the index of the button for which it needs
information and the address of a
TBNOTIFY structure. The parent window must fill the structure with the relevant
information.
The Customize Toolbar dialog box includes a Help button and a Reset button.
When the user chooses the Help button, the toolbar sends the
TBN_CUSTHELP notification message. The parent window should respond by displaying help
information. The dialog box sends the
TBN_RESET notification message when the user selects the Reset button. This message
signals that the toolbar is about to reinitialize the dialog box.
An application can use the
TB_SAVERESTORE message to save the current state of a toolbar in an initialization file or
to restore the state based on information previously stored in an initialization
file. The message saves the state information in the specified initialization
file or in the WIN.INI file if no initialization file is specified. An
application typically stores the state before the user begins customizing the toolbar
in case the user later wants to restore the toolbar to its original state.
- Software for developers
-
Delphi Components
.Net Components
Software for Android Developers
- More information resources
-
MegaDetailed.Net
Unix Manual Pages
Delphi Examples
- Databases for Amazon shops developers
-
Amazon Categories Database
Browse Nodes Database