Kodi Community Forum

Full Version: Main Menu Button Order
You're currently viewing a stripped down version of our content. View the full version with proper formatting.
Pages: 1 2
(2012-12-08, 21:22)phil65 Wrote: [ -> ]if you want to get nice code for exchanging main menu items just ask.

thanx!
not saying i will add it to T!
but i'm sure interested in seeing how it can be done :-)
First of all you need a container somewhere in settings area (here with id 9000).
for <content> you then create some inludes containing the main menu items.
Code:
<include name="MoviesMainMenu">
<item id="10">
<label fallback="31502">$INFO[Skin.String(MovieHomeItem.Label)]</label>
<onclick>SetProperty($INFO[Window(home).Property(MenuName)],MovieHomeItem,home)</onclick>
<onclick>SetFocus(9006)</onclick>
<icon fallback="special://skin/backgrounds/movies/">$INFO[Skin.String(MovieHomeItem.MultiFanart)]</icon>
<property name="Widget">$INFO[Skin.String(MovieHomeItem.Widget)]</property>
<property name="Widget2">$INFO[Skin.String(MovieHomeItem.Widget2)]</property>
<property name="DisableIcon">$INFO[Skin.String(MovieHomeItem.Disable)]</property>
<property name="BigIcon" fallback="special://skin/extras/BigIcons/Film.png">$INFO[Skin.String(MovieHomeItem.Icon)]</property>
<property name="InfoLine">$INFO[Skin.String(MovieHomeItem.InfoLine)]</property>
<property name="SubMenu">$INFO[Skin.String(MovieHomeItem.SubMenu)]</property>
<property name="Type" fallback="custom">$INFO[Skin.String(MovieHomeItem.Type)]</property>
<property name="Path" fallback="ActivateWindow(Videos,MovieTitles,return)">$INFO[Skin.String(MovieHomeItem.Path)]</property>
</item>
</include>
<include name="MusicMainMenu">
<item id="3">
<label fallback="31501">$INFO[Skin.String(MusicHomeItem.Label)]</label>
<onclick>SetProperty($INFO[Window(home).Property(MenuName)],MusicHomeItem,home)</onclick>
<onclick>SetFocus(9006)</onclick>
<icon fallback="special://skin/backgrounds/music/">$INFO[Skin.String(MusicHomeItem.MultiFanart)]</icon>
<property name="Widget">$INFO[Skin.String(MusicHomeItem.Widget)]</property>
<property name="Widget2">$INFO[Skin.String(MusicHomeItem.Widget2)]</property>
<property name="DisableIcon">$INFO[Skin.String(MusicHomeItem.Disable)]</property>
<property name="BigIcon" fallback="special://skin/extras/BigIcons/Headphone.png">$INFO[Skin.String(MusicHomeItem.Icon)]</property>
<property name="InfoLine">$INFO[Skin.String(MusicHomeItem.InfoLine)]</property>
<property name="SubMenu">$INFO[Skin.String(MusicHomeItem.SubMenu)]</property>
<property name="Type" fallback="custom">$INFO[Skin.String(MusicHomeItem.Type)]</property>
<property name="Path" fallback="ActivateWindow(music)">$INFO[Skin.String(MusicHomeItem.Path)]</property>
</item>
</include>

In the same window you have to set a property in <onload>:

Code:
<onload>SetProperty(MenuName,MenuItem,home)</onload>

the button which gets focused looks like this:

