PDA

View Full Version : Forget selected item...


xmcnuggetx
May 11th, 2009, 02:58 PM
Going to try my best to explain this :) In my program I have 2 .xmls (main.xml and episode.xml). Think of it like the hulu-feeds source where episode.xml is reused for different screens. Here is my issue. I have a window that contains a group-list of items..

Main (main.xml) Page 1 (episode.xml?link=1) Page 2(episode.xml?link=2) ect.


This menu is repeated on both the main and episode xmls. The user is on the main page and selects [Page 1] (Boxee now remembers this selection). So I am on Page 1 now and go back to the [Main] page though that menu the main is loaded, but my selection is now moved back to [Page 1] because that is the last link the user was on when they were on the main.xml...

hopefully this all makes sense :) I tried setting the item with <onload>SetFocus(id)</onload>, but this doesn't feel right either as the remembered item is selected and then the focus is changed once the entire window finishes loading.

jontas
May 11th, 2009, 04:39 PM
I don't quite follow your problem, but it looks like you might be able to solve it with a python variable. I don't know the exact scope of python's environment when your code is running, but from the experiments I've done they seem to be available to your code at any point in the application.

If I understand your problem correctly, you need to remember the select item across some different screens. Why not just create a python variable like:

selected_index = mc.GetWindow(xxx).GetList(xxx).GetFocusedItem()

Then, whenever that item is not correctly focused you can do
mc.Getwindow(xxx).GetList(xxx).SetFocusedItem(sele cted_index)

Jon