Inconsistent Results - resolved but it still may be a bug

Barry Levine themacguy at macosx.com
Tue Aug 5 13:18:01 EDT 2003


Sarah,

Yes, your solution worked. I think I found the inconsistency, as well. 
I suspect that failing to specify the field:

>> put the selectedText into userToDelete
>> put the selectedLine into whatToRemove

(at least in the second line of the above code) fails to permit another 
portion of the code:

>>  put word 2 of whatToRemove into theLine

to properly refer to the following line of code:

>>     delete line theLine of field "users"

However, it fails -part- of the time but not all of the time; usually 
the first time it fails but immediately repeating the same handler 
makes it work. I suppose this could be a bug but I'm not sure how to 
word it in bugzilla. Perhaps I could word it as "Rev behaves in a 
inconsistent manner when presented with non-specific code", or "Stupid 
is as stupid does."   ;-)

It should be noted that there is only one field on the card so, maybe, 
Rev is doing its best to help me accomplish what I intend but fails the 
first time (but not the second) because it can't get the reference to 
the field without my help. Perhaps the second time through it can deal 
with it. Very strange (but my fault and not Rev's).

In any case, I'm using your code (put the hilitedLine of field "users" 
into whatToDelete) in place of mine and it works properly.

Many thanks!

Regards,
Barry

On Monday, Aug 4, 2003, at 23:50 America/Denver, Sarah wrote:

> From: Sarah <sarahr at genesearch.com.au>
> To: use-revolution at lists.runrev.com
> Reply-To: use-revolution at lists.runrev.com
>
> Hi Barry,
>
> My guess would be that first time through, the selectedText &
> selectedLine are not defined. Perhaps clicking the button changed the
> selection.
> Here is how I would start:
>
> put the hilitedLine of fld "users" into theLine
> put the selectedText of fld "users" into userToDelete
>
> Then ask for confirmation and if confirmed, delete line theLine of fld
> "users"
>
> Cheers,
> Sarah
>
> On Tuesday, August 5, 2003, at 02:21  am, Barry Levine wrote:
>
>> I have a handler that deletes the selected line of a list (a field
>> called "users"). However, it only seems to work the second time I run
>> it, not the first. Here's the handler:
>>
>> put the selectedText into userToDelete
>> put the selectedLine into whatToRemove
>> answer "Delete " & userToDelete & " from the student list?"  with "No"
>> or "Yes"
>>   if it is "No" then
>>     exit mouseUp
>>   else
>>     put word 2 of whatToRemove into theLine -- word 2 is the number of
>> the line
>>     delete line theLine of field "users"
>>   end if
>>
>> If I run it, nothing happens. If I run it again immediately
>> thereafter, it does work.
>>
>> Any ideas?
>>
>> Thanks,
>> Barry
>>




More information about the use-livecode mailing list