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-18-2010, 09:06 AM
broconne broconne is offline
Sage Aficionado
 
Join Date: Feb 2009
Location: Cary, NC
Posts: 306
Modify the color/theme of one word in a Text Widget

Is it possible to change the color/theme of a single word within a text widget?

For example. Lets say I have multiple titles:

"This is a short title"
"This title is a little bit longer"
"This title is even a little bit longer than the last".

All of these lines are inside of a 1-D table.

In each of them, I want to make the word title be a different color. How can I do that in Sage? I can identify which word I want to change the color of in my plugin - but how using studio can I modify the text properties of a single word in a text widget?
__________________
Host: ESXi 6.5 w/ Intel Core i7 2.8GHZ 8GB Ram
Guest: Ubuntu 16.04 with Sage v9 in Docker
Tuners: 2 HDHR (OTA);
Extenders: HD300 connected to a Samsung 56" DLP HDTV; HD300 connected to a Sharp 42" LCD
Storage: OmniOS w/6 1TB Samsung Spinpoint in a RaidZ2 configuration in a 20 bay SATA hotswap case.
Reply With Quote
  #2  
Old 11-18-2010, 09:38 AM
jaminben jaminben is offline
Sage Icon
 
Join Date: Sep 2007
Location: Norwich, UK
Posts: 1,754
Send a message via MSN to jaminben
Not quite sure what you mean but it's probably possible. Try taking a look at StringIndexOf() & Substring() and de-constructing the text then building it backup applying different theme widgets to the "title" text compared to the rest of the text.

Thats the only thing that comes to mind at the moment...... not sure how well that would work tho.
__________________
Server - Win7 64bit, 2.4Ghz Intel Core 2 Duo, TBS 6284 PCI-E Quad DVB-T2 Tuner, 3 x HD200 & 1 x HD300 extenders
Reply With Quote
  #3  
Old 11-18-2010, 09:47 AM
broconne broconne is offline
Sage Aficionado
 
Join Date: Feb 2009
Location: Cary, NC
Posts: 306
Quote:
Originally Posted by jaminben View Post
Not quite sure what you mean but it's probably possible. Try taking a look at StringIndexOf() & Substring() and de-constructing the text then building it backup applying different theme widgets to the "title" text compared to the rest of the text.

Thats the only thing that comes to mind at the moment...... not sure how well that would work tho.
Yeah - separating the text is not an issue. How does one "build it back up" in studio. What widgets allows me to have text of varying length put together with proper spacing between characters, deal with shrinking text to fit across the whole area.. etc?

The text part I can handle. So I guess the question is:
How in studio can you can take discrete segments of text and put them together so that they look and behave as if they are a single element?
__________________
Host: ESXi 6.5 w/ Intel Core i7 2.8GHZ 8GB Ram
Guest: Ubuntu 16.04 with Sage v9 in Docker
Tuners: 2 HDHR (OTA);
Extenders: HD300 connected to a Samsung 56" DLP HDTV; HD300 connected to a Sharp 42" LCD
Storage: OmniOS w/6 1TB Samsung Spinpoint in a RaidZ2 configuration in a 20 bay SATA hotswap case.
Reply With Quote
  #4  
Old 11-18-2010, 09:52 AM
jaminben jaminben is offline
Sage Icon
 
Join Date: Sep 2007
Location: Norwich, UK
Posts: 1,754
Send a message via MSN to jaminben
You could try something like the attached screenshot......but it may not work all that well with shrinking text.
Attached Images
File Type: jpg Panel Widget Setup Like This.jpg (92.2 KB, 188 views)
__________________
Server - Win7 64bit, 2.4Ghz Intel Core 2 Duo, TBS 6284 PCI-E Quad DVB-T2 Tuner, 3 x HD200 & 1 x HD300 extenders
Reply With Quote
  #5  
Old 11-18-2010, 09:53 AM
PLUCKYHD PLUCKYHD is offline
SageTVaholic
 
Join Date: Dec 2007
Posts: 6,257
I would do it like so using string contains direct in java

