SageTV Community  

Go Back   SageTV Community > SageTV Development and Customizations > SageTV Studio
Forum Rules FAQs Community Downloads Today's Posts Search

Notices

SageTV Studio Discussion related to the SageTV Studio application produced by SageTV. Questions, issues, problems, suggestions, etc. relating to the Studio software application should be posted here.

Reply
 
Thread Tools Search this Thread Display Modes
  #1  
Old 11-27-2007, 10:34 AM
perry59's Avatar
perry59 perry59 is offline
Sage Advanced User
 
Join Date: Oct 2007
Location: oregon, usa
Posts: 76
Is there a better way to do this?

After MANY hours of frustration trying to get my menu table to work, I finally got it. I just kinda stumbled into a "fix", just could'nt see why it would not work and for the heck of it (and to make it look a little cleaner) I took all the guts of the button (see attached image) and made them direct children of the table cell item. Previously this widget chain resided inside a panel object which was the one and only direct child of the table cell object. Viola! it began working as I had intended. Very happy with it now. So my only question is, would any of you guru's code this differently, or have I done
a reasonable job on this?
Thanks for any comments, suggestions
Attached Images
File Type: jpg untitled.JPG (118.3 KB, 235 views)
Reply With Quote
  #2  
Old 11-27-2007, 10:45 AM
Opus4's Avatar
Opus4 Opus4 is offline
Administrator
 
Join Date: Sep 2003
Location: NJ
Posts: 19,624
Just a few quick comments w/o really studying the code: You don't really need a series of If X == Y... you could use a single If X, then have a series of branches below it containign Y1, Y2, etc.

The action chain executed when the button is clicked must be below the button (item widget), not a panel widget, since the panel is a UI element, not a selectable item/button.

And, you should only use a single action chain to be executed below the button, but you can place multiple chains below a single action widget that the button activates.

- Andy
__________________
SageTV Open Source v9 is available.
- Read the SageTV FAQ. Older PDF User's Guides mostly still apply: SageTV V7.0 & SageTV Studio v7.1.
- Hauppauge remote help: 1) Basics/Extending it 2) Replace it 3) Use it w/o needing focus
- HD Extenders: A) FAQs B) URC MX-700 remote setup
Note: This is a users' forum; see the Rules. For official tech support fill out a Support Request.
Reply With Quote
  #3  
Old 11-27-2007, 12:11 PM
perry59's Avatar
perry59 perry59 is offline
Sage Advanced User
 
Join Date: Oct 2007
Location: oregon, usa
Posts: 76
Quote:
Originally Posted by Opus4 View Post
Just a few quick comments w/o really studying the code: You don't really need a series of If X == Y... you could use a single If X, then have a series of branches below it containign Y1, Y2, etc.

The action chain executed when the button is clicked must be below the button (item widget), not a panel widget, since the panel is a UI element, not a selectable item/button.

And, you should only use a single action chain to be executed below the button, but you can place multiple chains below a single action widget that the button activates.

- Andy

Thanks Andy, I'll definately implement your suggestions and clean this up.
I know I also have a problem with how I'm feeding my table. As I add more menus to this stv it will screw up the way I'm indexing into my array of menu names, i.e. I cant guaranty that "my music" will be the first item in the array.
So I'll have to fix that selecting which menus go into the array or throwing out the ones I dont want (in the beforemenuload hook)
Reply With Quote
  #4  
Old 11-27-2007, 02:18 PM
GKusnick's Avatar
GKusnick GKusnick is offline
SageTVaholic
 
Join Date: Dec 2005
Posts: 5,083
I'm confused about what you're trying to accomplish with the "menus" array and the LaunchMenuWidget logic. If you're going to have an If branch for each possible menu under your (green) process chain, then why not just link statically to the desired menu, instead of setting up an index into the "menus" array, which you already know you're going to have trouble managing as the STV grows?

On the other hand, if you intend the code to be array-driven, then why stop halfway? Just put all the per-item info into parallel arrays from the gitgo -- the item names, the image paths, the menu names, etc -- and replace all those Ifs with simple array indexing.
__________________
-- Greg
Reply With Quote
  #5  
Old 11-27-2007, 03:08 PM
perry59's Avatar
perry59 perry59 is offline
Sage Advanced User
 
