Minimal example for dynamic (gui) button matrix

hi, i am looking for a minimal example on how to

  1. create a matrix (or grid if u prefer) of buttons
  2. add / remove buttons from the grid
  3. save / load settings, preferably resulting in same buttons

my usecase is a grid of buttons, each having a thumbnail of a video, when you click a button, u load said video.

it will be part of my bpm synced video player : GitHub - sloev/videobeats

by the way i have seen the ofparametercollection example here: ofxParameterCollection/src at master · c-mendoza/ofxParameterCollection · GitHub

but one thing i dont understand is that it seems i still have to manually clear/re-setup the gui on each added/removed button

is it possible to somehow

  1. declare a vector of buttons
  2. add remove to that vector
  3. see the gui automaticaly update?