locked
Why does this work like this? RRS feed

  • Question

  • In the snippet below there is a textwindow.read function to stop the code after the graphicswindow.fillrectangle command.  Notice that by stopping at this point the window the rectangle doesn't show although the command has been completed.  Why does it work like that?  I would think if you do the command that it would show immediately, but it doesn't.  It shows after the sub is completed. 

    GraphicsWindow.show()

    Controls.buttonclicked=onclickedbutton
    Controls.AddButton("MyButton",0,0)
    while "True"
    Program.Delay(100)
    endwhile

    Sub OnClickedButton
      GraphicsWindow.BrushColor = "Yellow"
      GraphicsWindow.FillRectangle(0, 200, GraphicsWindow.Width, 30)
      TextWindow.Read()
    EndSub 'OnClickedButton


    JR

    Tuesday, June 18, 2013 6:34 PM
    Answerer

Answers

  • Probably because the graphics get updated only when the event subroutine ends.

    This is due to the way events are handled on separate threads - the rule is to keep event subroutines short and non-interactive i.e. they return quickly after starting.

    Tuesday, June 18, 2013 6:42 PM