Toolbars und Tooltips mit GFA-Basic (16-Bit)

Folgende Botschaften fr die Toolbar existieren bereits unter Windows 3.11:

TB_ADDBITMAP		TB_HIDEBUTTON
TB_ADDBUTTONS		TB_INSERTBUTTON
TB_BUTTONCOUNT		TB_ISBUTTONCHECKED
TB_CHECKBUTTON		TB_ISBUTTONENABLED
TB_COMMANDTOINDEX	TB_ISBUTTONHIDDEN
TB_DELETEBUTTON		TB_ISBUTTONPRESSED
TB_ENABLEBUTTON		TB_PRESSBUTTON
TB_GETBUTTON		TB_SETSTATE
TB_GETSTATE

-------------------------------------------------------------------------------------------
Function CreateToolbar

HWND CreateToolbar(hwnd, ws, wID, nBitmaps, hBMInst, wBMID, lpButtons, iNumButtons)
HWND hwnd;		// parent window handle
DWORD ws;		// toolbar window styles
WORD wID;		// control identifier
int nBitmaps;		// number of buttons in bitmap
HINSTANCE hBMInst;	// instance handle for module with bitmap
WORD wBMID;		// bitmap resource identifier
LPTBBUTTON lpButtons;	// buffer containing TBBUTTON structure
int iNumButtons;	// number of buttons to add to toolbar


The CreateToolbar function creates a toolbar window and adds the given buttons to the toolbar. 

Parameters

hwnd
Identifies the parent window for the toolbar.

ws
Specifies the window styles for the toolbar. This parameter must specify at least the WS_CHILD style.

wID
Specifies the control identifier for the toolbar.

nBitmaps
Specifies the number of button images contained in the bitmap specified the hBMInst and wBMID parameters.

hBMInst
Identifies the module instance with the executable file that contains the bitmap resource.

wBMID
Specifies the resource identifier for the bitmap resource. If the hBMInst is NULL, this parameter must be a valid bitmap handle.

lpButtons
Points to a TBBUTTON structure containing information about the buttons to add to the toolbar.

iNumButtons
Specifies the number of buttons to add to the toolbar.


Return Values

The return value is the window handle of the toolbar if the function is successful; otherwise, it is NULL.

Comments

The bitmap (whether a resource or memory bitmap) must be a series of button images. Each image must be 16 pixels wide and 15 pixels high. The image for the first button must have its upper-left corner at location x=0,y=0 in the bitmap, the second image must be at x=16,y=0, the third at x=32,y=0, and so on.

See Also: TBBUTTON
-------------------------------------------------------------------------------------------
Message TB_ADDBITMAP

An application sends the TB_ADDBITMAP message to add a new bitmap to the list of bitmaps available for a toolbar. 

wParam		number of buttons in bitmap
lParam		MAKELONG(hBMInst, wBMID)
		// instance handle of module with
		// bitmap; bitmap resource identifier

Parameters

nButtons
Value of the wParam parameter. This specifies the number of buttons in the bitmap.

hBMInst
Low word of the lParam parameter. This identifies the module instance with an executable file that contains the bitmap resource.

wBMID
High word of lParam. This specifies the resource identifier for the bitmap resource.


Return Values

The return value is the index of the first button in the bitmap if the message is successful; otherwise, it is -1.

See Also: TB_ADDBUTTONS
-------------------------------------------------------------------------------------------
TB_ADDBUTTONS

wParam = (WPARAM) nButtons;			// number of buttons
lParam = (LPARAM) (LPTBBUTTON) lpButtons;	// buffer containing button information
												

An application sends the TB_ADDBUTTONS message to add a button to the toolbar.

Parameters

nButtons

Value of the wParam parameter. This specifies the number of buttons to add.

lpButtons

Value of the lParam parameter. This points to an array of TBBUTTON structures containing information about the buttons to add. There must be the same number of elements in the array as buttons specified by the nButtons parameter.

Return Values

The return value is TRUE if the message is successful; otherwise, it is FALSE.

See Also

TBBUTTON, TB_DELETEBUTTON, TB_INSERTBUTTON
-------------------------------------------------------------------------------------------
TB_BUTTONCOUNT

wParam = 0;	// not used; must be zero
lParam = 0L;	// not used; must be zero

An application sends the TB_BUTTONCOUNT message to retrieve a count of the buttons currently in the toolbar.

Parameters

This message has no parameters.

Return Values

