PDA

View Full Version : ListManager works - but why??



theguywiththefunnyhair
August 27th, 2007, 03:03 AM
Hi Rob,

I put together a dynamic menu system controlled by your ListManager code. Its working exactly the way i want, but i'm not sure why, it was easier than i expected.

I have the manager pointed at a table of tables and somehow the code grabs the right variable from the sub-table and sends it through.

I pulled the relevant bits of code out of my .ccf and put them into this simple demo, i'm hoping you can find time to take a look and tell me if this works because you have intended it to work this way, or if it was just luck.

Thanks

Dan

Rob H
August 27th, 2007, 03:24 AM
It works because you used a field called 'Name' in the subtables ('name' would have worked too), so yes, it was intended to work that way :)

theguywiththefunnyhair
August 27th, 2007, 03:53 AM
Ok thats good to know.

Next question, if i change the values of the table the ListManager is pointing at then refresh the LM should the new values be sent through to NR?

I edited the .lua in the first post to show what im trying to do, pressing a button on the left should change the menu on the left.

Rob H
August 27th, 2007, 04:23 AM
If the number of entries is the same and you want the list to remain on the same page then just call lm:RefreshList(), otherwise call lm:UpdateEntries(tbl)

theguywiththefunnyhair
August 27th, 2007, 05:11 AM
Bingo!!

lm:UpdateEntries(tbl) was the winning call.

thank you once again,

Dan

:)

dsmes
August 29th, 2007, 08:15 PM
Hey Funnyhair- Where did your attached Lua go? I'd love to see more ListManager examples. It seems quite powerful and a wonderful way to organize menus, etc.

theguywiththefunnyhair
August 30th, 2007, 02:18 AM
hi dsmes,

Its not a very exciting example of listmanager code, pretty much bog standard. All i did different was give the loop 2 values '.name' and .action', the menuitem displays '.name' and then when pressed executes '.action'.

I can easily change the name and behavior of the button by changing the Lua table the list looks to, hence the need for UpdateEntries().

The idea is to have a menu with options that can be changed 'on the fly' from inside NR, and to simplify the drawing of the Menu's elements in the .ccf

If you want to checkout the way it works i'll re-post the .ccf/.lua here. The two work hand in hand and don't make much sense without each other. The idea is the menu on the left is a navigation menu and should change the page your on, the menu on the right is the menu for the page you are currently on.

In this example there is no menu setup for 'HOME' so it is the same as 'Playlist'.

If you want to use it and need a hand let me know.

Cheers

Dan

dsmes
August 30th, 2007, 07:59 PM
Thanks Dan, I'll have a look.
BTW, was on your beautiful continent starting the first day of winter for two weeks (two months ago). I was at a wind farm near Lake Bonnie, 100km or so west of Melbourne. For being such a far south latitude, I was surprised it wasn't colder. Must be all that aqua-colored ocean water- never seen water so bright blue-green! The other thing that threw me was the time zone: 30 minutes displaced from the GMT hour zones... like being in a half time zone. I'm sure that would make for some interesting NR Lua programming!

Thanks again.