Code:
<control type="button" id="9006">
<include>HiddenObject</include>
<onfocus>Skin.Setstring(ItemToEdit.Label,$INFO[Container(9000).ListItem.Label])</onfocus>
<onfocus>Skin.Setstring(ItemToEdit.MultiFanart,$INFO[Container(9000).ListItem.Icon])</onfocus>
<onfocus>Skin.Setstring(ItemToEdit.Icon,$INFO[Container(9000).ListItem.Property(BigIcon)])</onfocus>
<onfocus>Skin.Setstring(ItemToEdit.Widget,$INFO[Container(9000).ListItem.Property(Widget)])</onfocus>
<onfocus>Skin.Setstring(ItemToEdit.Widget2,$INFO[Container(9000).ListItem.Property(Widget2)])</onfocus>
<onfocus>Skin.Setstring(ItemToEdit.InfoLine,$INFO[Container(9000).ListItem.Property(InfoLine)])</onfocus>
<onfocus>Skin.Setstring(ItemToEdit.SubMenu,$INFO[Container(9000).ListItem.Property(SubMenu)])</onfocus>
<onfocus>Skin.Setstring(ItemToEdit.Disable,$INFO[Container(9000).ListItem.Property(DisableIcon)])</onfocus>
<onfocus>Skin.Setstring(ItemToEdit.Type,$INFO[Container(9000).ListItem.Property(Type)])</onfocus>
<onfocus>Skin.Setstring(ItemToEdit.Path,$INFO[Container(9000).ListItem.Property(Path)])</onfocus>
<onfocus>ActivateWindow(1122)</onfocus>
<onfocus>SetFocus(9000)</onfocus>
</control>

This Opens a dialog.
Put this into the header:

<onload>ClearProperty(Exchange,home)</onload>
<onload>SetProperty(MenuName,Exchange,home)</onload>

You also put a list inside this dialog with exactly the same <content> as the list before.
only thing which differs in this dialog is the button 9006 which you again put next to the list:

Code:
<control type="button" id="9006">
<include>HiddenObject</include>
<onfocus>SetProperty(TempItemToEdit.Label,$INFO[Container(4).ListItem.Label],home)</onfocus>
<onfocus>SetProperty(TempItemToEdit.MultiFanart,$INFO[Container(4).ListItem.Icon],home)</onfocus>
<onfocus>SetProperty(TempItemToEdit.Icon,$INFO[Container(4).ListItem.Property(BigIcon)],home)</onfocus>
<onfocus>SetProperty(TempItemToEdit.Widget,$INFO[Container(4).ListItem.Property(Widget)],home)</onfocus>
<onfocus>SetProperty(TempItemToEdit.Widget2,$INFO[Container(4).ListItem.Property(Widget2)],home)</onfocus>
<onfocus>SetProperty(TempItemToEdit.InfoLine,$INFO[Container(4).ListItem.Property(InfoLine)],home)</onfocus>
<onfocus>SetProperty(TempItemToEdit.SubMenu,$INFO[Container(4).ListItem.Property(SubMenu)],home)</onfocus>
<onfocus>SetProperty(TempItemToEdit.Disable,$INFO[Container(4).ListItem.Property(DisableIcon)],home)</onfocus>
<onfocus>Dialog.Close(1122)</onfocus>
</control>

this triggers the onunloads:

