Hi again, another noob question.
I have a field of text a user is working on. I have two problems.
1. I can't seem to find a field property that lets the user drag (mouseDown) across a phrase and visibly hilite it (like using a hiliter pen). Instead it sets the foreground color to the background color (making the text invisible) and underlines the selection with whatever color I have set the Hilite property to while they are dragging. I can't seem to find the right combination of properties in the Object Properties window to make this happen. I can set it after the fact using a script of course, but that doesn't help while they are dragging.
My question here is "Is it possible through Object Properties to make a field act like it is being hilited while the action is occuring?"
2. Then when the user is done, I want to reset all the hilites in the field by using:
set the backgroundcolor of field fInField to "white"
set the foregroundcolor of field fInField to "black"
This only sets the backgroundcolor in areas that don't already have text in them. I am using different color hilites to mark different contexts in a document, so the field gets quite messy in the process.
My question here is "Is there a simple way, without going word to word, to reset the various hilites I have in a field?"
3. So I tried using a "repeat for each word" but this returns the word, not it's chunk description. This brings on my third question, which I am sure is in the documents but I just can't find it.
"Is there a way to use repeat for each word and return the chunk description ("char 132 to char 168 of field 4" for example) rather than the chunk contents, so I can test or reset the text properties of that chunk?"
Or even better, go through and return each chunk hilited a certain way, as in:
repeat for each chunk with backcolor "255,255,0"
Thanks again.
Unhiliting selected text in a field
Moderators: FourthWorld, heatherlaine, Klaus, kevinmiller
Unhiliting selected text in a field
Walt Brown
Omnis traductor traditor
Omnis traductor traditor
Walt,
you say
If you have the text locked and the user is just editing the hiliting then you could put something like this into the script of the field
if the text of the field is editable then you could put something like this into a button
to reset all text hiliting you could put this into a button:
Or do you mean something different alltogether?
(never mind the colors I used, I am not really colorblind...
)
regards
Bernd
you say
Is the user entering text or is the text locked, and the user edits the highlighting of the text according to some scheme?I have a field of text a user is working on
If you have the text locked and the user is just editing the hiliting then you could put something like this into the script of the field
Code: Select all
on mouseUp -- user dragged and hilited some text
put the selectedchunk into tText
set the foregroundcolor of tText to red
end mouseUp
on mouseDoubleUp -- double clicking on a word
put the mousechunk into myChunk
if myChunk is not empty then
select myChunk
set the foregroundcolor of myChunk to blue
end if
end mouseDoubleUp
if the text of the field is editable then you could put something like this into a button
Code: Select all
on mouseUp pMouseBtnNo
put the selectedchunk of field 1 into tSelected
set the foregroundcolor of tSelected to green
set the backgroundcolor of tSelected to yellow
end mouseUp
Code: Select all
on mouseUp
set the foregroundcolor of char 1 to -1 of field 1 to black
set the backgroundcolor of char 1 to - 1 of field 1 to white
end mouseUp
(never mind the colors I used, I am not really colorblind...

regards
Bernd
Walt,
I see two options, the easy one:in the script of the field.
another option in the script of the field is a little more responsive and as an option in Rev a very powerful: send in time. Basically as long as a handler is runnign Rev can not do anything else. A long repeat handler is locking effectively everything up. But with a send in time construct you give Rev the time to do its housekeeping and you allow user input (like clicking a button) Sounds complicated but is actually quite simple as in this handler for the field script:
the send in time is a little more then is needed here but to try it out is a nice opportunity.
regards
Bernd
I see two options, the easy one:
Code: Select all
on mouseStillDown
put the selectedchunk into tText
set the foregroundcolor of tText to red
-- you could also set the backgroundcolor
-- set the backgroundcolor of tText to black
end mouseStillDown
on mouseUp
-- to remove the remnants of the selection
select after char (word 4 of the selectedchunk of me) of me
end mouseUp
another option in the script of the field is a little more responsive and as an option in Rev a very powerful: send in time. Basically as long as a handler is runnign Rev can not do anything else. A long repeat handler is locking effectively everything up. But with a send in time construct you give Rev the time to do its housekeeping and you allow user input (like clicking a button) Sounds complicated but is actually quite simple as in this handler for the field script:
Code: Select all
on mousedown
send checkforHilite to me in 2 milliseconds
end mousedown
on checkforHilite
if the mouse is down then
put the selectedchunk into tText
set the foregroundcolor of tText to red
send checkforHilite to me in 2 milliseconds
else
-- to remove visual remnants of the selection
select after char (word 4 of the selectedchunk of me) of me
end if
end checkforHilite
regards
Bernd