The return value is a count of the buttons currently in the toolbar.
-------------------------------------------------------------------------------------------
TB_CHECKBUTTON

wParam = (WPARAM) idButton;			// command identifier
lParam = (LPARAM) MAKELONG(fCheck, 0);		// check or uncheck flag

An application sends the TB_CHECKBUTTON message to check or uncheck a given button. When a button has been checked, it appears to have been pressed.

Parameters

idButton

Value of the wParam parameter. This specifies the command identifier of the button to check.

fCheck

Low word of the lParam parameter. This specifies whether to add or remove the check. If this parameter is TRUE, the check is added. If FALSE, the check is removed.

Return Values

The return value is TRUE if the message is successful; otherwise, it is FALSE.

See Also

TB_ENABLEBUTTON
-------------------------------------------------------------------------------------------
TB_COMMANDTOINDEX

wParam = (WPARAM) idButton;	// command identifier
lParam = 0L;			// not used; must be zero


An application sends the TB_COMMANDTOINDEX message to retrieve the zero-based index for the button associated with the given command identifier.

Parameters

idButton

Value of the wParam parameter. This specifies the command identifier associated with the button.

Return Values

The return value is the zero-based index for the button.

See Also

TB_DELETEBUTTON, TB_INSERTBUTTON
-------------------------------------------------------------------------------------------
TB_COMMANDTOINDEX

wParam = (WPARAM) idButton;		// command identifier
lParam = 0L;				// not used; must be zero


An application sends the TB_COMMANDTOINDEX message to retrieve the zero-based index for the button associated with the given command identifier.

Parameters

idButton

Value of the wParam parameter. This specifies the command identifier associated with the button.

Return Values

The return value is the zero-based index for the button.
-------------------------------------------------------------------------------------------
TB_CUSTOMIZE

wParam = 0;			// not used; must be zero
lParam = 0L;			// not used; must be zero


An application sends a TB_CUSTOMIZE message to display the Customize Toolbar dialog box.

Parameters

This message has no parameters.

Return Value

This message has no return values.
-------------------------------------------------------------------------------------------

TB_CUSTOMIZE

wParam = 0;		// not used; must be zero
lParam = 0L;		// not used; must be zero


An application sends a TB_CUSTOMIZE message to display the Customize Toolbar dialog box.

Parameters

This message has no parameters.

Return Value

This message has no return values.
-------------------------------------------------------------------------------------------
TB_DELETEBUTTON

wParam = (WPARAM) iButton;		// zero-based button index
lParam = 0L				// not used; must be zero


An application sends the TB_DELETEBUTTON message to delete a button from the toolbar.

Parameters

iButton

Value of the wParam parameter. This specifies the zero-based index of the button to delete.

Return Values

The return value is TRUE if the message is successful; otherwise, it is FALSE.
-------------------------------------------------------------------------------------------
TB_ENABLEBUTTON

wParam = (WPARAM) idButton;			// command identifier
lParam = (LPARAM) MAKELONG(fEnable, 0);		// enable or disable flag


An application sends the TB_ENABLEBUTTON message to enable or disable the given button. When a button has been enabled, it can be pressed and checked.

Parameters

idButton

Value of the wParam parameter. This specifies the command identifier or the button to enable or disable.

fEnable

Low word of the lParam parameter. This specifies whether to enable or disable the button. If this parameter is TRUE, the button is enabled. If FALSE, it is disabled.

Return Values

The return value is TRUE if the message is successful; otherwise, it is FALSE.

-------------------------------------------------------------------------------------------
TB_GETBUTTON

wParam = (WPARAM) iButton;			// zero-based button index
lParam = (LPARAM) (LPTBBUTTON) lpButton;	// buffer to receive button information


An application sends the TB_GETBUTTON message to retrieve information about the given button.

Parameters

iButton

Value of the wParam parameter. This specifies the zero-based index of the button for which to retrieve information.

lpButton

Value of the lParam parameter. This points to the TBBUTTON structure that receives the button information.

Return Values

The return value is TRUE if the message is successful; otherwise, it is FALSE.
-------------------------------------------------------------------------------------------
TB_GETSTATE

wParam = (WPARAM) idButton;		// command identifier
lParam = 0L;				// not used; must be zero


An application sends the TB_GETSTATE message to retrieve information about the state of the button, such as whether it is enabled, pressed, or checked.

Parameters

idButton

Value of the wParam parameter. This specifies the command identifier of the button for which to retrieve information.

Return Values

