AddGadgetColumn()

Syntax

AddGadgetColumn(#Gadget, Position, Title$, Width)
Description
Adds a new column to the specified gadget.

Parameters

#Gadget The gadget to use.
Position The column index where the new item should be inserted. Column indexes start from 0, which is the leftmost column, and increase by 1 for each column to the right. When you add a column, all the old columns which are on the right of the new column will have a position which is one more than they previously had.
Title$ The text for the column header.
Width The initial width of the new column.

Return value

None.

Remarks

This command can be used with the following types of gadgets:

- ListIconGadget()
- ExplorerListGadget()

For ExplorerListGadget() you can use this function to completely customize the information that the gadget displays, by first removing the standard columns with RemoveGadgetColumn() and adding new ones of your choice. Note that the 'Name' column doesn't need to be the first one in the gadget.
Note: To update the gadget contents after you have added new columns, use SetGadgetText(). To fill in a custom column, use SetGadgetItemText() for each item, after you have received a #PB_EventType_Change event for the gadget.
When adding a column, use one of the following constants in the Title$ field to create a column whose contents will be automatically updated by the gadget, or use any title string you wish to create an empty column which you can then fill with SetGadgetItemText().
  #PB_Explorer_Name       : displays the name of the file/directory
  #PB_Explorer_Size       : displays the filesize in Kb
  #PB_Explorer_Type       : displays a string describing the filetype
  #PB_Explorer_Attributes : displays the attributes of the file/directory
  #PB_Explorer_Created    : displays the time the file/directory was created
  #PB_Explorer_Modified   : displays the time the file/directory was last modified
  #PB_Explorer_Accessed   : displays the time the file/directory was last accessed

Example

  If OpenWindow(0, 0, 0, 400, 150, "ListIcon - Add Columns", #PB_Window_SystemMenu | #PB_Window_ScreenCentered)
    ListIconGadget(0, 10, 10, 380, 100, "Standard Column", 150, #PB_ListIcon_GridLines)
    ButtonGadget(1, 10, 120, 150, 20, "Add new column")
    index = 1     ; "Standard column" has already index 0
    Repeat
      Event = WaitWindowEvent()
      If Event = #PB_Event_Gadget
        If EventGadget() = 1
          AddGadgetColumn(0, index, "Column "+Str(index), 80)
          index + 1
        EndIf
      EndIf
    Until Event = #PB_Event_CloseWindow
  EndIf

See Also

RemoveGadgetColumn(), ListIconGadget(), ExplorerListGadget()

Supported OS

All

Gadget Index - AddGadgetItem() ->