Help creating scrolling list and determing selected

Hi,

Was wondering if someone could help me with this.

Im building a simple search function and I would like to be able to create a dynamically populated & horizontally scrollable list of “search by” items. I have 2 problems.

  1. Im not sure how to best way to create the list on the fly
  2. Im not sure how the best way to determine the selected “sort by” item

Any ideas?