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 02-14-2006, 08:37 PM
dflachbart dflachbart is offline
SageTVaholic
 
Join Date: Jan 2006
Location: Brookfield, CT
Posts: 2,743
Question about AddWidgetChild()

Hi,

I want to link certain widgets to existing themes (MainMenuTheme and OptionsConfirmTheme) in my import-hook. I followed the code examples in nielm's imports and got it working, but after looking at the resulting STV file in Studio I noticed the following:

the primary reference of the MainMenuTheme under the THEME ORGANIZER tree has become a secondary reference (italicized), and the reference under my imported widget which I linked it to is now the primary one (bold). Strangely, for the OptionsConfirmTheme all references in my imported widgets are created as secondary ones...


So, is there a way on the code level to specify that a widget should be a primary or secondary reference ? Or is this simply irrelevant because, as stated in the manual, internally everything is a reference, and the primary/secondary ref distinction is just a Studio concept ? If so, if I remove the widget tree of my widget containing the primary reference will another existing reference then become the primary one ?

Thanks a bunch,

Dirk
Reply With Quote
  #2  
Old 02-14-2006, 09:45 PM
Opus4's Avatar
Opus4 Opus4 is offline
Administrator
 
Join Date: Sep 2003
Location: NJ
Posts: 19,624
I would think that it is irrelevant because the primary/secondary status is just for Studio display purposes. Note that for some reason, the xml STV file format doesn't always keep the primary reference that you specify should be the primary one... if you set a primary, it might not be that way when you reload the file.

And, yes, if you remove a primary reference, then one of the secondary references becomes the primary one. (That is in tutorial 1, for deleting widgets.) BUT, remember that when removing a primary reference, you should not also be deleting its children, because those children are still needed by the other references. (Unless you really do want to delete all those widgets, of course.)

- 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 02-15-2006, 03:05 AM
nielm's Avatar
nielm nielm is offline
SageTVaholic
 
Join Date: Oct 2003
Location: Belgium
Posts: 4,496
As Opus says, be careful when deleting the entire tree with a primary widget (expand the children, select all and delete), because you are also removing all children from all the references to that primary widget.

Although this seems obvious, it has caught me out several times -- when working on some widget tree 'in isolation' in a temporary menu, I link it to its final destination, expand the temp menu and delete all widgets... Of course I am now left with the top level widget only in the final destination! Oops!
__________________
Check out my enhancements for Sage in the Sage Customisations and Sageplugins Wiki

Last edited by nielm; 02-15-2006 at 03:25 AM.
Reply With Quote
  #4  
Old 02-15-2006, 07:09 AM
dflachbart dflachbart is offline
SageTVaholic
 
Join Date: Jan 2006
Location: Brookfield, CT
Posts: 2,743
Quote:
Originally Posted by Opus4
And, yes, if you remove a primary reference, then one of the secondary references becomes the primary one. (That is in tutorial 1, for deleting widgets.) BUT, remember that when removing a primary reference, you should not also be deleting its children, because those children are still needed by the other references. (Unless you really do want to delete all those widgets, of course.)
Yeah, I was aware about this behavior in Studio, but I wasn't sure if the same holds true for removing a widget in code with RemoveWidget(). It sounds like it does, I will try it out ...

Quote:
Originally Posted by nielm
Although this seems obvious, it has caught me out several times -- when working on some widget tree 'in isolation' in a temporary menu, I link it to its final destination, expand the temp menu and delete all widgets... Of course I am now left with the top level widget only in the final destination! Oops!
Has caught me too ....


Thanks a lot for these insights !

Dirk
Reply With Quote
  #5  
Old 02-15-2006, 07:51 AM
nielm's Avatar
nielm nielm is offline
SageTVaholic
 
Join Date: Oct 2003
Location: Belgium
Posts: 4,496
I am not sure what RemoveWidget() does if the widget has multiple parents, or children either... But the equivalent to a Studio delete would be:

RemoveWidgetChild(parent, child)

My deleteWidgetTree code does something like:
Code:
"REM Unlink widget from parent"
If Size(GetWidgetParents(widget) == 1 
> true
   RemoveWidgetChild(parent,widget)
> else
   RemoveWidget(widget)
(although to be honest, I no longer understand that code!)
__________________
Check out my enhancements for Sage in the Sage Customisations and Sageplugins Wiki
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:32 AM.


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