an handler inside another...help

Namgyal Dolker dolker at gmail.com
Thu Oct 28 10:19:21 EDT 2004


Hi Gordon,

 Thanks for the idea. I got it working differently but almost in the
same direction.

I declared a global variable lineNum. Initialise that to the start of the file

Added a handler on a button to read two lines if lineNum is less than
the number of lines in the file and put that in the two fields.
Incremented the lineNum by 2.

Added another handler in a button "reset" which will put the initial
lineNum back.

Works great.

Thanks
Namgyal


On Tue, 26 Oct 2004 15:16:33 -0500, Gordon Tillman <got at mindspring.com> wrote:
> 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