Board Logo
« Timer Prompt »

Welcome Guest. Please Login or Register.
Feb 25th, 2018, 7:57pm


Conforums Terms of Service | Membership Rules | Home | Search | Recent Posts | Notification | Format Your Message | Installation FAQ


« Previous Topic | Next Topic »
Pages: 1  Notify Send Topic Print
 thread  Author  Topic: Timer Prompt  (Read 71 times)
Rod
Administrator
ImageImageImageImageImage


member is offline

Avatar

Graphics = Goosebumps!


PM

Gender: Male
Posts: 3174
xx Timer Prompt
« Thread started on: Feb 12th, 2018, 05:51am »

Ok that last instal went very smoothly, no nag screens and and a nice installation dialog. The progress bar never moved but no big deal.

Now the timer, I have to say I am not at all sure a I fully understand how to use it properly, scope mainly subs and such.

There are still two bugs that are not helping. First is that any timer statement will stop the prompt from working. In this code if the timer is set then the prompt dialog will appear and appear to take input but the program has run on beyond that and ignores the prompt input. The variable a$ is never filled.

Code:
print "program starts"
print "delay starts"
timer 2000, [delay]
wait
[delay]
timer 0
print "delay ended"
print "prompt issued"
prompt "Enter something"; a$
print "You entered: "; a$
print "Program ended"
end
 


Now the timer sub issue. dire warnings are posted all over the place about timers in subs or timer handlers as subs but Carl always posts code that works. When I try stuff it doesn't and the infamous bugtracker code crashes spectacularly still. BUT, it appears the Sub order matters.

This code is a version of Carl's demo it runs fine.

Code:
    WindowWidth = 400
    WindowHeight = 300
    textbox #demo.tb 100,100,100,20
    open "Timer Using a Sub as Event Handler" for window as #demo
    #demo "trapclose quit"
    timer 3000, updateTime
    wait

    sub updateTime
        timer 0
        #demo.tb time$()
        timer 3000, updateTime
    end sub

    sub quit handle$
        timer 0
        close #handle$
        end
    end sub


 



Now try this, move the window while it runs, beware it will crash Just BASIC, all it takes to confuse the issue is to put the quit sub above the timer sub.



Code:
    WindowWidth = 400
    WindowHeight = 300
    textbox #demo.tb 100,100,100,20
    open "Timer Using a Sub as Event Handler" for window as #demo
    #demo "trapclose quit"
    timer 3000, updateTime
    wait

    sub quit handle$
        timer 0
        close #handle$
        end
    end sub

    sub updateTime
        timer 0
        #demo.tb time$()
        timer 3000, updateTime
    end sub


 
« Last Edit: Feb 12th, 2018, 10:52am by Rod » User IP Logged

Rod
Administrator
ImageImageImageImageImage


member is offline

Avatar

Graphics = Goosebumps!


PM

Gender: Male
Posts: 3174
xx Re: Timer Prompt
« Reply #1 on: Feb 12th, 2018, 06:01am »

I also noticed that caller.bas,the first listed tutorial program, fails with bad handle "#out". Reserved word no doubt but a confusing error for a beginner to understand.
User IP Logged

Pages: 1  Notify Send Topic Print
« Previous Topic | Next Topic »

Conforums Terms of Service | Membership Rules | Home | Search | Recent Posts | Notification | Format Your Message | Installation FAQ

Just BASIC wiki
Wikispaces

Donate $6.99 for 50,000 Ad-Free Pageviews!

| |

This forum powered for FREE by Conforums ©
Sign up for your own Free Message Board today!
Terms of Service | Privacy Policy | Conforums Support | Parental Controls