Code:
<onunload condition="!IsEmpty(Window(home).Property(Exchange))">Skin.SetString($INFO[Window(home).Property(Exchange)].Type,$INFO[Skin.String(ItemToEdit.Type)])</onunload>
<onunload condition="!IsEmpty(Window(home).Property(Exchange))">Skin.SetString($INFO[Window(home).Property(Exchange)].MultiFanart,$INFO[Skin.String(ItemToEdit.MultiFanart)])</onunload>
<onunload condition="!IsEmpty(Window(home).Property(Exchange))">Skin.SetString($INFO[Window(home).Property(Exchange)].Label,$INFO[Skin.String(ItemToEdit.Label)])</onunload>
<onunload condition="!IsEmpty(Window(home).Property(Exchange))">Skin.SetString($INFO[Window(home).Property(Exchange)].Path,$INFO[Skin.String(ItemToEdit.Path)])</onunload>
<onunload condition="!IsEmpty(Window(home).Property(Exchange))">Skin.SetString($INFO[Window(home).Property(Exchange)].Widget,$INFO[Skin.String(ItemToEdit.Widget)])</onunload>
<onunload condition="!IsEmpty(Window(home).Property(Exchange))">Skin.SetString($INFO[Window(home).Property(Exchange)].Widget2,$INFO[Skin.String(ItemToEdit.Widget2)])</onunload>
<onunload condition="!IsEmpty(Window(home).Property(Exchange))">Skin.SetString($INFO[Window(home).Property(Exchange)].Disable,$INFO[Skin.String(ItemToEdit.Disable)])</onunload>
<onunload condition="!IsEmpty(Window(home).Property(Exchange))">Skin.SetString($INFO[Window(home).Property(Exchange)].Icon,$INFO[Skin.String(ItemToEdit.Icon)])</onunload>
<onunload condition="!IsEmpty(Window(home).Property(Exchange))">Skin.SetString($INFO[Window(home).Property(Exchange)].InfoLine,$INFO[Skin.String(ItemToEdit.InfoLine)])</onunload>
<onunload condition="!IsEmpty(Window(home).Property(Exchange))">Skin.SetString($INFO[Window(home).Property(Exchange)].SubMenu,$INFO[Skin.String(ItemToEdit.SubMenu)])</onunload>
<onunload condition="!IsEmpty(Window(home).Property(Exchange))">Skin.SetString(ItemToEdit.Type,$INFO[Window(home).Property(TempItemToEdit.Type)])</onunload>
<onunload condition="!IsEmpty(Window(home).Property(Exchange))">Skin.SetString(ItemToEdit.MultiFanart,$INFO[Window(home).Property(TempItemToEdit.MultiFanart)])</onunload>
<onunload condition="!IsEmpty(Window(home).Property(Exchange))">Skin.SetString(ItemToEdit.Label,$INFO[Window(home).Property(TempItemToEdit.Label)])</onunload>
<onunload condition="!IsEmpty(Window(home).Property(Exchange))">Skin.SetString(ItemToEdit.Path,$INFO[Window(home).Property(TempItemToEdit.Path)])</onunload>
<onunload condition="!IsEmpty(Window(home).Property(Exchange))">Skin.SetString(ItemToEdit.Widget,$INFO[Window(home).Property(TempItemToEdit.Widget)])</onunload>
<onunload condition="!IsEmpty(Window(home).Property(Exchange))">Skin.SetString(ItemToEdit.Widget2,$INFO[Window(home).Property(TempItemToEdit.Widget2)])</onunload>
<onunload condition="!IsEmpty(Window(home).Property(Exchange))">Skin.SetString(ItemToEdit.Disable,$INFO[Window(home).Property(TempItemToEdit.Disable)])</onunload>
<onunload condition="!IsEmpty(Window(home).Property(Exchange))">Skin.SetString(ItemToEdit.Icon,$INFO[Window(home).Property(TempItemToEdit.Icon)])</onunload>
<onunload condition="!IsEmpty(Window(home).Property(Exchange))">Skin.SetString(ItemToEdit.InfoLine,$INFO[Window(home).Property(TempItemToEdit.InfoLine)])</onunload>
<onunload condition="!IsEmpty(Window(home).Property(Exchange))">Skin.SetString(ItemToEdit.SubMenu,$INFO[Window(home).Property(TempItemToEdit.SubMenu)])</onunload>
<onunload>Skin.SetString($INFO[Window(home).Property(MenuItem)].Type,$INFO[Skin.String(ItemToEdit.Type)])</onunload>
<onunload>Skin.SetString($INFO[Window(home).Property(MenuItem)].MultiFanart,$INFO[Skin.String(ItemToEdit.MultiFanart)])</onunload>
<onunload>Skin.SetString($INFO[Window(home).Property(MenuItem)].Label,$INFO[Skin.String(ItemToEdit.Label)])</onunload>
<onunload>Skin.SetString($INFO[Window(home).Property(MenuItem)].Path,$INFO[Skin.String(ItemToEdit.Path)])</onunload>
<onunload>Skin.SetString($INFO[Window(home).Property(MenuItem)].Widget,$INFO[Skin.String(ItemToEdit.Widget)])</onunload>
<onunload>Skin.SetString($INFO[Window(home).Property(MenuItem)].Widget2,$INFO[Skin.String(ItemToEdit.Widget2)])</onunload>
<onunload>Skin.SetString($INFO[Window(home).Property(MenuItem)].Disable,$INFO[Skin.String(ItemToEdit.Disable)])</onunload>
<onunload>Skin.SetString($INFO[Window(home).Property(MenuItem)].Icon,$INFO[Skin.String(ItemToEdit.Icon)])</onunload>
<onunload>Skin.SetString($INFO[Window(home).Property(MenuItem)].InfoLine,$INFO[Skin.String(ItemToEdit.InfoLine)])</onunload>
<onunload>Skin.SetString($INFO[Window(home).Property(MenuItem)].SubMenu,$INFO[Skin.String(ItemToEdit.SubMenu)])</onunload>
<onunload>Skin.Reset(ItemToEdit.Label)</onunload>
<onunload>Skin.Reset(ItemToEdit.MultiFanart)</onunload>
<onunload>Skin.Reset(ItemToEdit.Path)</onunload>
<onunload>Skin.Reset(ItemToEdit.Type)</onunload>
<onunload>Skin.Reset(ItemToEdit.Widget)</onunload>
<onunload>Skin.Reset(ItemToEdit.Widget2)</onunload>
<onunload>Skin.Reset(ItemToEdit.Disable)</onunload>
<onunload>Skin.Reset(ItemToEdit.Icon)</onunload>
<onunload>Skin.Reset(ItemToEdit.InfoLine)</onunload>
<onunload>Skin.Reset(ItemToEdit.SubMenu)</onunload>
<onunload>ClearProperty(MenuItem,home)</onunload>