Code:
if (calltocheckstringforcontains(String)
 >true
     SplitString = Call to sepearte string out
         Call to get First String Element 
               TextWidget
         Call to get Second String Element
                  TextWidget
        If(HasThirdElement)
           Call to get Third String Element
                 TextWidget
            
 >else
   String in action widget
         Text Widget
That is how I would do it split the string. You should have a max of 3 strings and check each element for the match value in the theme.

That should work
Reply With Quote
  #6  
Old 11-18-2010, 10:08 AM
broconne broconne is offline
Sage Aficionado
 
Join Date: Feb 2009
Location: Cary, NC
Posts: 306
Thanks Jaminben and Plucky.

That certainly solves the example I provided. I sort of simplified the example to make it easier to understand.. However, I am not sure if what we are talking about would work with what I am trying to do.

The full problem is that I have N number of regular expressions that will match X number of words in the title. So lets do some more xamples.

N={title}
Title = "The title of the title is in face the title's title"
I would want to appear like
The title of the title is in face the title's title

Example two:
N={title,dog}
Title = "The dog title of dog the title is in face the title's title dog"
I would want to appear like:
The dog title of dog the title is in face the title's title dog

I have no problem identifying in the plugin what I want to color red, but I am unsure how to put it all back together in sage such that its dynamic and can grow to arbitrary title lengths, etc.
__________________
Host: ESXi 6.5 w/ Intel Core i7 2.8GHZ 8GB Ram
Guest: Ubuntu 16.04 with Sage v9 in Docker
Tuners: 2 HDHR (OTA);
Extenders: HD300 connected to a Samsung 56" DLP HDTV; HD300 connected to a Sharp 42" LCD
Storage: OmniOS w/6 1TB Samsung Spinpoint in a RaidZ2 configuration in a 20 bay SATA hotswap case.
Reply With Quote
  #7  
Old 11-18-2010, 10:24 AM
jaminben jaminben is offline
Sage Icon
 
Join Date: Sep 2007
Location: Norwich, UK
Posts: 1,754
Send a message via MSN to jaminben
Heh, thats going to be really tricky and pretty much above my pay grade. However I'm thinking of something that may work in a funny sort of way...... how about a table within a table on a per cell basis. So basically you would need to create an array you can feed into a table which is inserted into each cell of the original table. Measure the length of each element marking which need special colors (every other element) then add an If element == even number use special color theme or else use normal color theme for odd element numbers. It wouldn't be too hard to do this on a focused item (as you could do this in green widget code) but I'm guessing if you wanted all cell's to display the different colors from the outset it would become quite intensive on your system.
__________________
Server - Win7 64bit, 2.4Ghz Intel Core 2 Duo, TBS 6284 PCI-E Quad DVB-T2 Tuner, 3 x HD200 & 1 x HD300 extenders
Reply With Quote
  #8  
Old 11-18-2010, 10:25 AM
PLUCKYHD PLUCKYHD is offline
SageTVaholic
 
Join Date: Dec 2007
Posts: 6,257
Yeah I gave him that Idea as well ben and think it may be his best option.
Reply With Quote
  #9  
Old 11-18-2010, 10:28 AM
jaminben jaminben is offline
Sage Icon
 
Join Date: Sep 2007
Location: Norwich, UK
Posts: 1,754
Send a message via MSN to jaminben
Quote:
Originally Posted by PLUCKYHD View Post
Yeah I gave him that Idea as well ben and think it may be his best option.
Ha, so my two year learning curve starting from scratch wasn't a complete waste of time then
__________________
Server - Win7 64bit, 2.4Ghz Intel Core 2 Duo, TBS 6284 PCI-E Quad DVB-T2 Tuner, 3 x HD200 & 1 x HD300 extenders
Reply With Quote
  #10  
Old 11-18-2010, 10:28 AM
broconne broconne is offline
Sage Aficionado
 
Join Date: Feb 2009
Location: Cary, NC
Posts: 306
Quote:
Originally Posted by jaminben View Post
Heh, thats going to be really tricky and pretty much above my pay grade. However I'm thinking of something that may work in a funny sort of way...... how about a table within a table on a per cell basis. So basically you would need to create an array you can feed into a table which is inserted into each cell of the original table. Measure the length of each element marking which need special colors (every other element) then add an If element == even number use special color theme or else use normal color theme for odd element numbers. It wouldn't be too hard to do this on a focused item (as you could do this in green widget code) but I'm guessing if you wanted all cell's to display the different colors from the outset it would become quite intensive on your system.
Yeah - when Plucky and I were first talking about this - we discussed table within table. That is what I tried - but I could not get the spacing between the inner tables elements to work.

Its too bad I can't have attributes in the text itself processed by sage...
__________________
Host: ESXi 6.5 w/ Intel Core i7 2.8GHZ 8GB Ram
Guest: Ubuntu 16.04 with Sage v9 in Docker
Tuners: 2 HDHR (OTA);
Extenders: HD300 connected to a Samsung 56" DLP HDTV; HD300 connected to a Sharp 42" LCD
Storage: OmniOS w/6 1TB Samsung Spinpoint in a RaidZ2 configuration in a 20 bay SATA hotswap case.
Reply With Quote
  #11  
Old 11-18-2010, 10:33 AM
PLUCKYHD PLUCKYHD is offline
SageTVaholic
 
Join Date: Dec 2007
Posts: 6,257
Quote:
Originally Posted by broconne View Post
Yeah - when Plucky and I were first talking about this - we discussed table within table. That is what I tried - but I could not get the spacing between the inner tables elements to work.

Its too bad I can't have attributes in the text itself processed by sage...
If you do it like that sample I showed the spacing will work and build dynamically but still don't know how performance wise it will be.
Reply With Quote
  #12  
Old 11-18-2010, 10:42 AM
jaminben jaminben is offline
Sage Icon
 
Join Date: Sep 2007
Location: Norwich, UK
Posts: 1,754
Send a message via MSN to jaminben
Quote:
Originally Posted by broconne View Post
Yeah - when Plucky and I were first talking about this - we discussed table within table. That is what I tried - but I could not get the spacing between the inner tables elements to work.

Its too bad I can't have attributes in the text itself processed by sage...
Take this with a pinch of salt as I'm only guessing but wouldn't the spacing be dynamic...... so leave the cell sizes blank in Studio and manually add a space into the array so spaces appear before each black text element and before every red text element. Not quite sure that makes any sense as I can't even work it out in my head now

I'll shut up now.
__________________
Server - Win7 64bit, 2.4Ghz Intel Core 2 Duo, TBS 6284 PCI-E Quad DVB-T2 Tuner, 3 x HD200 & 1 x HD300 extenders
Reply With Quote
  #13  
Old 11-18-2010, 10:43 AM
PLUCKYHD PLUCKYHD is offline
SageTVaholic
 
Join Date: Dec 2007
Posts: 6,257
Quote:
Originally Posted by jaminben View Post
Take this with a pinch of salt as I'm only guessing but wouldn't the spacing be dynamic...... so leave the cell sizes blank in Studio and manually add a space into the array so spaces appear before each black text element and after every red text element. Not quite sure that makes any sense as I can't even work it out in my head now

I'll shut up now.
Yeah that is what I was getting at just make the panel horizontal alignment and leave the rest blank and it should be dynamic from there.
Reply With Quote
  #14  
Old 11-18-2010, 11:46 AM
GKusnick's Avatar
GKusnick GKusnick is offline
SageTVaholic
 
Join Date: Dec 2005
Posts: 5,083
I don't think you're going to find a good general solution to this. You can break the text down into separate chunks, but the layout rules for adjacent text widgets within an item or panel are not the same as the rules for laying out and word-wrapping text within a single widget. So it's always going to look slightly off compared to normal smooth text flow.
__________________
-- Greg
Reply With Quote
  #15  
Old 11-18-2010, 12:03 PM
BobPhoenix BobPhoenix is offline
SageTVaholic
 
Join Date: Oct 2004
Posts: 3,152
Could you use GetEmbeddedPanel() and do it all in Java in the AWT panel returned from the call? Just asking because I've never tried it.
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

Similar Threads
Thread Thread Starter Forum Replies Last Post
Theme Menu Text Color ??? SWKerr SageTV v7 Customizations 0 07-01-2010 03:33 PM
Modify text color? webwalker SageMC Custom Interface 1 02-09-2009 10:22 PM
How to get blank line in text widget? cncb SageTV Studio 2 07-20-2008 05:44 PM
When are Text widget properties refreshed? JREkiwi SageTV Studio 9 05-03-2007 09:35 AM
Scaling Text widget size within image widget area Morgan111 SageTV Studio 2 12-04-2006 02:16 PM


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


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