ListViewGadget()
Syntax
Result = ListViewGadget(#Gadget, x, y, Width, Height)Description
Creates a ListView gadget in the current GadgetList. If #PB_Any is used as '#Gadget' parameter, the new gadget identifier will be returned as 'Result'. #Gadget will be the numeric identifier returned by the EventGadgetID() command. Once a ListView is created, its list of items is empty.
You can add a 'mini help' to this gadget by using GadgetToolTip().
The following commands can be used to act on the list content:
- AddGadgetItem(): Add an item.
- RemoveGadgetItem(): Remove an item.
- ClearGadgetItemList(): Remove all the items
- CountGadgetItems(): Returns the number of items currently in the #Gadget.
- GetGadgetState(): Get the index of the selected item or -1 if there is no selected item.
- GetGadgetItemText(): Get the content of the given item.
- GetGadgetText(): Get the content of the selected item.
- SetGadgetState(): Change the selected item. If -1 is specified, the selection will be removed.
The following events are supported through EventType():#PB_EventType_LeftClick #PB_EventType_LeftDoubleClickExample:If OpenWindow(0,0,0,270,140,#PB_Window_SystemMenu|#PB_Window_ScreenCentered,"ListViewGadget") And CreateGadgetList(WindowID(0)) ListViewGadget(0,10,10,250,120) For a=1 To 12 AddGadgetItem (0,-1,"Item "+Str(a)+" of the Listview") ; define listview content Next SetGadgetState(0,9) ; set (beginning with 0) the tenth item as the active one Repeat : Until WaitWindowEvent()=#PB_Event_CloseWindow EndIf
Supported OS
All