Advertisement
Zangofete

ListViewOfObject

Nov 17th, 2019
432
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
  1. #NoEnv  ; Recommended for performance and compatibility with future AutoHotkey releases.
  2. ; #Warn  ; Enable warnings to assist with detecting common errors.
  3. #SingleInstance, force
  4. SendMode Input  ; Recommended for new scripts due to its superior speed and reliability.
  5. SetWorkingDir %A_ScriptDir%  ; Ensures a consistent starting directory.
  6.  
  7. peopleList := [{person: "test", work: "650", mob: "800"},{person: "Two", work: "700", mob: "900"}]
  8. ; peopleList.Push({person: "Two", work: "700", mob: "900"})
  9.  
  10. Gui, Add, Text, , % "plr length" . peopleList.GetCapacity()
  11. Gui, Add, Text, , % "person 1 =" . peopleList[1].person
  12. GUI, Add, Text, , Name:
  13. Gui, Add, Edit, vEPerson Uppercase, ; force CASE so easier sanitize data
  14. GUI, Add, Text, , Work:
  15. Gui, Add, Edit, vEWork  Number,
  16. GUI, Add, Text, , Mob:
  17. Gui, Add, Edit, vEMob Number,
  18. Gui, Add, Button, gAddPerson Default, Add
  19. Gui, Add, Button, gOpenPeopleTable vOpenPeopleTable, People table
  20. Gui, Show, x467 y200 h399 w499, Shows first gui
  21.  
  22. Gui, SecondWin:Default
  23. Gui, SecondWin:Add, ListView, vDbView, Person|work|mob
  24.   For index, item in peopleList
  25.   {
  26.     pn := item.person
  27.     pb := item.work
  28.     ps := item.mob
  29.     Gui, Add, Text, , % index . item.person
  30.     LV_Add("", pn, pb, ps)
  31.   }
  32. return
  33.  
  34. OpenPeopleTable:
  35.  ; GuiControl, , DbView, peopleList
  36.   Gui, SecondWin:Show, ,second gui
  37.   GuiControl, SecondWin:, DbView, %peopleList%
  38.   ; i can still see my people list object ?
  39. return
  40.  
  41. AddPerson:
  42. Gui, Submit, NoHide
  43.   peopleList.Push({person: EPerson, work: EWork, mob: EMob})
  44.   MsgBox, % "Added person:" EPerson . ", " . EWork . ", " . EMob . " playerList length: " . peopleList.GetCapacity()
  45.   ; GuiControl, SecondWin:Show, DbView
  46.   ; GuiControl, SecondWin:, DbView ; , peopleList
  47. return
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement