Trouble deleting a line of text
Sarah Reichelt
sarah.reichelt at gmail.com
Sun Aug 24 18:58:25 EDT 2008
On Mon, Aug 25, 2008 at 8:36 AM, Bill Vlahos <bvlahos at mac.com> wrote:
> I have a table field (but in testing any field behaves this way) that I want
> to delete a line of text when the user right clicks on it. The following
> script deletes the line of text as expected but then throws an error.
>
> 1. Create a field and type several lines of text in it.
> 2. Lock the text of the field (so it can respond to mouseUp)
> 3. Paste the following code into the field
> 4. Click on a line of text
>
> on mouseUp
> select the clickLine
> answer "Really delete" & return & the clickLine && "?" with "No" or "Yes"
> if it is "Yes" then
> delete the clickLine
> end if
> end mouseUp
>
The problem is that "the clickLine" is not preserved and becomes empty
while the answer dialog is open (or when it closes).
Try this instead. It stores "the clickLine" first, then uses the
stored value instead of expecting "the clickLine" to remain the same:
on mouseUp
put the clickline into tClick
select tClick
answer "Really delete" & return & tClick && "?" with "No" or "Yes"
if it is "Yes" then
delete tClick
end if
end mouseUp
Cheers,
Sarah
More information about the use-livecode
mailing list