Is it possible to increment or decrement a variable with an <onclick> event ?
#1
I have a lot of art that I've added to my music library and some of this consists of booklets about albums/artists etc.

I've added it so that it's accessible to a skin via ListItem.Art(bookletN) where N is a number between 1 and whatever.  I've also managed to get a simple window together to show this in.

Image

Where I'm stuck now though is how to get it to show the 'next page' which would be ListItem.Art(booklet2) etc etc. I would like to be able to navigate backwards and forwards through the booklet by clicking on the arrows but I have absolutely no idea if it's even possible to do that, and if so how to go about it.

Any help would be much appreciated. As you can probably tell from the screenshot, my skinning skills are not really up to much!
Learning Linux the hard way !!
Reply
#2
(2020-01-05, 16:41)black_eagle Wrote: I have a lot of art that I've added to my music library and some of this consists of booklets about albums/artists etc.

I've added it so that it's accessible to a skin via ListItem.Art(bookletN) where N is a number between 1 and whatever.  I've also managed to get a simple window together to show this in.

Image

Where I'm stuck now though is how to get it to show the 'next page' which would be ListItem.Art(booklet2) etc etc. I would like to be able to navigate backwards and forwards through the booklet by clicking on the arrows but I have absolutely no idea if it's even possible to do that, and if so how to go about it.

Any help would be much appreciated. As you can probably tell from the screenshot, my skinning skills are not really up to much!


how are the booklet images stored.
- inside album ( like album/firstimage.jpg)
- or extra ( like album/booklet/firstimage.jpg)

1. method
an easy way would be adding art into container, best if using booklet folder.

<content>$INFO[container.listitem.path,,booklet]</content>

so you can scroll trough or using control.move via click buttons

2. method still using container but with static content
e.g.

xml:
<content>
<item id="2">
<label>page 2</label>
<label2 /><visible>!String.IsEmpty(ListItem.Art(booklet2)</visible>
<icon>$INFO[ListItem.Art(booklet2)]</icon>
<thumb>$INFO[ListItem.Art(booklet2)]</thumb>
<!-- may also add proprty fanart if needed) -->
</item>


item 3
item 4 ...
</content>
Skins |  Titan M O D   •   S W A N (WIP)
Reply
#3
in addition if you use dynamic method

you do a fullscreen slideshow, artwork container haa id=8607

xml:
<control type="panel" id="8607">
<onclick>SetFocus(9002)</onclick>
..
..
<content>$INFO[container.listitem.path,,booklet]</content>
</control>

<control type="group">
<visible>Control.HasFocus(9002)</visible>
<animation effect="fade" start="0" end="100" time="350" tween="cubic" easing="inout">Visible</animation>
<animation effect="fade" start="0" end="100" time="350" tween="cubic" easing="inout">WindowOpen</animation>
<animation effect="fade" end="0" start="100" time="150">Hidden</animation>
<animation effect="fade" end="0" start="100" time="150">WindowClose</animation>
<control type="button" id="9002">
<visible allowhiddenfocus="true">false</visible>
<width>1</width>
<height>1</height>
<texturefocus />
<texturenofocus />
<onleft>Control.Move(8607,-1)</onleft>
<onright>Control.Move(8607,1)</onright>
<onup>Control.Move(8607,1)</onup>
<ondown>Control.Move(8607,-1)</ondown>
<onback>8607</onback>
<oninfo>8607</oninfo>
<onclick>SetFocus(8607)</onclick>
</control>
<control type="image">
<texture colordiffuse="FF000000">colors/color_white.png</texture>
</control>
<control type="group">
<animation effect="slide" start="0" end="-1920" condition="!Container(8607).OnNext" reversible="false" time="300" tween="quadratic">Conditional</animation>
<animation effect="slide" start="0" end="1920" condition="!Container(8607).OnPrevious" reversible="false" time="300" tween="quadratic">Conditional</animation>
<control type="image">
<centerleft>50%</centerleft>
<centertop>50%</centertop>
<width>1920</width>
<height>1080</height>
<left>-1920</left>
<aspectratio>keep</aspectratio>
<texture background="true">$INFO[Container(8607).ListItem(-1).FileNameAndPath]</texture>
</control>
<control type="image">
<centerleft>50%</centerleft>
<centertop>50%</centertop>
<width>1920</width>
<height>1080</height>
<aspectratio>keep</aspectratio>
<texture background="true">$INFO[Container(8607).ListItem.FileNameAndPath]</texture>
</control>
<control type="image">
<centerleft>50%</centerleft>
<centertop>50%</centertop>
<width>1920</width>
<height>1080</height>
<left>1920</left>
<aspectratio>keep</aspectratio>
<texture background="true">$INFO[Container(8607).ListItem(1).FileNameAndPath]</texture>
</control>
</control>
</control>
Skins |  Titan M O D   •   S W A N (WIP)
Reply
#4
je, not shure if possible via Variable ($VAR[]). U could try to set different Skin-Settings via Button, but not shure if that would work.