Join Date: Oct 2007
Location: oregon, usa
Posts: 76
Quote:
Originally Posted by GKusnick View Post
I'm confused about what you're trying to accomplish with the "menus" array and the LaunchMenuWidget logic. If you're going to have an If branch for each possible menu under your (green) process chain, then why not just link statically to the desired menu, instead of setting up an index into the "menus" array, which you already know you're going to have trouble managing as the STV grows?
The reason I went with the table is that I wanted more menu items than is "normally" shown on a sage screen. The table seemed ideal as it allowed me to scroll/wrap the items.
Quote:
Originally Posted by GKusnick View Post
On the other hand, if you intend the code to be array-driven, then why stop halfway? Just put all the per-item info into parallel arrays from the gitgo -- the item names, the image paths, the menu names, etc -- and replace all those Ifs with simple array indexing.
A good point, I'll explore this as well.

Thanks for the comments
Reply With Quote
  #6  
Old 11-27-2007, 03:20 PM
GKusnick's Avatar
GKusnick GKusnick is offline
SageTVaholic
 
Join Date: Dec 2005
Posts: 5,083
Quote:
Originally Posted by perry59 View Post
The reason I went with the table is that I wanted more menu items than is "normally" shown on a sage screen. The table seemed ideal as it allowed me to scroll/wrap the items.
As far as that goes, you can scroll (but not wrap) a panel of statically laid-out items. (See the Detailed Setup and System Information menus for examples.)

But what I was actually asking is why you're using LaunchMenuWidget to link from one menu to the next, when you already have a unique place in your code for each menu linked to. In other words, instead of setting menunumber = i and then falling through to the common call to LaunchMenuWidget, you could just replace menunumber = i with a static link to the corresponding menu, and dispense with LaunchMenuWidget and the setup of the menus array in BeforeMenuLoad. (That's assuming you keep all those Ifs. If you trade those in for an array-indexing scheme, then those unique per-item linkage points go away and this argument doesn't apply.)
__________________
-- Greg
Reply With Quote
  #7  
Old 11-27-2007, 04:13 PM
perry59's Avatar
perry59 perry59 is offline
Sage Advanced User
 
Join Date: Oct 2007
Location: oregon, usa
Posts: 76
Quote:
Originally Posted by GKusnick View Post
In other words, instead of setting menunumber = i and then falling through to the common call to LaunchMenuWidget, you could just replace menunumber = i with a static link to the corresponding menu, and dispense with LaunchMenuWidget and the setup of the menus array in BeforeMenuLoad. (That's assuming you keep all those Ifs. If you trade those in for an array-indexing scheme, then those unique per-item linkage points go away and this argument doesn't apply.)
That was the very first thing I tried (just putting a menu reference where the menunumber=) and it never worked, thats why I was so frustrated with it. However, that was before I moved the guts of the item object to be the direct child of the table cell object. So, this may well work now. If thats the case then yes, I could dispense with all that other stuff as it really would make no sense to take such a convoluted route!

With all these good comments Im anxious to get home and work on it!
Reply With Quote
  #8  
Old 11-27-2007, 05:05 PM
GKusnick's Avatar
GKusnick GKusnick is offline
SageTVaholic
 
Join Date: Dec 2005
Posts: 5,083
Quote:
Originally Posted by perry59 View Post
However, that was before I moved the guts of the item object to be the direct child of the table cell object.
I understand what you're getting at, but just as a terminological point, you don't really mean the table cell object. That would be the widget named "CurrentButton" in your example. You want the green process chain to be a direct child of the Item widget (i.e. the one named "image button"), and (as Andy said) you want just one green child of that widget. (My habit is to make a comment widget that says "REM Process chain" under every Item for just this purpose.) This is true for any Item widget, not just the ones that are in tables. So the table cell really has nothing to do with that part of it.
__________________
-- Greg
Reply With Quote
Reply


Currently Active Users Viewing This Thread: 1 (0 members and 1 guests)
 

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are On
[IMG] code is On
HTML code is Off

Forum Jump


All times are GMT -6. The time now is 02:28 AM.


Powered by vBulletin® Version 3.8.11
Copyright ©2000 - 2023, vBulletin Solutions Inc.
Copyright 2003-2005 SageTV, LLC. All rights reserved.