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 01-13-2006, 02:45 PM
jbuszkie's Avatar
jbuszkie jbuszkie is offline
Sage Fanatic
 
Join Date: Aug 2003
Location: Westminster, MA
Posts: 938
How do you determine index number of a widget?

I'm looking through the widget API's and I don't see anything that will return the widget position number.

say you have

Code:
   a
     b
        c
        d
        e
        f
     g
     h 
  i
and I want to insert a widget between G and H. I can search for A and make a child widget for it and specify 0 for the index.. but I want it between G and H. I can search for G... but how do I get it's index number so I can bump the index by one and insert my widget there using InsertWidgetChild?

Am I going to have to GetAllChildren and seach until I find G and remember how many I went through? That seems like a pain. Am I missing an API that will do this?

Thanks,

Jim "In STVi hell"
Reply With Quote
  #2  
Old 01-13-2006, 03:00 PM
nielm's Avatar
nielm nielm is offline
SageTVaholic
 
Join Date: Oct 2003
Location: Belgium
Posts: 4,496
Quote:
Originally Posted by jbuszkie
I'm looking through the widget API's and I don't see anything that will return the widget position number.

Code:
   a
     b
        c
        d
        e
        f
     g
     h 
  i
From memory:

Assume that you have found and have assigned widgets a,g and the new widget z to varibles...

Code:
get position of g in list of a's children:
  pos=FindElementIndex(GetWidgetChildren(a),g)
the insert the new widget as a child
  InsertWidgetChild(a,z,pos+1)
The thing you were missing is that the general API list modification functions (FilterBy*, GetElement, and FindElementIndex) can be used with widget lists

Good luck with the stvi And I agree with you abotu STVi hell, but is better than manually merging all changes at each version update
__________________
Check out my enhancements for Sage in the Sage Customisations and Sageplugins Wiki
Reply With Quote
  #3  
Old 01-13-2006, 03:12 PM
jbuszkie's Avatar
jbuszkie jbuszkie is offline
Sage Fanatic
 
Join Date: Aug 2003
Location: Westminster, MA
Posts: 938
Quote:
Originally Posted by nielm
Code:
get position of g in list of a's children:
  pos=FindElementIndex(GetWidgetChildren(a),g)
the insert the new widget as a child
  InsertWidgetChild(a,z,pos+1)
The thing you were missing is that the general API list modification functions (FilterBy*, GetElement, and FindElementIndex) can be used with widget lists
Yeah.. That will work.. Duh! I forgot about the FindElementIndex! (well I haven't had to use it yet so I didn't think to look for it!!) Stupid me!

Quote:
Good luck with the stvi And I agree with you abotu STVi hell, but is better than manually merging all changes at each version update
Is it though???

Thanks a bunch!

Jim
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 06:11 PM.


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