The return values is the button state information if the message is successful. Otherwise, it is -1. The button state information can be a combination of the following values:

Value			Meaning
TBSTATE_CHECKED		The button is checked.
TBSTATE_ENABLED		The button is enabled.
TBSTATE_HIDDEN		The button is hidden.
TBSTATE_PRESSED		The button is pressed.

-------------------------------------------------------------------------------------------
TB_HIDEBUTTON
wParam = (WPARAM) idButton;			// command identifier
lParam = (LPARAM) MAKELONG(fShow, 0);		// show or hide flag
												

An application sends the TB_HIDEBUTTON message to hide or show the given button. 

Parameters

idButton

Value of the wParam parameter. This specifies the command identifier of the button to hide or show.

fShow

Low word of the lParam parameter. This specifies whether to hide or show the button. If this parameter is TRUE, the button is hidden. If FALSE, it is shown.

Return Values

The return value is TRUE if the message is successful; otherwise, it is FALSE.
-------------------------------------------------------------------------------------------
TB_INSERTBUTTON

wParam = (WPARAM) iButton;			// zero-based button index
lParam = (LPARAM) (LPTBBUTTON) lpButton;	// buffer containing button information


An application sends the TB_INSERTBUTTON message to insert a button on the toolbar.

Parameters

iButton

Value of the wParam parameter. This specifies the zero-based index of a button. The message inserts the new button in front of this button.

lpButton

Value of the lParam parameter. This points to a TBBUTTON structure containing information about the button to insert. 

Return Values

The return value is TRUE if the message is successful; otherwise, it is FALSE.
-------------------------------------------------------------------------------------------
TB_ISBUTTONCHECKED

wParam = (WPARAM) idButton;		// command identifier
lParam = 0L;				// not used; must be zero


An application sends the TB_ISBUTTONCHECKED message to determine whether the given button is checked. 

Parameters

idButton

Value of the wParam parameter. This specifies the command identifier of the button.

Return Values

The return value is nonzero if the button has a check; otherwise, it is zero.

-------------------------------------------------------------------------------------------
TB_ISBUTTONENABLED

wParam = (WPARAM) idButton;	// command identifier
lParam = 0L;			// not used; must be zero

An application sends the TB_ISBUTTONENABLED message to determine whether the given button is enabled. 

Parameters

idButton

Value of the wParam parameter. This specifies the command identifier of the button.

Return Values

The return value is nonzero if the button is enabled; otherwise, it is zero.
-------------------------------------------------------------------------------------------
TB_ISBUTTONENABLED

wParam = (WPARAM) idButton;		// command identifier
lParam = 0L;				// not used; must be zero


An application sends the TB_ISBUTTONENABLED message to determine whether the given button is enabled. 

Parameters

idButton

Value of the wParam parameter. This specifies the command identifier of the button.

Return Values

The return value is nonzero if the button is enabled; otherwise, it is zero.
-------------------------------------------------------------------------------------------
TB_ISBUTTONHIDDEN

wParam = (WPARAM) idButton;		// command identifier
lParam = 0L;				// not used; must be zero


An application sends the TB_ISBUTTONHIDDEN message to determine whether the given button is hidden. 

Parameters

idButton

Value of the wParam parameter. This specifies the command identifier of the button.

Return Values

The return value is nonzero if the button is hidden; otherwise, it is zero.
-------------------------------------------------------------------------------------------
TB_ISBUTTONPRESSED

wParam = (WPARAM) idButton;			// command identifier
lParam = 0L;					// not used; must be zero


An application sends the TB_ISBUTTONPRESSED message to determine whether the given button is pressed. 

Parameters

idButton

Value of the wParam parameter. This specifies the command identifier of the button.

Return Values

The return value is nonzero if the button is pressed; otherwise, it is zero.
-------------------------------------------------------------------------------------------
TB_PRESSBUTTON

wParam = (WPARAM) idButton;			// command identifier
lParam = (LPARAM) MAKELONG(fPress, 0);		// press or release flag
												

An application sends the TB_PRESSBUTTON message to press or release the given button. 

Parameters

idButton

Value of the wParam parameter. This specifies the command identifier of the button to press or release. 

fPress

Low word of the lParam parameter. This specifies whether to press or release the button. If this parameter is TRUE, the button is pressed. If FALSE, it is released.

Return Values

The return value is TRUE if the message is successful; otherwise, it is FALSE.
-------------------------------------------------------------------------------------------
TB_SAVERESTORE

