an handler inside another...help

Gordon Tillman got at mindspring.com
Tue Oct 26 16:16:33 EDT 2004


Hi Namgyal,

This should be no problem:

> When a button is pressed, it will parse through the text file, read
> two lines and put that in the two fields irrespectively. It will then
> wait for a certain time and then read the next two lines and put that
> to the two fields overwriting the previous content. Hence I am using
> only one card and displaying it like a slide show.
>
> It is working fine except that I want the wait not to be limited to
> any time but to an event trigger. Like if there is another button(or
> the same button) which when clicked will resume the file parsing.

Put all of your handlers that interact with this text file into the 
same script file.
Define a script-level local variable at the top, like this:

local sFilePath

Have one handler that initializes sFilePath and opens it.

Have another handler that reads two lines from sFilePath every time the 
user clicks on a button.  Of course, in this second handler once it 
hits EOF or whatever, it can then close sFilePath and update your GUI 
as necessary.

--gordon



More information about the use-livecode mailing list