Inserting text into a field

Ronald Zellner zellner at tamu.edu
Fri Jul 1 12:29:00 EDT 2011


This may be over-kill, but it works.

Script on the text field:

on selectionChanged --set variable for insertion point
   global insertPoint
   put word 2 of the selectedChunk into insertPoint  
end selectionChanged


Script on Combo box:

on menuPick pItemName
   global insertPoint
   switch pItemName
   end switch  
      
   if character insertPoint of field "NewText" = space then     -- check for relative location related to spaces 
      put space & pItemName before character insertPoint of field "NewText"
   else 
      put pItemName & space before character insertPoint of field "NewText"
   end if
end menuPick

Same script works in an Option Menu button.

Ron


More information about the use-livecode mailing list