![]() |
|
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
|
|||
|
|||
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. |
#2
|
|||
|
|||
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 |
#3
|
|||
|
|||
Quote:
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. |
#4
|
|||
|
|||
You could try something like the attached screenshot......but it may not work all that well with shrinking text.
__________________
Server - Win7 64bit, 2.4Ghz Intel Core 2 Duo, TBS 6284 PCI-E Quad DVB-T2 Tuner, 3 x HD200 & 1 x HD300 extenders |
#5
|
|||
|
|||
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 should work |
#6
|
|||
|
|||
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. |
#7
|
|||
|
|||
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 |
#8
|
|||
|
|||
Yeah I gave him that Idea as well ben and think it may be his best option.
|
#9
|
|||
|
|||
Quote:
![]()
__________________
Server - Win7 64bit, 2.4Ghz Intel Core 2 Duo, TBS 6284 PCI-E Quad DVB-T2 Tuner, 3 x HD200 & 1 x HD300 extenders |
#10
|
|||
|
|||
Quote:
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. |
#11
|
|||
|
|||
Quote:
|
#12
|
|||
|
|||
Quote:
![]() 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 |
#13
|
|||
|
|||
Quote:
|
#14
|
||||
|
||||
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 |
#15
|
|||
|
|||
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.
|
![]() |
Currently Active Users Viewing This Thread: 1 (0 members and 1 guests) | |
|
|
![]() |
||||
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 |