David Kimmer <[EMAIL PROTECTED]> wrote:
> When using hilite line in conjunction with the mouseLine command,
> Director only seems to hilite the total length of the character
> string on the given line with exception to the last line in the
> field which spans the total width of the field. How can I force
> Director (if possible) to hilite at the total width of the field
> on all lines?
Hi David,
Director seems to consider that a line ends at a RETURN character. If
you tell it to hilite all the characters from after the previous RETURN
up to and including the next RETURN, then it will hilite the entire
line.
Unfortunately, this means that you have to use a rather wordy workaround
(see below). I imagine that Director's method looks good when your line
soft-wraps to make a paragraph, but I hardly ever have to deal with that
situation.
If you think that Director should be modified so that...
on mouseWithin(me)
hilite line the mouseLine of field myField
end mouseWithin
... would hilite the entire length of the line, send a message to
[EMAIL PROTECTED] If you think that the hilite command
should also work with text members, send another message to the same
address.
Cheers,
James
------------------------------------------------------------------------
-- HILITE LINE BEHAVIOR FOR FIELDS --
property spriteNum
property mySprite
property myField
property myText
property myHiliteLine
property useMouseLine
on beginSprite(me)
mySprite = sprite(me.spriteNum)
myField = mySprite.member
myText = myField.text
-- Use "the mouseLine" rather than "pointToLine()" for fields in D7
useMouseLine = (value((the globals).version.char[1]) < 8)
end beginSprite
on exitFrame(me)
if useMouseLine then
-- pointToLine() does not work for fields in D7
if rollover(spriteNum) then
mouseOverLine = the mouseLine
else
mouseOverLine = -1
end if
else
-- pointToLine() is sprite specific, so use it if we can
mouseOverLine = pointToLine(mySprite, the mouseLoc)
end if
if myHiliteLine = mouseOverLine then
-- The mouse is still over the same line: save energy
exit
end if
myHiliteLine = mouseOverLine
if myHiliteLine < 1 then
-- Remove the hilite
hilite char the maxInteger of field myField
exit
end if
if myHiliteLine = 1 then
firstCharToHilite = 1
else
textBeforeMouseLine = myText.line[1..(myHiliteLine - 1)]
firstCharToHilite = textBeforeMouseLine.char.count + 2
-- "+ 2" because of invisible RETURN + first char of myHiliteLine
end if
mouseLineLength = myText.line[myHiliteLine].char.count
lastCharToHilite = firstCharToHilite + mouseLineLength
hilite char firstCharToHilite to lastCharToHilite of field myField
end exitFrame
on isOKToAttach(me, spriteType, spriteNumber)
-- This behavior only works with field members
if spriteType = #graphic then
return sprite(spriteNumber).member.type = #field
else
return FALSE
end if
end isOKToAttach
[To remove yourself from this list, or to change to digest mode, go to
http://www.penworks.com/LUJ/lingo-l.cgi To post messages to the list,
email [EMAIL PROTECTED] (Problems, email [EMAIL PROTECTED])
Lingo-L is for learning and helping with programming Lingo. Thanks!]