Page 1 of 1

Chat application: change color of word in global variable

Posted: Mon Jun 13, 2016 4:38 pm
by starfirescully
Hello everyone,

I am creating a fake chat application for running an experiment.

I have the Subject ID which is different depending on each participant (Ex. AAAAAAA01; always seven letters and 2 numbers) so I have it in the global variable (as I call it on multiple cards) gSubjectID

An image of the window is attached

When the subject types something in and presses send, it displays the text after what is already there (so it is constantly updating)

Here is an example of the code in simplest form:

Code: Select all

on mouseUp
         
         put return after fld "chatfield"
         put gSubjectID & ":" & space & fld"textfield" after fld "chatfield"
         put empty into fld "textfield"
         wait 4 seconds
         put return & return  & Confederate & ":" & space & fld "OtherAnswer1" after fld "chatfield"
         add 1 to ChatCount
         
end 

An example of what it could display in the chat window:
Please wait connecting...
Connected
AAAAAAA01 has joined the room

AAAAAAA01: Hello this is my first chat message
This puts the Subject ID and : before whatever they type. I want the Subject ID to be a different color.

I have tried Htmltext but it only works for replacing everything in the new field not for updating the field with additional text.

Any thought? Is this even possible?

Re: Chat application: change color of word in global variabl

Posted: Mon Jun 13, 2016 4:59 pm
by dunbarx
Hi.

Make a field. Put several words of text into it. In the msg box;

Code: Select all

set the textColor of word 2 of fld "yourField" to "yellow"
Craig Newman

EDIT.

It occurs to me that learning how the htmlText property works might be really useful to you. It contains color information as well as styles.