I was working on a Pokemon Menu Engine a while back but stopped because I was working on other things. The source code really didn't get up to the moving of the arrow, well it did but I didn't work the bugs out of it. I based it on a special character in the string of menu options creating an arrow space and recording the position of that arrow space. The neat part of it though was that it drew different size menus more efficiently by making them up from component parts.
Then again maybe that is not what you were saying. If you are referring to like an item menu thing, then there is just a maximum showable items, a decision statement to show an arrow or something, and then code to alter what is shown based on the size of the list and the items you have.