wParam = (WPARAM) (BOOL) fSave;			// save or restore flag
lParam = (LPARAM) (LPSTR) lpszSectionFile;	// name of section and file


An application sends a TB_SAVERESTORE message to save or restore the state of the toolbar. 

Parameters

fSave

Value of the wParam parameter. This specifies whether to save or restore the information. If this parameter is TRUE, the information is saved; otherwise, it is restored.

lpszSectionFile

Value of the lParam parameter. This points to two consecutive null-terminated strings. The first string specifies the name of a section in an initialization file. The second string specifies the name of the initialization file. If the second string is empty, the message uses the WIN.INI file by default.

Return Value

-------------------------------------------------------------------------------------------
TB_SETSTATE

wParam = (WPARAM) idButton;			// command identifier
lParam (LPARAM) MAKELONG(fState, 0);		// button state information
												

An application sends the TB_SETSTATE message to set the state for the given button.

Parameters

idButton

Value of the wParam parameter. This specifies the command identifier of the button. 

fState

Low word of the lParam parameter. This specifies the state information for the button. It can be a combination of the following values:

Value			Meaning
TBSTATE_CHECKED		The button is checked.
TBSTATE_ENABLED		The button is enabled.
TBSTATE_HIDDEN		The button is hidden.
TBSTATE_PRESSED		The button is pressed.


Return Values

The return value is TRUE if the message is successful; otherwise, it is FALSE.

-------------------------------------------------------------------------------------------
aus COMMCTRL.H von Windows 95:

CMB_MASKED&=0x02

TBSTATE_CHECKED&=0x01
TBSTATE_PRESSED&=0x02
TBSTATE_ENABLED&=0x04
TBSTATE_HIDDEN&=0x08
TBSTATE_INDETERMINATE&=0x10
TBSTATE_WRAP&=0x20

TBSTYLE_BUTTON&=0x00
TBSTYLE_SEP&=0x01
TBSTYLE_CHECK&=0x02
TBSTYLE_GROUP&=0x04
TBSTYLE_CHECKGROUP&=TBSTYLE_GROUP& | TBSTYLE_CHECK&

TBSTYLE_TOOLTIPS&=0x0100
TBSTYLE_WRAPABLE&=0x0200
TBSTYLE_ALTDRAG&=0x0400

TB_ENABLEBUTTON%=WM_USER+1
TB_CHECKBUTTON%=WM_USER+2
TB_PRESSBUTTON%=WM_USER+3
TB_HIDEBUTTON%=WM_USER+4
TB_INDETERMINATE%=WM_USER+5
TB_ISBUTTONENABLED%=WM_USER+9
TB_ISBUTTONCHECKED%=WM_USER+10
TB_ISBUTTONPRESSED%=WM_USER+11
TB_ISBUTTONHIDDEN%=WM_USER+12
TB_ISBUTTONINDETERMINATE%=WM_USER+13
TB_SETSTATE%=WM_USER+17
TB_GETSTATE%=WM_USER+18
TB_ADDBITMAP%=WM_USER+19
TB_ADDBUTTONS%=WM_USER + 20
TB_INSERTBUTTON%=WM_USER + 21
TB_DELETEBUTTON%=WM_USER + 22
TB_GETBUTTON%=WM_USER + 23
TB_BUTTONCOUNT%=WM_USER + 24
TB_COMMANDTOINDEX%=WM_USER + 25

' TB_SAVERESTOREA%=WM_USER+26     'Bei normalem Text (kein Unicode)
' TB_SAVERESTOREW%=WM_USER+76    'Bei Unicode
TB_SAVERESTORE%=WM_USER+26
TB_CUSTOMIZE%=WM_USER+27
' TB_ADDSTRINGA%=WM_USER+28     'Bei normalem Text (kein Unicode)
' TB_ADDSTRINGW%=WM_USER+77    'Bei Unicode
TB_ADDSTRING%=WM_USER+28
TB_GETITEMRECT%=WM_USER+29
TB_BUTTONSTRUCTSIZE%=WM_USER+30
TB_SETBUTTONSIZE%=WM_USER+31
TB_SETBITMAPSIZE%=WM_USER+32
TB_AUTOSIZE%=WM_USER+33
TB_GETTOOLTIPS%=WM_USER+35
TB_SETTOOLTIPS%=WM_USER+36
TB_SETPARENT%=WM_USER+37
TB_SETROWS%=WM_USER+39
TB_GETROWS%=WM_USER+40
TB_SETCMDID%=WM_USER+42
TB_CHANGEBITMAP%=WM_USER+43
TB_GETBITMAP%=WM_USER+44
' TB_GETBUTTONTEXTA%=WM_USER+45     'Bei normalem Text (kein Unicode)
' TB_GETBUTTONTEXTW%=WM_USER+75    'Bei Unicode
TB_GETBUTTONTEXT%=WM_USER+45
TB_REPLACEBITMAP%=WM_USER+46
TB_SETINDENT%=WM_USER+47
-------------------------------------------------------------------------------------------
Type TBBUTTON

