Page 1 of 1

Get entire ListIconGadget item row

Posted: Thu Jun 13, 2019 2:32 am
by BarryG
My wish is for the GetGadgetItemText() command to support a column value of -1, which means to return all columns together, with #LF$ separating them. This means we can easily pluck an item row and add it to another ListIconGadget() easily, without manually getting the item text from each column (of which there may be lots):

Code: Select all

If OpenWindow(0, 100, 100, 300, 100, "ListIcon Example", #PB_Window_SystemMenu)
  ListIconGadget(0, 5, 5, 290, 90, "Name", 100, #PB_ListIcon_FullRowSelect)
  AddGadgetColumn(0, 1, "Age", 50)
  AddGadgetColumn(0, 2, "Address", 250)
  AddGadgetItem(0, -1, "Harry Rannit" + #LF$ + "25" + #LF$ + "12 Parliament Way")
  Repeat
    Event = WaitWindowEvent()
    If Event = #PB_Event_Gadget And EventType()=#PB_EventType_LeftClick
      item = GetGadgetState(0)
      Debug GetGadgetItemText(0, item) ; "Harry Rannit" only is returned. :(
      ; WISH: Debug GetGadgetItemText(0, item, -1) ; -1 would return "Harry Rannit"+#LF$+"25"+#LF$+"12 Parliament Way"
    EndIf
  Until Event = #PB_Event_CloseWindow
EndIf