<!DOCTYPE html PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN">
<html>
<head>
  <title></title>
</head>
<body>
<font size="2"><font face="Helvetica,sans-serif">I'm sure I must be
overlooking something simple - - - - What I'm trying to do is have a
text field that detects when the user presses the character "*", and
when they do, it replaces that "*" with a bitmap graphic.&nbsp; (Using the
imageSource call).&nbsp; <br>
<br>
I've got the below code which _almost_ does this, except that it
replaces all the astericks except the one that the user just pressed.&nbsp;
The trick here is that the user can click and put the cursor anywhere
in the text field, so it's not like I can just add an "*" to the last
char of the field and swap it out.&nbsp; I somehow need to find out the
position in the text field where the cursor is, and add the asterick,
and THEN run the "refreshnotes" handler.<br>
<br>
on keydown theKey<br>
&nbsp; if theKey = "*" then<br>
&nbsp;&nbsp;&nbsp; refreshnotes<br>
&nbsp; end if<br>
&nbsp; <br>
&nbsp; pass keydown<br>
&nbsp; <br>
end keydown<br>
<br>
<br>
on refreshnotes<br>
&nbsp; put the number of lines in field "notes" into temp<br>
&nbsp; repeat with x = 1 to temp<br>
&nbsp;&nbsp;&nbsp; if line x of field "notes" contains "*" then<br>
&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; put the length of line x of field "notes" into linelength<br>
&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; repeat with y = 1 to linelength<br>
&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; if char y of line x of field notes = "*" then<br>
&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; set the imageSource of char y of line x of field "notes" to
"checkbox"<br>
&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; end if<br>
&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; end repeat<br>
&nbsp;&nbsp;&nbsp; end if<br>
&nbsp; end repeat<br>
end refreshnotes<br>
</font></font>
</body>
</html>