|
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
|
|||
|
|||
Question about loop coding
See the attached jpg is this the current way to do a loop? (I will set property's and the such to stop the loop at a given time) just wanting to make sure I am looping correctly.
cheers codehttp://babgvant.com/downloads/pluckyhd/loop%20code.jpg |
#2
|
||||
|
||||
With that setup, you will spawn a new infinite loop every time the Up command is executed. I'm not sure what you're trying to accomplish, but the Up listener may not be the best place to do this. Also, if you would like the loop to ever stop, then you will have to add a way to break out of it. This is usually done with an If statement.
Aloha, Mike
__________________
"Everything doesn't exist. I'm thirsty." ...later... "No, it's real!!! I'm full." - Nikolaus (4yrs old) |
#3
|
|||
|
|||
Quote:
|
#4
|
||||
|
||||
If you reference the Fork(), then you will spawn a new thread every time you loop. You should reference the widget after the Fork().
Aloha, Mike
__________________
"Everything doesn't exist. I'm thirsty." ...later... "No, it's real!!! I'm full." - Nikolaus (4yrs old) |
#5
|
||||
|
||||
You definitely don't want to loop back to the Fork() call, since that will spawn a new thread every time around the loop. Presumably what you want is to fork just once, and then loop within the forked thread. Typically the place you want to jump back to is your loop exit test, so you can't really have a correct loop structure without that.
Although as Mike said, it's not clear why you want a new thread every the user clicks Up. What if he clicks Up twice in quick succession, before the first loop finishes? What effect are you trying to achieve with this?
__________________
-- Greg |
#6
|
|||
|
|||
Quote:
Thanks that makes more sense. As for why I am putting this in up it would probably be better placed in focus gained (although I don't care if it finishes or not) it is increasing a counter like you see there and that counter is changing pictures rapidly to create animation effect that I have come up with. It seems to work very well so far in testing. cheers |
#7
|
||||
|
||||
When you do those kinds of animations, make sure you pull up Task Manager to see what your CPU usage is. Also make sure you try it out on an extender. I think you'll find that your CPU usage will spike and it will be painfully slow on extenders.
Aloha, Mike
__________________
"Everything doesn't exist. I'm thirsty." ...later... "No, it's real!!! I'm full." - Nikolaus (4yrs old) |
#8
|
|||
|
|||
Quote:
Thanks for the advice I always try and watch the cpu and test on extenders,clients. (got to make sure it works for everyone ) |
#9
|
|||
|
|||
I moved to focus gained and have my if evaluation now. Wanted to run by you guys again and make sure I am on the right train of thought.
TIA for all you comments/help code2 (the fork looks like it is referenced somewhere else but that is a delete that I haven't gotten rid of on the side menu yet so it really isn't) EDIT link now good Last edited by PLUCKYHD; 06-30-2009 at 02:22 PM. |
#10
|
||||
|
||||
Generally speaking, calling Refresh() in a loop is not recommended as a way to do animation. You're usually better off using dynamic animation using the Animate widget property. Set this to some expression that evaluates to true when you want the animation to happen, and false when you don't. So for instance your Image widget could be set to animate when CurrentPic >= 0. Your FocusGained code could then set CurrentPic = 0 to start the animation. Each redraw cycle would increment the counter, and ultimately set it back to -1 to stop the animation.
There's a fairly detailed discussion of this starting on p. 148 of the Studio manual, plus the Property-Based Animation tutorial on p. 126.
__________________
-- Greg |
#11
|
|||
|
|||
Quote:
Also I thought andy had always said to make sure I call refreshs after animations so i do (but those aren't in loops like this) Hopefully I make sense. |
#12
|
|||
|
|||
Also meant to say you know more than me It has been a couple of months or longer sense I went through the animation tutorial I will have a look as I would probably understand it allot better now
I am still confused as I don't think what I am doing is an actual animation |
#13
|
|||
|
|||
Quote:
Thanks a million again the tutorials make more sense everytime I go through them the first time i don't think I understand what "property" based animations meant. A much more efficient way. |
#14
|
||||
|
||||
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. |
#15
|
|||
|
|||
Yeah I was confused when he said property based animations the last time through the tuturial I didn't understand that part fully (obviously)
|
#16
|
|||
|
|||
Okay I made changes and wanted to check my looping code by you guys again it works great but I like to make sure I am doing it correctly/efficiently
loopcode The first one goes on to set a property in another area if true The second it setting an animate property to animate my property animations. I am only wanting to perform this if the user has stayed focused on a item for the set period of time. That is what the waits are for TIA I also have another question about property based animations from the studio manual "Timed Animation In this menu, examine the “Timed Animation” panel’s widget tree. That panel defines a time period for the Animation property of “0,1000,0”, which causes this entire section of the screen to be updated every second. When that panel updates, the displayed text is positioned according to the random position defined in the “Random location” panel. (This is the basic technique used for the SageTV screen saver – see the “Screen Saver” menu in the default STV.)" I get what the 1000 respresents but what are the first and last number for? Last edited by PLUCKYHD; 07-02-2009 at 08:33 AM. |
#17
|
||||
|
||||
Quote:
Quote:
In your code, you could change focus several times and end up having several of those forked threads active & waiting to go off. You should probably have a variable local to the item that says whether focus is still actively on it. Quote:
Quote:
__________________
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. |
#18
|
|||
|
|||
Quote:
Quote:
Quote:
I missed that suggestion sorry |
#19
|
||||
|
||||
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. |
#20
|
|||
|
|||
Quote:
Hopefully that made more sense. Deleted question below figured it out. Last edited by PLUCKYHD; 07-02-2009 at 02:26 PM. |
Currently Active Users Viewing This Thread: 1 (0 members and 1 guests) | |
|
|
Similar Threads | ||||
Thread | Thread Starter | Forum | Replies | Last Post |
SageTV Alarm Clock - Who's up to coding one for a kickback? | chris123 | SageTV Customizations | 19 | 05-28-2009 12:50 PM |
Some coding questions | Ikarius | SageTV Studio | 1 | 02-18-2009 12:47 PM |
coding help | sundansx | SageTV Studio | 8 | 07-22-2006 09:20 PM |