none
Variable in front of the Graphicswindow. RRS feed

  • Question

  • How do you add a variable in front of the Graphicswindow object? Like: text1 = Graphicswindow.AddText(......)

    Tuesday, May 30, 2017 9:54 PM

Answers

  • GraphicsWIndow.DrawText doesn't have a return value - it just draws the text and there is nothing further that can be done with it - it is not a shape that can be moved, rotated or even deleted (without over drawing it or GraphicsWindow.Clear()).

    See this wiki article for more info.

    Wednesday, May 31, 2017 5:33 PM
    Moderator

All replies

  • Hi Leon,

    Some methods return a value, there is no method GraphicsWindow.AddText.

    There is a Shapes.AddText which has the text as an argument and returns the name of the generated text shape.  The return value can be used to identify the text shape in other methods.

    Example below shows how to add and manipulate a text shape.  In this example, the contents of the return value is set in a variable called myTextShape and is set by SB to identify the shape in other methods to control it.

    myTextShape = Shapes.AddText("Hello World")
    GraphicsWindow.Title = "MyTextShape is internally labelled "+myTextShape
    Program.Delay(1000)
    Shapes.Move(myTextShape,100,100)
    Program.Delay(1000)
    Shapes.Zoom(myTextShape,3,3)
    Program.Delay(1000)
    Shapes.Rotate(myTextShape,45)
    Program.Delay(1000)
    Shapes.SetOpacity(myTextShape,50)
    Program.Delay(1000)
    Shapes.Animate(myTextShape,200,200,1000)
    Perhaps share the program you are working on and specific issues about what you want it to do.

    Tuesday, May 30, 2017 10:09 PM
    Moderator
  • Thanks but, what if you type : variable = Graphicswindow.DrawText("..........")
    Wednesday, May 31, 2017 12:05 AM
  • GraphicsWIndow.DrawText doesn't have a return value - it just draws the text and there is nothing further that can be done with it - it is not a shape that can be moved, rotated or even deleted (without over drawing it or GraphicsWindow.Clear()).

    See this wiki article for more info.

    Wednesday, May 31, 2017 5:33 PM
    Moderator