PDA

View Full Version : Advanced Listmanager stuff and a possible bug



NeoMorph
October 17th, 2007, 10:12 AM
OK... now I can hear you groaning Rob n Ron n Tim... heh

Now I have the basics working I was wondering how I can search for an entry and then automatically scroll down to it.

From what I can see there is no command that lets you do this. Now I'm sure I saw that it was possible using MediaBridge so hopefully there are some undocumented commands that let you do it.

For instance, using my/your tv channels example say I want to jump to More4. I know I can scan the array to find More4 but I can't figure out how to move the position. There is a "prefix_Pos" variable that you should be able to link to a slider so I thought that was it... but lo and behold... it doesn't work.

I added a slider and linked it to "channel_Pos" and moving the slider doesn't move the list... but if you use the previous and next buttons it moves the slider... curious eh...

Could this be a bug?

Rob H
October 17th, 2007, 03:19 PM
Try using the SelectNamed() method.

If you want a partial match then you'll have to implement that yourself and use the SelectIndex() method to move to the selection.

Actually, it looks as though SelectNamed might be rather limited in that it directly access self.entries. That needs to be fixed - the loop should look more like (pseudocode - off the top of my head)


for ind = 1, self:ItemCount() do
local item = self:GetItem()
-- some code that gets the text of item
if item matches aValue then
self:SelectIndex(ind)
break
end
end

NeoMorph
October 17th, 2007, 03:32 PM
SelectNamed()... not it the manual ;)

I tried a manual fudge to see if I could get the list to move with..



ChannelManager:SelectIndex(10)


attached to a button but it does nothing at all. I even tried an update by using "ChannelManager :UpdateEntries(channels)" after it but no luck.

Rob H
October 17th, 2007, 03:38 PM
Hmm.. that should have worked, it may be a bug.

Alternatively, you could set lm.topMost to the index of the first element in the list then call lm:RefreshList() to update the display - nb if you aren't changing the entries then don't call lm:UpdateEntries() since that sets topMost to 1 and then calls RefreshList().

NeoMorph
October 17th, 2007, 05:06 PM
I gave up trying that for now and went ahead and tried sending arrays over from Girder.

I didn't change much... just used the arrays coming over from Girder... and the damn thing broke!

What does this mean because other than it saying it's being a Bas&%$D I haven't a clue...


LMAuto
LMAuto called from {channel_2}
Parent not found

What does "Parent not found" MEAN? It's not the most helpful of error messages... doesn't tell you what line it's having problems on... doesn't tell you why it's having problems... doesn't tell you anything at all in fact.

Sometimes I seriously hate this program. It's like it's saying "HAHA... you thought you had succeded but YOU DIDN'T".

I also had a bug where nothing was thrown up earlier too... I had copied over a link to another ListManager but forgot to delete it. The consequence was it reached that line and stopped... anything after it was ignored yet there was no error message whatsoever. Not very good error trapping there.

Well I'm stuck again and it's after 2am and I'm getting nowhere. Bedtime I think!

Edit... couldn sleep... failed time and time again so deleted it and started again from scratch... AND IT WORKS.

Bizarre...

Looks like I've got it sorted now... in fact it looks similar if not the same as what I put before that failed miserably. Oh well... saved a backup copy just to be safe now it works.

I still think LM hates me though... :D

NeoMorph
October 18th, 2007, 08:03 AM
Hmm.. that should have worked, it may be a bug.

Alternatively, you could set lm.topMost to the index of the first element in the list then call lm:RefreshList() to update the display - nb if you aren't changing the entries then don't call lm:UpdateEntries() since that sets topMost to 1 and then calls RefreshList().

Setting topMost actually moves the list fine which is strange... hmmm