none
How much time has passed? RRS feed

  • Question

  • Hello, I am a beginner and I'm having a lot of fun playing around with this thing. I have a few questions and would be happy if you could answer them:

    Is there a way to place text on a graphic window? How do you do it?

    How can you tell how much time has passed since an event? I tried playing around with setting hours, minutes and seconds as variable before the event and after that subtract the actual time from that, but it doesn't work work very well. Let's say I started a loop at 9:59:48 and after two minutes the time is 10:01:48.

    I can't simply subtract the minutes or hours in this example. How could I do this? Any ideas? Thank you very much!
    Monday, May 18, 2009 9:38 PM

Answers

  • There are two ways to place text on a GraphicsWindow,

    GraphicsWindow.DrawBoundText(x,y,width,text)
    GraphicsWindow.DrawText(x,y,text)

    GraphicsWindow.DrawBoundText() is the same as GraphicsWindow.DrawText() except that it restricts the width available to the text on screen and causes the text to wrap if necessary.

    Probably the easiest way to work with time differences is to use something like

    time1 = Clock.Millisecond
    For i = 1 To 100000
    EndFor
    time2 = Clock.Millisecond
    TextWindow.WriteLine(time2-time1)

    By working in milliseconds you can always convert to seconds , minutes etc. by dividing by the relevant factor.
    Monday, May 18, 2009 10:07 PM

All replies

  • There are two ways to place text on a GraphicsWindow,

    GraphicsWindow.DrawBoundText(x,y,width,text)
    GraphicsWindow.DrawText(x,y,text)

    GraphicsWindow.DrawBoundText() is the same as GraphicsWindow.DrawText() except that it restricts the width available to the text on screen and causes the text to wrap if necessary.

    Probably the easiest way to work with time differences is to use something like

    time1 = Clock.Millisecond
    For i = 1 To 100000
    EndFor
    time2 = Clock.Millisecond
    TextWindow.WriteLine(time2-time1)

    By working in milliseconds you can always convert to seconds , minutes etc. by dividing by the relevant factor.
    Monday, May 18, 2009 10:07 PM
  • Thanks! That's what I was looking for. Thanks again!
    Tuesday, May 19, 2009 2:05 AM