Page 1 of 1
List control script device?
Posted: Tue Jul 10, 2007 3:21 pm
by jkish
I've seen talk about this, but don't know if anybody has ever done anything:
I need to control a list property via a script. Functions that would be nice would be to get the currenly selected item, select an item by position, move selection up/down, add an item to the list, alpha sort the list, etc
Before I go off and do this, has anybody already built one of these things?
----
By the way, I see scripts that do the list processing and understand how it works, I just wondered if anyone had built a reusable device that just did the generic list handling. Seems like a generally useful thing that a lot of users end up having to deal with over and over.
Posted: Tue Jul 10, 2007 5:11 pm
by Richard Naninck
I have done all of those things in different scripts. Just posted a DVD script in the scripts section which shows how to sort in a list and get a selection from a list. Other examples of this and more advanced stuff can also be found in the scripts section.
the currenly selected item, select an item by position, move selection up/down, add an item to the list, alpha sort the list
First one is simple. The selected line is stored in an attached property value (single and/or double click). The DVD script shows both.
Second one... not sure what you mean, but once you click a line, you get the item by position. You can even set the position yourself by using the *S- in the alphalist. Examples of this can be found in my large scripts like Meedio Music.
Third one; I think I know what you mean, but not done directly that. It is just a matter of re-arranging your list and refresh it in the new order while keeping the selected line alive with the *S- thingy.
Fourth one is simple. Just do so and refresh the list.
Fith one.. Look at the DVD script again. It sorts by number or by name using plain text labels. Obviously sorting data is much more easy when it is stored in a database like SQL. You can do your query in the dbase, sort it the way you want and display it in an alphalist the way you got it. Examples of this can also be found in the music and movie scripts.
Posted: Wed Jul 11, 2007 8:06 am
by jkish
Thanks Richard, I'll have a look at the DVD scripts.
Let me give a little specific detail on what I'm trying to do.
I'm building an interface that will look a lot like the Apple TV interface. It is controlled completely by the remote - no touch. The input comes completely from the IR remote using arrow and action buttons.
In HouseBot, I was going to us SW remote alphalists to display the menu choices. These menus may contain fixed entries or the results of queries such as music by artist or music by album etc. This means I will be dealing with a lot of these lists and need to be able to select and move through them (scroll) by using a script which will be triggered by UIRT input.
My thought was to have a script device that I could point at different lists and give it commands like 'move selection up', 'move selection down', 'sort' etc. I could have multiple scripts that contained subroutines to do all of this, but thought a device might be a little easier to reuse.
-John