Digital Workshop

Welcome to the Digital Workshop Message Boards
It is currently December 22nd, 2024, 11:26 pm

All times are UTC [ DST ]




Post new topic Reply to topic  [ 9 posts ] 
Author Message
 Post subject: Changing font colour for specific text within a variable
PostPosted: May 11th, 2006, 1:13 pm 
Offline

Joined: February 5th, 2006, 3:39 am
Posts: 55
Location: Scotland
Hi Folks,

I have a small problem....
I have info within a text box which is retrieved from a variable. (The variable is reading from a txt file on the hard drive)
Would it be possible to change specific text within that box to a different colour, for example: would I be able to look for the word 'Yes' within the text box and change the font colour to red if the word was found?

I have tried and failed miserably!!

Can anyone shed some light on whether this is possible or not?

Jim

OPUS Pro 05.


Top
 Profile  
 
 Post subject: Different Color
PostPosted: May 11th, 2006, 1:55 pm 
Offline

Joined: October 25th, 2004, 2:20 pm
Posts: 686
Location: Naperville, Illinois (USA)
Opus: 7.05
OS: Win XP SP3
System: P4 3.2GHz 1GB RAM 2-TB HDs + 4 more
Jim --

I don't know of a way, through programming, to change the color of a single word within a single Text Object, so I would use two Text Objects. The second would contain the Variable in the color you desire.

If the Variable word can be different lengths (Yes=3 spaces, No= 2 spaces), then fitting it perfectly into Text Object one may be a problem. I would try to have Text Object two be the last word of the sentence, or have it at the end of a line so the different length possibilities would not be noticeable.

Hope that helps.

_________________
Fred Harms, Extraordinary Demos
Naperville, Illinois (USA) 630/904-3636
demofred@aol.com


Top
 Profile Visit website  
 
 Post subject:
PostPosted: May 11th, 2006, 3:48 pm 
Offline

Joined: February 5th, 2006, 3:39 am
Posts: 55
Location: Scotland
Thanks for your reply Fred.

As the text file I'm reading from is constantly updated from elsewhere, that wouldnt be possible.
It was a nice to have request for my publication. If I cannot achieve it..... well its not too much of a problem.

I will keep trying

Jim


Top
 Profile  
 
 Post subject:
PostPosted: May 11th, 2006, 5:48 pm 
Offline

Joined: November 5th, 2004, 6:54 am
Posts: 130
Location: Hengelo, The Netherlands
Opus: 8.5/9.0
OS: Windows 7 64-bits, Android 2.1, Android 4.1.2, iOS 7
System: Pentium 7i, 6GB RAM, 750GB HD, DVD-RW (+/-), DV, 3TB EHD, 3D monitor without glasses
Hi Jim,

Here is a simple example I just created.
I hope this helps.

Kind regards,


You do not have the required permissions to view the files attached to this post.

_________________
Oscar Nijst
ON Education & Consultancy
Hengelo, The Netherlands
OPUS Pro 9.5
Pentium 7i, 16GB RAM, 1 TB HD, DVD-RW (+/-), DV, 3TB EHD, 3D monitor without glasses


Top
 Profile Visit website  
 
 Post subject: Non-Script Solution
PostPosted: May 11th, 2006, 9:08 pm 
Offline

Joined: October 25th, 2004, 2:20 pm
Posts: 686
Location: Naperville, Illinois (USA)
Opus: 7.05
OS: Win XP SP3
System: P4 3.2GHz 1GB RAM 2-TB HDs + 4 more
OK, here's both Oscar's solution Page which uses Script, and a Non-Scripting Page which does the same thing.


You do not have the required permissions to view the files attached to this post.

_________________
Fred Harms, Extraordinary Demos
Naperville, Illinois (USA) 630/904-3636
demofred@aol.com


Top
 Profile Visit website  
 
 Post subject:
PostPosted: May 16th, 2006, 11:15 am 
Offline

Joined: February 5th, 2006, 3:39 am
Posts: 55
Location: Scotland
Hi Folks, sorry I've not replied sooner.

Fred and Oscar, thanks for your efforts but I'm not so sure I have explained myself properly.

I have attached a small Imp file, maybe this will help


Jim


You do not have the required permissions to view the files attached to this post.


Top
 Profile  
 
 Post subject:
PostPosted: May 16th, 2006, 2:35 pm 
Offline

Joined: November 3rd, 2004, 2:11 pm
Posts: 323
You haven't mentioned whether what you are reading into your text variable in Opus (the external file) is dynamically generated or not. If not, and you can control it, you could create an HTML file and then use JavaScript to do the word highlighting as you want. You might be able to do this in Opus, but if I recall correctly, Opus doesn't do regular expressions, and I think this is an example of where you need them.

I've attached an example. The example has a browser object that calls an external file. This is similar in setup to a variable/external text source relationshiip. I have two HTML files. One is a container file to eliminate the scrollbar on the second text HTML file. Within the text HTML file there is some JavaScript that runs upon loading. It looks for a word or words you specify and then highlights them in the HTML. All you would have to do is have a text editor like Notepad to edit the text HTML file in the BODY tag. If you don't mind the scrollbars displaying, then you could get rid of the container HTML file and just point to the text HTML file.

Hope this makes sense. If not, let me know and I will try to further explain as needed.


You do not have the required permissions to view the files attached to this post.

_________________
Opus Pro XE 9.1 Win7 64-bit Core i3 8MB RAM


Top
 Profile Visit website  
 
 Post subject:
PostPosted: May 16th, 2006, 6:18 pm 
Offline

Joined: February 5th, 2006, 3:39 am
Posts: 55
Location: Scotland
Thanks for the reply BW. Although the text in my file is dynamic, It is updated in the pub via a right click trigger so yes, it can be controlled.
I will have to refresh myself on web pages and html. Its been a long time since I had my own web page!

I will look at your suggestion, which sounds very good, and maybe If you allow me, annoy you a little bit more!!


Jim


Top
 Profile  
 
 Post subject:
PostPosted: May 16th, 2006, 6:38 pm 
Offline

Joined: November 3rd, 2004, 2:11 pm
Posts: 323
Annoy away :wink:

_________________
Opus Pro XE 9.1 Win7 64-bit Core i3 8MB RAM


Top
 Profile Visit website  
 
Display posts from previous:  Sort by  
Post new topic Reply to topic  [ 9 posts ] 

All times are UTC [ DST ]


Who is online

Users browsing this forum: No registered users and 55 guests


You cannot post new topics in this forum
You cannot reply to topics in this forum
You cannot edit your posts in this forum
You cannot delete your posts in this forum
You cannot post attachments in this forum

Search for:
Jump to:  
cron
Powered by phpBB © 2000, 2002, 2005, 2007 phpBB Group