Thread Rating:
  • 0 Vote(s) - 0 Average
  • 1
  • 2
  • 3
  • 4
  • 5
Current Page number for CAB?
#1
I'm working on my interfaces and on one of my popups has a CAB and CAT Browser. I want to display text like "Page 1 of 4". How do I do this? How do I determine how many pages the CAB currently has to show and what the current page is so I can tell my users what page they are on. I am using the previous and next page buttons to scroll the pages.

[OnClick]
CAB::ScrollList(Previous Page)
David
Z-Wave World Magazine|Baltimore Hackerspace
"Why think outside the box when you could let the box think for you." - My take on Home Automation
Reply
#2
check out my skins; i've got it all in there. I'd open them up myself now and cut/paste, but i'm on my work laptop which doesn't have CQC on it.
------------------------------------
Some of my devices: Sonos, Aeotec zWave, Nest, Rain8Net, Various H/T
What's next: CQC-Voice, Brultech GEM
My vlogs: https://www.youtube.com/c/IVBsHomeAutomation
Reply
#3
I'd prefer not to install a bunch of skins that I won't use so whenever you get a chance if you don't mind pasting the info I would greatly appreciate it. Otherwise I will just pick your brain on saturday. I've installed a bunch of skins in the past and ended up deleting them all because they just junked up the dialog box. One day Dean will make it into a nice tree list for us.
David
Z-Wave World Magazine|Baltimore Hackerspace
"Why think outside the box when you could let the box think for you." - My take on Home Automation
Reply
#4
Ok. FYI - the wife is claiming eminent domain over both the laptop and HTPC for the rest of the night. The only template needed is the overlay_cd, after which you can promptly delete it, but perhaps someone else who's got them can pull it up and chime in.
------------------------------------
Some of my devices: Sonos, Aeotec zWave, Nest, Rain8Net, Various H/T
What's next: CQC-Voice, Brultech GEM
My vlogs: https://www.youtube.com/c/IVBsHomeAutomation
Reply
#5
If you use the OnScroll event, that happens any time the page changes effectively, there are RTVs for the total number and the current top/right index that you can output to static text widgets to display that info.

You may have to also do it upon initial load of a new category, via the OnSet which will happen when you change categorys (or between category/title set mode.)
Dean Roddey
Explorans limites defectum
Reply
#6
Squintz Wrote:I'd prefer not to install a bunch of skins that I won't use so whenever you get a chance if you don't mind pasting the info I would greatly appreciate it. Otherwise I will just pick your brain on saturday. I've installed a bunch of skins in the past and ended up deleting them all because they just junked up the dialog box. One day Dean will make it into a nice tree list for us.

I do the following to give me a "X of Y" display which corresponds to the 'count' of the first video (or whatever) on the page of the 'total' in the genre selected. In other words, 1 of 300 means there are 300 total and the upper left item is the 1st. Scrolling would change the display 13 of 300 since there are 12 per page.

On the CAB widget in the "On Scroll" section I use the following -

