Results 1 to 5 of 5

Thread: TBEM sample - SetRepeat

  1. #1
    thinBasic MVPs Michael Hartlef's Avatar
    Join Date
    Sep 2006
    Location
    Germany
    Age
    58
    Posts
    3,299
    Rep Power
    348

    TBEM sample - SetRepeat

    Here is a sample how to use the TBEM_SetRepeat command.

    [code=thinbasic]'
    ' TBEM sample script - SetRepeat
    ' Michael Hartlef
    ' October 18th, 2008

    uses "CONSOLE", "TBEM"

    dim myEvent as long
    dim sKey as string
    dim run as long value %TRUE

    'Define all event types we need.
    begin const
    %evtType1
    end const

    '**************************************************
    function tbmain()
    '**************************************************
    'Add an event
    myEvent = TBEM_AddEvent("SampleFunc",%evtType1)

    'Repeat the event 5 times once it was running the first time, each after 200 milliseconds again
    TBEM_Setrepeat( myEvent, %TRUE, 200, 5)

    'Fire a trigger to run the event for one time
    TBEM_AddTrigger(%evtType1)

    console_writeline ("Press q for quit..." + $CRLF)
    while run = %TRUE
    'Run all active events which triggers were fired
    tbem_Run()

    'Check now for a keypress
    sKey = console_inkeyb

    'if "q" key was pressed, end this script
    if sKey = "q" then run = %FALSE

    wend
    end function

    '**************************************************
    sub SampleFunc()
    '**************************************************
    static count as long

    count += 1

    console_writeline("Hello from function SampleFunc")
    console_writeline("count = " + count)

    end sub
    [/code]
    Attached Files Attached Files

  2. #2
    thinBasic author ErosOlmi's Avatar
    Join Date
    Sep 2004
    Location
    Milan - Italy
    Age
    57
    Posts
    8,817
    Rep Power
    10

    Re: TBEM sample - SetRepeat

    Hi Michael,

    I was testing this script.
    If you put 2000 ms instead of 200 you will note that last event, 6th, is fired just after the 5th without waiting 2 seconds.

    Ciao
    Eros
    www.thinbasic.com | www.thinbasic.com/community/ | help.thinbasic.com
    Windows 10 Pro for Workstations 64bit - 32 GB - Intel(R) Xeon(R) W-10855M CPU @ 2.80GHz - NVIDIA Quadro RTX 3000

  3. #3
    thinBasic MVPs Michael Hartlef's Avatar
    Join Date
    Sep 2006
    Location
    Germany
    Age
    58
    Posts
    3,299
    Rep Power
    348

    Re: TBEM sample - SetRepeat

    Hi Eros, you're right. I switched some code around. Shouldn't have done it. Right now I can't chnage it but will post a corrected version soon.

  4. #4
    thinBasic author ErosOlmi's Avatar
    Join Date
    Sep 2004
    Location
    Milan - Italy
    Age
    57
    Posts
    8,817
    Rep Power
    10

    Re: TBEM sample - SetRepeat

    Thanks Michael.
    No hurry.
    www.thinbasic.com | www.thinbasic.com/community/ | help.thinbasic.com
    Windows 10 Pro for Workstations 64bit - 32 GB - Intel(R) Xeon(R) W-10855M CPU @ 2.80GHz - NVIDIA Quadro RTX 3000

  5. #5
    thinBasic author ErosOlmi's Avatar
    Join Date
    Sep 2004
    Location
    Milan - Italy
    Age
    57
    Posts
    8,817
    Rep Power
    10

    Re: TBEM sample - SetRepeat

    Downloaded latest TBEM version and all is fine now.
    Thanks.
    www.thinbasic.com | www.thinbasic.com/community/ | help.thinbasic.com
    Windows 10 Pro for Workstations 64bit - 32 GB - Intel(R) Xeon(R) W-10855M CPU @ 2.80GHz - NVIDIA Quadro RTX 3000

Similar Threads

  1. TBEM sample - Zones
    By Michael Hartlef in forum TBEM module - thinBasic Event Manager module
    Replies: 0
    Last Post: 18-10-2008, 19:03

Members who have read this thread: 0

There are no members to list at the moment.

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •