I have a form designated as primary in which I start a UTimer and it runs perfectly using something like:

Activate "UTimer".Start("00.00.01")

Activate "UTimer".SetMessage($ComponentName, <ksAsynchTimerMessageId>, "")

Activate "UTimer".SetRepeat(0)

A button on this form activates another form as Normal/Modal,Attached.  I need another UTimer on the activated form so I can process data in real time but when I attempt to start another timer using a similar syntax as above, it does not work and it "breaks" the already running UTimer.  If I invoke the form by itself, it works as expected.

I've tried to scope the UTimer to the 2nd component but the Asynch Trigger still does not fire but at least it does not "break" the calling forms' UTimer.

By "break" I mean the Asynch Trigger no longer fires on the first form, either in the background or foreground when the secondary form is closed.

    CommentAdd your comment...

    2 answers


      You have to do a new instance of the utimer so it gives it a different handle to manage. Hope this helps.

      1. Rob Maciok

        I did try a new instance scoped to the component (2nd paragraph) and it helped but didn't work completely.

      2. Daniel Iseli

        Rob, I'm not sure if you've really done what Larry explained.

        This is what he has in mind:

        ; Form1:

        newinstance "UTimer", "UTimer1"
        Activate "UTimer1".Start("00.00.01")
        Activate "UTimer1".SetMessage($InstanceName, <ksAsynchTimerMessageId>, "")
        ; e.g. $instancename = "Form1"
        Activate "UTimer1".SetRepeat(0)

        ; Form2:

        newinstance "UTimer", "UTimer2"
        Activate "UTimer2".Start("00.00.01")
        Activate "UTimer2".SetMessage($InstanceName, <ksAsynchTimerMessageId>, "")
        ; e.g. $instancename = "Form2"
        Activate "UTimer2".SetRepeat(0)

        And please make sure that you stop the UTimer instance once you close the "connected" component. Otherwise UTimer will still send messages that cannot be delivered since the target (instance) is gone.

        Hope this helps.

      3. Rob Maciok


          Thanx for the input.  Unfortunately, this does not work.  Must be the layout of the 2nd form.  If I invoke the 2nd form by itself, it works fine, but if I activate it from the 1st form the Async trigger never fires.  I'll  have to use a different approach.

      4. Daniel Iseli

        Are you using "run" by any chance? This could explain why the UTimer does not work (there's no instance when "run" is used).

        Otherwise I currently would not why this should not work. I did a quick test of the described scenario and the two UTimer instances are just working fine (i.e. the Async trigger is fired as expected).

      5. Rob Maciok

        Not using run.  Using activate.  When I try this on 2 new test forms it works perfectly.  We have a customized underlying framework that, while powerful and helpful, sometimes "gets in the way."

      6. Iain Sharp

        So, what is the window type and attachment of the second form (modal attached?) Not just how it is defined, but how it is activated? 

      CommentAdd your comment...

      Hi Rob,

      I never tried your exact configuration and IMHO should work...
      I am sure two UTimer instances from same component must work because I've seen them working at customer site on U96; I should still have somewhere the example I've provided to them.
      Could you try to start two UTimer in your main component and when the second one is activated call an operation on the secondary component?

      Hope it helps...


        CommentAdd your comment...