The TBBUTTON structure contains information about a button in a toolbar.


TYPE TBBUTTON:
 - WORD iBitmap		// zero-based button index
 - WORD idCommand	// command identifier
 - BYTE fsState		// button state information
 - BYTE fsStyle		// button style
 - WORD iString		// resource identifier for help string
ENDTYPE


Members

iBitmap
Specifies the zero-based index of the button identifying the location in the bitmap of the image of the button.

idCommand
Specifies the command identifier associated with the button. This identifier is used in a WM_COMMAND message when the button is pressed. This member must be zero if the fsStyle member is TBSTYLE_SEP.

fsState
Specifies the button state information. It can be a combination of the following values:

	Value			Meaning
	TBSTATE_CHECKED		The button is checked.
	TBSTATE_ENABLED		The button is enabled.
	TBSTATE_HIDDEN		The button is hidden.
	TBSTATE_PRESSED		The button is pressed.

fsStyle
Specifies the style of the button. It can be a combination of the following:

	Value			Meaning
	TBSTYLE_BUTTON		This style creates a standard button.
	TBSTYLE_CHECK		This style creates a button that stays pressed until released.
	TBSTYLE_CHECKGROUP	This style creates a check button that stays pressed until released or until another button in the group is pressed.
	TBSTYLE_GROUP		This style creates a check button that stays pressed until another button in the group is pressed.
	TBSTYLE_SEP		This style creates a separator, providing a small gap between button groups.

idsHelp
Specifies the resource identifier of the help text string for the button.

-------------------------------------------------------------------------------------------

' TYPE TBADDBITMAP:
 ' - HINSTANCE hInst
 ' - UINT nID
' ENDTYPE

HINST_COMMCTRL&=HINSTANCE-1
IDB_STD_SMALL_COLOR&=0
IDB_STD_LARGE_COLOR&=1
IDB_VIEW_SMALL_COLOR&=4
IDB_VIEW_LARGE_COLOR&=5

// icon indexes for standard bitmap
STD_CUT&=0
STD_COPY&=1
STD_PASTE&=2
STD_UNDO&=3
STD_REDOW&=4
STD_DELETE&=5
STD_FILENEW&=6
STD_FILEOPEN&=7
STD_FILESAVE&=8
STD_PRINTPRE&=9
STD_PROPERTIES&=10
STD_HELP&=11
STD_FIND&=12
STD_REPLACE&=13
STD_PRINT&=14

// icon indexes for standard view bitmap
VIEW_LARGEICONS&=0
VIEW_SMALLICONS&=1
VIEW_LIST&=2
VIEW_DETAILS&=3
VIEW_SORTNAME&=4
VIEW_SORTSIZE&=5
VIEW_SORTDATE&=6
VIEW_SORTTYPE&=7
VIEW_PARENTFOLDER&=8
VIEW_NETCONNECT&=9
VIEW_NETDISCONNECT&=10
VIEW_NEWFOLDER&=11

//Toolbar-Benachichtigungsbotschaften:
TBBF_LARGE&=0x0001

TB_GETBITMAPFLAGS&=WM_USER+41

TBN_FIRST&= -700       // toolbar
TBN_LAST&= -720
TBN_GETBUTTONINFOA&=TBN_FIRST-0
TBN_GETBUTTONINFOW&=TBN_FIRST-20
TBN_BEGINDRAG&=TBN_FIRST-1
TBN_ENDDRAG&=TBN_FIRST-2
TBN_BEGINADJUST&=TBN_FIRST-3
TBN_ENDADJUST&=TBN_FIRST-4
TBN_RESET&=TBN_FIRST-5
TBN_QUERYINSERT&=TBN_FIRST-6
TBN_QUERYDELETE&=TBN_FIRST-7
TBN_TOOLBARCHANGE&=TBN_FIRST-8
TBN_CUSTHELP&=TBN_FIRST-9