that´s it. nice thing is that you can use that include for home, too then, with the following button 9006:
Code:
<control type="button" id="9006">
<include>HiddenObject</include>
<onfocus condition="stringcompare(Container(9000).ListItem.Property(Type),0) | stringcompare(Container(9000).ListItem.Property(Type),1) | stringcompare(Container(9000).ListItem.Property(Type),2) | stringcompare(Container(9000).ListItem.Property(Type),3)">RunAddon($INFO[Container(9000).ListItem.Property(Path)])</onfocus>
<onfocus condition="stringcompare(Container(9000).ListItem.Property(Type),4)">ActivateWindow(Videos,$INFO[Container(9000).ListItem.Property(Path)],return)</onfocus>
<onfocus condition="stringcompare(Container(9000).ListItem.Property(Type),5)">ActivateWindow(MusicLibrary,$INFO[Container(9000).ListItem.Property(Path)],return)</onfocus>
<onfocus condition="Stringcompare(Container(9000).ListItem.Property(Type),custom)">$INFO[Container(9000).ListItem.Property(Path)]</onfocus>
</control>

what you have to take into account is that you have to use Stringcompare(Container(9000).ListItem.Property(xxx),xxx) for widgets, submenus etc. instead of Container(9000).HasFocus(xx)
i hope i got everything right.
thanx for taking the time to explain all that stuff phil65, much appreciated.

Triggers you changing your mind? ;-)
+1 For this Smile

Please implement it Ronie
Newer skins already implement it i think,
it'd be awesome if Transparency has this feature
not likely. sorry.
I spotted this thread, and noting it is from some 4+ years back, am hoping against hope that things might be a bit different now. I can't speak to voyagerxp's reasons for that original request, but the way I find myself most using KODI, I would find it immensely useful if I could have the "VIDEOS" menu item at the top of the main menu. (Particularly because I'm parceling movies for consumption by myself from those for my better half...and particularly those for my rather particular and easily perturbed 95 year-old father-in-law (long story).

Can you help me? Is there a way now to modify the menu order? ...or perhaps some other way to put front and center the different folders of films I've placed on my home server for these disparate (and somewhat picky) souls?

Thanks in advance for taking time to tend to my query.
I'd like to have the option of reordering menu items too.

Since this might take a lot of development time, in the meantime... is it easy to change the starting menu item? Meaning, when I launch Kodi being able to decide on what menu items it opens to on the home screen. Currently it defaults to Videos but the way I used customized entries (regular feature of Transparency, I did not modify xml) it doesn't make a lot of sense.
Pages: 1 2