To set a "Total Variable" (Y above) -
Code:
LocalVars::SetVariable(LVar:Total, %(MediaRTV:TitleCount))
To set a "Page Variable" (X above) -
Code:
LocalVars::SetVariable(LVar:LastOne, %(StdRTV:FirstIndex))
To increment the X variable -
Code:
LocalVars::Add(LVar:LastOne, 11)
To create the text display -
Code:
FirstNum::SetText(%(StdRTV:FirstIndex) of %(LVar:Total)
Then somewhere else on the template I have a Static Text Widget which is named "FirstNum". There are no other actions of formats of that widget.

This will change depending on the genre set.

It's a bit different than the "X of Y" pages you want but it should help point you down the right path.
Keith
Reply
#7
Squintz

This is what I do. It populates 2 text widgets, one that displays the Genre and movie count, and another that shows "Page X of Y".

It also automatically hides the page up/down buttons for the CAB based on whether there really are pages to scroll up/down.

One quirk - if you happen to have a movie count that is evenly divisible by the number of pages that the CAB displays, then the "Page X of Y" text overstates y by one. Basically when you divide the movie count by the number that will display on a screen you'll get a remainder unless it's evenly divisible. I couldn't figure out how to get CQC to round up that remainder, so I just always added one and live with being off when there are complete pages. Since I'm displaying 21 images on the page, I can live with having a less than 5% chance of the calculation being wrong.

Hope this helps you

Joe

BTW - giving credit where it's due - I orginally stumbled across this in someone else's setup (Panos maybe??), all I really did is tweak it a little.


Code:
// The CAB displays 21 movies, so find the index of the last movie
   LocalVars::SetVariable(LVar:LastVideoIndex, %(StdRTV:FirstIndex))
   LocalVars::Add(LVar:LastVideoIndex, 20)
   // If the index of the first movie is 1, don't display the page up button
   If System::Equals(%(StdRTV:FirstIndex), 1)
      browse-video-up::Hide/Show(False)
   Else
      browse-video-up::Hide/Show(True)
   End
   // If the total movie count is < or = what would be the last index, don't display the page down button
   If System::LsThanOrEq(%(MediaRTV:TitleCount), %(LVar:LastVideoIndex))
      browse-video-down::Hide/Show(False)
   Else
      browse-video-down::Hide/Show(True)
   End
   // Write a text field that shows the current genre and movie count, ie  - Movies > Action > 19 Video(s)
   WidgetMovieCount::SetText(Movies  >  %(MediaRTV:CategoryName)  >  %(MediaRTV:TitleCount) Video(s))
   // Determine the current page
   LocalVars::SetVariable(LVar:CurrentPageCount, %(StdRTV:FirstIndex))
   LocalVars::Divide(LVar:CurrentPageCount, 21)
   LocalVars::Add(LVar:CurrentPageCount, 1)
   // Determine the total pages
   LocalVars::SetVariable(LVar:TotalPageCount, %(MediaRTV:TitleCount))
   LocalVars::Divide(LVar:TotalPageCount, 21)
   LocalVars::Add(LVar:TotalPageCount, 1)
   //  Write a text field that shows the current and total page count, ie  - Page X of Y
   WidgetPageCount::SetText(Page %(LVar:CurrentPageCount) of %(LVar:TotalPageCount))
Reply
#8
Wow!, thanks everyone. I did not realise some many people were doing this. I have a lot to play with when I get home.
David
Z-Wave World Magazine|Baltimore Hackerspace
"Why think outside the box when you could let the box think for you." - My take on Home Automation
Reply
#9
will have to try this
tia, Ron

My HT equipment I want to control by CQC (some day hopefully)
Yamaha CX-A5100, Dune HD pro 4k, Dune HD Pro 4k plus, ISY 994i, Samsung 4k FP, and a projector in the future
Reply


Possibly Related Threads…
Thread Author Replies Views Last Post
  Current state of using CQC on a tablet? Is it able to fully replicate desktop interfa ghurty 3 193 11-29-2019, 10:43 AM
Last Post: znelbok
  Week Number RTV znelbok 1 173 10-22-2019, 06:58 PM
Last Post: Dean Roddey
  What cool HA projects/configuration can I work on with my current configuration? ghurty 32 5,660 07-10-2018, 09:54 PM
Last Post: Dean Roddey
  Generate Random Number in a Trigger batwater 1 982 12-10-2017, 12:43 PM
Last Post: Dean Roddey
  Highlight Template page George M 14 6,894 02-08-2017, 05:48 PM
Last Post: Dean Roddey
  Sonos - Current Track zra 2 1,608 06-02-2016, 02:20 PM
Last Post: zra
  Current 4.7.n release Dean Roddey 183 39,175 10-13-2015, 12:08 PM
Last Post: Dean Roddey
  Local web page help? dlmorgan999 5 1,724 06-11-2015, 07:49 AM
Last Post: dlmorgan999
  Correspond image to number? jkmonroe 1 1,344 02-07-2015, 08:10 PM
Last Post: Dean Roddey
  Current Sonos State potts.mike 7 2,035 01-22-2015, 05:03 PM
Last Post: Dean Roddey

Forum Jump:


Users browsing this thread: 1 Guest(s)