I have a few questions with FX colors for styling text.
I have a GUI with a FXText frame which upon running my programs is populated
with the contents of an array in a separate method using the
@evtrievefindings.join("\n"). This array is populated in a method with
quite a lot of information throughout the running of the program eg.
if 100
@evtrievefindings.push "info"
end
if 200
@evtrievefindings.push "different info"
end
I was wondering can I use styled text to assign one occurance of
@evtrievefindings.push as being in the colour red, eg.
if 100
@evtrievefindings.push "info"
end
if 200
@evtrievefindings.push.changestyle "different info"
end
Does this make sense? Basically I want my program to write the contents of the
array to the text frame as normal but when data meets one criteria I want the
data written to the array to be a colour.
I know you can use FX to colour specified text, however I do not know what the
text is.
Thanks in adavnce.
-------------- next part --------------
An HTML attachment was scrubbed...
URL:
<http://rubyforge.org/pipermail/fxruby-users/attachments/20081201/72d82bf6/attachment.html>
On Dec 1, 2008, at 7:00 AM, Stuart Clarke wrote:> I was wondering can I use styled text to assign one occurance of > @evtrievefindings.push as being in the colour red, eg. > > if 100 > @evtrievefindings.push "info" > end > if 200 > @evtrievefindings.push.changestyle "different info" > end > > Does this make sense? Basically I want my program to write the > contents of the array to the text frame as normal but when data > meets one criteria I want the data written to the array to be a > colour.If what you''re asking is whether you can embed some sort of markup in the text itself to change the text style (e.g. as you do with HTML), and the answer to that question is no. What you might want to investigate is appending text to the FXText window incrementally (instead of setting the content in one fell swoop), e.g. @evtrievefindings.each do |finding| text_widget.appendText(finding + "\n") end And then once you''ve got that working, switch over to using styled text. You would still need to keep some sort of indicator in the @etrievefindings array (or a parallel array), but you could at least know which style to apply: @etrievefindings.each do |finding| if condition1 text_widget.appendStyledText(finding + "\n", style1) else text_widget.appendStyledText(finding + "\n", style2) end end Hope this helps, Lyle -------------- next part -------------- An HTML attachment was scrubbed... URL: <http://rubyforge.org/pipermail/fxruby-users/attachments/20081201/c23f7465/attachment.html>
Oh that is a shame, it would be useful if somone could figure that out. Thanks
for your suggestion though I will give it a go.
?
Many thanks
--- On Mon, 1/12/08, Lyle Johnson <lyle at lylejohnson.name> wrote:
From: Lyle Johnson <lyle at lylejohnson.name>
Subject: Re: [fxruby-users] Styled text on arrays
To: fxruby-users at rubyforge.org
Date: Monday, 1 December, 2008, 4:16 PM
On Dec 1, 2008, at 7:00 AM, Stuart Clarke wrote:
I was wondering can I use styled text to assign one occurance of
@evtrievefindings.push as being in the colour red, eg.
if 100
@evtrievefindings.push "info"
end
if 200
@evtrievefindings.push.changestyle "different info"
end
Does this make sense? Basically I want my program to write the contents of the
array to the text frame as normal but when data meets one criteria I want the
data written to the array to be a colour.
If what you''re asking is whether you can embed some sort of markup in
the text itself to change the text style (e.g. as you do with HTML), and the
answer to that question is no.
What you might want to investigate is appending text to the FXText window
incrementally (instead of setting the content in one fell swoop), e.g.
@evtrievefindings.each do |finding|
text_widget.appendText(finding + "\n")
end
And then once you''ve got that working, switch over to using styled
text. You would still need to keep some sort of indicator in the
@etrievefindings array (or a parallel array), but you could at least know which
style to apply:
@etrievefindings.each do |finding|
if condition1
text_widget.appendStyledText(finding + "\n", style1)
else
text_widget.appendStyledText(finding + "\n", style2)
end
end
Hope this helps,
Lyle_______________________________________________
fxruby-users mailing list
fxruby-users at rubyforge.org
http://rubyforge.org/mailman/listinfo/fxruby-users
-------------- next part --------------
An HTML attachment was scrubbed...
URL:
<http://rubyforge.org/pipermail/fxruby-users/attachments/20081202/b0454eb6/attachment-0001.html>