Showing results 1 to 2 of 2

Thread: Running VariableChange Events

  1. #1
    Join Date

    Default Running VariableChange Events

    [Zenon Editor 6.51]

    I have a problem when I call a function from a VariableChange Event;

    The function I'm calling executed a CMD prompt to start a f.t.p. download. This process takes a few seconds to complete.
    And thus the function has to wait (while loop) for it's result to show back to the runtime.

    Calling this function via an object element (e.g. button) allows the runtime to continue running properly.
    But when this function is called via the VariableChange the runtime freezes for that duration.

    It seems like functions executed via an element runs like a backgroundtask (no GUI interrupt) and function executed via VariableChange runs like forgroundtask (GUI interrupt).
    Am I correct in this assumption and is there a way for the VariableChange event to be run like a background task, in other words not impede the runtime while executing?

    Many thanks (again) in advance,

  2. #2

    Default Re: Running VariableChange Events

    Hi Mitchel,

    You are correct in your assumption, that anything executed in event handlers of the API is blocking the main execution of the runtime. Any action that requires more time should therefore be executed in its own thread. Unfortunately, VBA is not suited for this task as it does not support multi-threading in this sense. What you could do, is set a variable value to "1" in the change event and react to the value "1" with a regular limit that executes a zenon function.

    Note, that a function that executes a VBA macro which requires more time to complete, does not directly block the main execution of the runtime, but it will block other functions in the same function queue.

    In newer versions, the zenon logic runtime provides function blocks to act as an FTP client.

    Best regards,

Similar Threads

  1. Replies: 0
    Last Post: 13th November 2014, 12:08
  2. Scripting On client not running
    By bigred44 in forum zenon Supervisor
    Replies: 1
    Last Post: 13th September 2013, 00:25
  3. Segregation of System events and Process events
    By in forum zenon Supervisor
    Replies: 1
    Last Post: 25th February 2012, 00:54
  4. VariableChange old value
    By brc in forum VBA
    Replies: 2
    Last Post: 25th October 2011, 10:47
  5. A code which is running everytime
    By kinoxy in forum VSTA
    Replies: 2
    Last Post: 24th March 2011, 21:01

Posting Rules

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