As mardukL mentionet, guess best bet is to use a List-Control, with eigther Static or (if in a Folder) Dynamic Content, + two buttons for "next" and "previous" with "Control.Move(UrListID,1)", "Control.Move(UrListID,-1)" and Visibles "Container(ID).HasNext" / "Container(ID).HasPrevious"

(At least unless u wanna go cracy, and let the List Content be filled by Core to a List-ID as i.e. in the VideoInfoDialog (Actors -> ListID="50") or the Screenshots in DialogAddonInfo) ;P  -> Kidding.
Reply
#5
In answer to your original question: yes, but it is a pain that involves defining every increment...

xml:

<onclick condition="String.IsEmpty(Window.Property(currentbooklet))">SetProperty(currentbooklet,$INFO[ListItem.Art(booklet1)])</onclick>
<onclick condition="String.IsEqual(Window.Property(currentbooklet),$INFO[ListItem.Art(booklet1)])">SetProperty(currentbooklet,$INFO[ListItem.Art(booklet2)])</onclick>
<onclick condition="String.IsEqual(Window.Property(currentbooklet),$INFO[ListItem.Art(booklet2)])">SetProperty(currentbooklet,$INFO[ListItem.Art(booklet3)])</onclick>
<onclick condition="String.IsEqual(Window.Property(currentbooklet),$INFO[ListItem.Art(booklet3)])">SetProperty(currentbooklet,$INFO[ListItem.Art(booklet4)])</onclick>
[...] [etc.]

In your image control:
xml:
<texture background="true">$INFO[Window.Property(currentbooklet)]</texture>

Add an onload condition to your custom window (before <controls> tags) to make sure it is set to the first item:
xml:
<onload>SetProperty(currentbooklet,$INFO[ListItem.Art(booklet1)])</onload>
Arctic Fuse - Alpha now available. Support me on Ko-fi.
Reply
#6
@jurialmunkey thanks !!  I had come up with something similar myself actually, but I had used Skin.SetString which meant a bunch of visibility conditions as well.  With your solution I will just need the one image control.

~~~EDIT~~~

Couldn't get it to work at first until I realized that I needed to drop the $INFO from the String.IsEqual comparison.  I also added a check to ensure that the next page exists before updating the property, so it's impossible to go past the end.  No need for that check going backwards.

Code I finally ended up with for going up is

xml:

<onclick condition="String.IsEqual(Window.Property(currentbooklet),ListItem.Art(booklet1)) + !String.IsEmpty(ListItem.Art(booklet2))">SetProperty(currentbooklet,$INFO[ListItem.Art(booklet2)])</onclick>
<onclick condition="String.IsEqual(Window.Property(currentbooklet),ListItem.Art(booklet2)) + !String.IsEmpty(ListItem.Art(booklet3))">SetProperty(currentbooklet,$INFO[ListItem.Art(booklet3)])</onclick>
<onclick condition="String.IsEqual(Window.Property(currentbooklet),ListItem.Art(booklet3)) + !String.IsEmpty(ListItem.Art(booklet4))">SetProperty(currentbooklet,$INFO[ListItem.Art(booklet4)])</onclick>
[etc...]

and
xml:

<onclick condition="String.IsEqual(Window.Property(currentbooklet),ListItem.Art(booklet4))">SetProperty(currentbooklet,$INFO[ListItem.Art(booklet3)])</onclick>
<onclick condition="String.IsEqual(Window.Property(currentbooklet),ListItem.Art(booklet3))">SetProperty(currentbooklet,$INFO[ListItem.Art(booklet2)])</onclick>
<onclick condition="String.IsEqual(Window.Property(currentbooklet),ListItem.Art(booklet2))">SetProperty(currentbooklet,$INFO[ListItem.Art(booklet1)])</onclick>

Really happy now with how that's working.  I also added a button to the MusicInfoDialog to trigger the booklet window if there is a booklet to display.
Learning Linux the hard way !!
Reply

Logout Mark Read Team Forum Stats Members Help
Is it possible to increment or decrement a variable with an <onclick> event ?0