a couple hurdles I had with Rev

Mark Smith mark at maseurope.net
Thu Jun 15 20:04:00 EDT 2006


On 16 Jun 2006, at 00:47, Jared Smith wrote:

> Here are a few things that I've been confused about:
>
> 1) How do I find the number of times a certain character appears in a
> string? The "offset" function only finds the first occurance, it
> doesn't count them.
>

This function should work:

function charCount tText,tChar
   set the itemDelimiter to tChar
   return the number of items in tText - 1
end charCount



> 2) Why isn't there a deleteKey handler? There's a backspaceKey and a
> few others, but I'd like a way to respond when the user presses the
> delete key.
>

 From the docs (Rev 2.7.2 on Mac OS X):


> deleteKey
>
>
> Syntax: deleteKey
>
> See also:   backspaceKey message , cutKey message , delete command
> 	 	 	 	 	 	 	 	
> Summary:
> Sent to the active (focused) control, or to the current card if  
> there is no active control.
>
>
> on deleteKey -- clear the entire field
>   if word 1 of the name of the target is "field" then
>     put empty into the target
>   end if
> end deleteKey
>
>
> Handle the deleteKey message if you want to do something special  
> when the user presses the forward delete key.
>
> Comments:
> The message is sent to the active (focused) control, or to the  
> current card if no control is focused.
>
> The forward delete key is not the same as the backspace or delete key:
> 	* The forward delete key is usually to the right of the main  
> keyboard layout, and may be labeled with the word "Delete" or a  
> left-facing arrow. Pressing it sends a deleteKey message.
> 	* The backspace key is usually on the main keyboard above the  
> Return key, and is may be labeled "Backspace" or "Delete". Pressing  
> it sends a backspaceKey message.


Best,

Mark Smith



More information about the use-livecode mailing list