On 8/24/03 10:53 PM, Rob Gould wrote:

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. (Using the imageSource call).

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. 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. 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.

The "selectedChunk" function is your friend here. Try this:


on keydown theKey
  if theKey = "*" then
    get the selectedchunk
    do "put theKey into" && it
    set the imagesource of char (word 2 of it) of me to "checkbox"
  else
    pass keydown
  end if
end keydown

You don't need a "refreshnotes" handler, just this one in the script of the field.

--
Jacqueline Landman Gay         |     [EMAIL PROTECTED]
HyperActive Software           |     http://www.hyperactivesw.com

_______________________________________________
use-revolution mailing list
[EMAIL PROTECTED]
http://lists.runrev.com/mailman/listinfo/use-revolution

Reply via email to