Because in PB linked lists are global variables, I don't think the approach described would work.
I think the best way to implement it is as a 2d array of strings.  You could either deliminate the string using the field command, or use fixed length codes of say three characters for your different objects.  Something like:
Code: Select all
; PureBasic Visual Designer v3.62
;- Window Constants
;
#MapWindow = 0
;- Gadget Constants
;
#Cell11 = 0
#Cell12 = 1
#Cell13 = 2
#Cell21 = 3
#Cell22 = 4
#Cell23 = 5
#Cell31 = 6
#Cell32 = 7
#Cell33 = 8
#Row1Header = 9
#Row2Header = 10
#Row3Header = 11
#Col1Header = 12
#Col2Header = 13
#Col3Header = 14
#AddText = 15
#NewText = 16
#CellList = 17
Procedure Open_MapWindow()
  If OpenWindow(#MapWindow, 216, 0, 235, 322,  #PB_Window_SystemMenu | #PB_Window_SizeGadget | #PB_Window_TitleBar , "New window ( 0 )")
    If CreateGadgetList(WindowID())
      ButtonGadget(#Cell11, 60, 50, 40, 40, "A")
      ButtonGadget(#Cell12, 110, 50, 40, 40, "B")
      ButtonGadget(#Cell13, 160, 50, 40, 40, "C")
      ButtonGadget(#Cell21, 60, 100, 40, 40, "D")
      ButtonGadget(#Cell22, 110, 100, 40, 40, "E")
      ButtonGadget(#Cell23, 160, 100, 40, 40, "F")
      ButtonGadget(#Cell31, 60, 150, 40, 40, "G")
      ButtonGadget(#Cell32, 110, 150, 40, 40, "H")
      ButtonGadget(#Cell33, 160, 150, 40, 40, "I")
      TextGadget(#Row1Header, 40, 60, 10, 20, "1")
      TextGadget(#Row2Header, 40, 110, 10, 20, "2")
      TextGadget(#Row3Header, 40, 160, 10, 20, "3")
      TextGadget(#Col1Header, 60, 20, 40, 20, "1", #PB_Text_Center)
      TextGadget(#Col2Header, 110, 20, 40, 20, "2", #PB_Text_Center)
      TextGadget(#Col3Header, 160, 20, 40, 20, "3", #PB_Text_Center)
      StringGadget(#NewText, 10, 280, 150, 30, "")
      ButtonGadget(#AddText, 170, 280, 40, 30, "Add")
      ListViewGadget(#CellList, 10, 200, 200, 70)
      
    EndIf
  EndIf
EndProcedure
Dim Map.s(2, 2)
Map(0,0) = "Wall"
Map(0,1) = "Grass|Zombie"
Map(0,2) = "Grass"
Map(1,0) = "Wall"
Map(1,1) = "Wood"
Map(1,2) = "Wood|Wolf"
Map(2,0) = "Wood|Cave|Dragon"
Map(2,1) = "Sea"
Map(2,2) = "Sea|Boat"
Procedure SetList(Row, Col)
  CellContents.s = Map(row, col)
    ClearGadgetItemList(#CellList)
    i = 1
    Repeat
      Content.s = StringField(CellContents, i, "|")
      If Content <> ""
        AddGadgetItem(#CellList, -1, Content)
      EndIf
      i = i + 1
    Until content = ""
EndProcedure
Open_MapWindow()
Repeat
  Event = WaitWindowEvent()
    Select Event
      Case #PB_Event_Gadget
        GadgetID = EventGadgetID()
        If GadgetID <= 8
          Row = Int(GadgetID / 3)
          Col = GadgetID - ((Row) * 3)
          SetList(Row, Col)
        EndIf
    EndSelect
Until Event = #PB_EventCloseWindow
End