![]() |
|
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. |
![]() |
|
Thread Tools | Search this Thread | Display Modes |
#1
|
|||
|
|||
Modifying attributes on AfterMenuLoad hook
I'm trying to modify a local variable depending if the prior menu has a certain setting set. I'm using AddStaticContext(...); so I can pass the setting from menu1 onto menu2. I tried using BeforeMenuLoad hook which checks out the variable set by AddStaticContext, and then modifies my local variable depending on what menu1 did. However I can't seem to make the setting stick, or it's not going through....
Anyone tell me how to set a local variable before my panes are drawn on the screen? I also tried GetFocusContext() which also didn't work. -- FC |
#2
|
||||
|
||||
You should be able to use the BeforeMenuLoad hook, since that is where making such settings are intended to be done before the menu finishes loading.
Is the name of the static context variable the same as the one used in the next menu, by any chance? If not, what is the variable being used for? Does it control some UI setting? - 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. |
#3
|
|||
|
|||
Quote:
Would a testcase help? -- FC |
#4
|
|||
|
|||
Guess didn't answer the question completely, yes the variable is used to setup certain buttons.
-- FC |
#5
|
||||
|
||||
Quote:
Quote:
- 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. |
#6
|
|||
|
|||
Quote:
Thanks for your help -- FC |
#7
|
||||
|
||||
What are you trying to do with infoPanel? It is being set to false, but the pic only shows it being used leadinginto a panel... did you mean for that to be a conditional before the panel?
- 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. |
#8
|
|||
|
|||
Quote:
-- FC |
#9
|
||||
|
||||
Why do you have a second reference to the infoPanel attribute under your MainMenuContainer? By doing so you've effectively declared another variable called infoPanel masking the original infoPanel (the one you've initialized in BeforeMenuLoad).
I'm also not clear on why all the branches of your setInfo conditional do the same thing, or why you even need that conditional at all. If the idea is to initialize infoPanel to the inverse of setInfo, just say !setInfo directly in the attribute widget's Value property. Also, just as a stylistic point, I prefer to arrange the widgets in the order they execute, i.e. attributes first, then BeforeMenuLoad, followed by the actual UI widgets. It doesn't matter to the code, but it does matter to the human being trying to read it and make sense of it.
__________________
-- Greg |
#10
|
||||
|
||||
Quote:
- 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. |
#11
|
|||
|
|||
THANK YOU guys.... I got it working once I removed all the instances of infoPanel. Apologies for the questions, I'm very new to SageTV Studio, a bit confused how it all works (but learning). I was under the assumption that it worked like a programming language where you need the variable declared in every nest.... I did do the tutorial and read the docs, it's just one of those things that I missed....
BTW I can't set infoPanel to setInfo only because there are some entry points into this panel that do not set infoPanel to anything... hence the "if" statement for BeforeMenuLoad -- FC |
#12
|
||||
|
||||
Quote:
- 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. |
#13
|
||||
|
||||
Quote:
Attribute: infoPanel Value: If(setInfo != null, setInfo, false) Or something like that. I'm not saying you have to do it this way. Obviously if your initialization logic doesn't fit neatly on one line, you're better off coding it using Conditional widgets. I just wanted to make sure that you're aware that (a) you can use arbitrary expressions in the Attribute widget's initial value, and (b) there's a one-line If function that's (somewhat) analogous to the ? : operator in C. (Actually it's more like VB's Iif function in that all arguments are evaluated.)
__________________
-- Greg |
#14
|
||||
|
||||
If you are setting some variable in a menu based on the value of a static context being set to that menu, you may be better off setting the variable's value in the BeforeMenuLoad hook. You are definitely better off initializing the local variables in the BeforeMenuLoad hook if using Global contexts to pass values.
SageTV caches the variables & so on used by a menu, so that the menus can load faster for subsequent visits. If a new static context is seen when the menu is loaded, the cache can be tossed & everything gets re-executed. If the static context values are all the same, but you previously calculated a different value for the local variable, it may not get reset to what your static context contains. Global context contents don't affect the menu cache, so a local variable based on a global context really ought to be set in the BeforeMenuLoad hook. It has been a while since I dealt with all this, so I hope I got the details right... but the point for my STV work is that it is just safer to use the BeforeMenuLoad hook to initialize local variables when they are based on outside-the-current-menu settings. ![]() - 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. |
#15
|
|||
|
|||
Sounds good... another thing I didn't realize is that although the variable is seen as a "reference" it's actually not referred to... like a pointer. I had (in my original source) the same attribute in various sections, assuming the attributes were the same one (kinda like a pointer), so once I changed it on the BeforeMenuLoad hook it would stay no matter where I placed the attribute. Maybe I'm off on my whole logic, but it works, that's the important thing to me right now.
Thanks again. |
#16
|
||||
|
||||
No, a widget reference is not like a runtime pointer to a shared variable. It's more like a #define in C, a way of inserting multiple copies of the same code (or variable declarations) in several places, without actually having to copy and paste the code (and manually maintain all the separate copies).
__________________
-- Greg |
#17
|
||||
|
||||
Quote:
If there is no shared parent _somewhere_ (i.e.: the variable is used in 2 different menus) then you have to use global context calls to allow both places to set & share the values. - 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. |
![]() |
Currently Active Users Viewing This Thread: 1 (0 members and 1 guests) | |
|
|