AddGadgetItem()

Syntax

Result = AddGadgetItem(#Gadget, Position, Text$ [, ImageID [, Flags]])
Description
Add a new item to the specified gadget.

Parameters

#Gadget The gadget to use.
Position The item index where the new item should be inserted. To add the item at the start, use an index of 0. To add this item to the end of the current item list, use a value of -1. Remember that when you add an item that all current items which come after the new one will have their positions increased by 1.

For the MDIGadget() this parameter specifies the #Window number for the new MDI childwindow. #PB_Any can be used, in which case the return-value will be the new number assigned by PB.
Text$ The text for the new item.

When adding an item to a ListIconGadget(), this parameter can contain the text for multiple columns separated by a Chr(10) character.
ImageID (optional) An optional image to use for the item in gadgets that support it. The used image should be in the standard 16x16 size. Use the ImageID() command to get the ID for this parameter.
Flags (optional) This parameter has a meaning only for the following gadget types:

TreeGadget()
This parameter specifies the new sublevel for the item. If the sublevel is greater than that of the previous item, the new one will become this item's child. If it is lower, it will be added after the parent of the previous item.
MDIGadget()
This parameter can be used to specify the flags for the new window (see OpenWindow()). The #PB_Window_Borderless, #PB_Window_Screencentered and #PB_Window_WindowCentered flags are not supported for MDI windows.

Return value

The return-value is only valid with the MDIGadget(). If #PB_Any was used as the 'Position' parameter when adding an item to the MDIGadget(), the return-value is the number that identifies the new MDI window.

Remarks

The following gadgets are supported:

- ComboBoxGadget() : supports the ImageID if the #PB_ComboBox_Image is set.
- EditorGadget()
- ListIconGadget() : supports the ImageID.
- ListViewGadget()
- MDIGadget() : ImageID can contain an icon for the childwindow titlebar. Flags can specify the new window flags.
- PanelGadget() : supports the ImageID.
- TreeGadget() : supports the ImageID. 'Flags' is required and specifies the new sublevel.

See Also

RemoveGadgetItem(), ClearGadgetItems(), CountGadgetItems(), ComboBoxGadget(), ListIconGadget(), ListViewGadget(), MDIGadget(), PanelGadget(), TreeGadget()

Supported OS

All

<- AddGadgetColumn() - Gadget Index - BindGadgetEvent() ->