locked
Bugs SB RRS feed

  • General discussion

  • Hello
    Is there a sub-forum for reporting SB computer bugs?

    The following code generates an execution error

    System.RuntimeMethodHandle.InvokeMethod(Object target, Object[] arguments, Signature sig, Boolean constructor) ...

    ancho_ventana = (1/3)*Desktop.Width
    alto_ventana = (3/4)*Desktop.Height
    centroX_ventana = (1/2)*ancho_ventana
    centroY_ventana = (1/2)*alto_ventana
    GraphicsWindow.Width = ancho_ventana
    GraphicsWindow.Height = alto_ventana
    GraphicsWindow.Top = "True"
    Turtle.PenUp()
    Turtle.Hide()
    Turtle.MoveTo(centroX_ventana,centroY_ventana)


    Thursday, September 3, 2020 4:22 PM

All replies

  • Put a Turtle.Show()  before the first turle command, then there is no crash.

    Jan [ WhTurner ] The Netherlands

    Thursday, September 3, 2020 5:04 PM
    Answerer
  • Turtle.Show()  works when making the switch, but the problem needs to be fixed.

    Another problem detected is that if the file stored with spaces "abc def.sb", [play] says that it does not compile because it is empty
    Thursday, September 3, 2020 6:24 PM
  • error is invoked by  this line:

    GraphicsWindow.Top = "True"

    it need to be a number (0 to screen-height), not boolean!

    Thursday, September 3, 2020 6:37 PM
  • It is true . There is no BUG, only that the compiler is not validating the type of variable it should contain. (improvement suggestion for a next release)

    I don't understand the following code why it returns Black, if the background is Blue

    GraphicsWindow.BackgroundColor="Blue"
    color = GraphicsWindow.GetPixel(10,10)
    GraphicsWindow.ShowMessage( color, "" )


    • Edited by CompSystems Saturday, September 12, 2020 6:18 AM
    Saturday, September 12, 2020 6:18 AM
  • background is not color layer, so u must fill all screen b4 with a color rect:

    GraphicsWindow.brushcolor="blue

    GraphicsWindow.fillrectangle(0 0 GraphicsWindow.width GraphicsWindow.height)

    otherwise u can use LDGraphicsWindow.GetPixel is much faster and returns any layer color, even shapes.
    • Edited by Tryhest Saturday, September 12, 2020 8:25 AM
    Saturday, September 12, 2020 8:23 AM
  • Hello

    Now understand, but I think there is a problem detecting the layer color, by default it is BLACK color, this prevents detecting a BLACK color shape, please replace the sentence

    GraphicsWindow.brushcolor = "#FF6B8E23" 'OLIVEDRAB

    to

    GraphicsWindow.brushcolor = "Black"

    with the cursor keys it always shows BLACK color, and all the parts of the window area

    GraphicsWindow.Title = "Layer Color"
    
    GraphicsWindow.brushcolor = "#FF6B8E23" 'OLIVEDRAB "Black"
    centerX=GraphicsWindow.width/2
    centerY=GraphicsWindow.height/2
    x=centerX
    y=centerY
    GraphicsWindow.fillrectangle(0, 0, x, y)
    
    GraphicsWindow.PenColor = "Blue"
    GraphicsWindow.brushcolor = "Yellow"
    circle1=Shapes.AddEllipse(30,30)
    Shapes.Move(circle1,x,y)
    
    GraphicsWindow.brushcolor = "Red"
    text1=Shapes.AddText("Layer Color")
    Shapes.Move(text1,centerX+10,10)
    
    GraphicsWindow.KeyDown = scanKeys
    Sub scanKeys
      LastKey = GraphicsWindow.LastKey
      If LastKey = "Left" Then
        x=x-1
        Shapes.Move(circle1,x,y)
        getColor()
      ElseIf LastKey = "Up" Then
        y=y-1
        Shapes.Move(circle1,x,y)
        getColor()
      ElseIf LastKey = "Right" Then
        x=x+1
        Shapes.Move(circle1,x,y)
        getColor()
      ElseIf LastKey = "Down" Then
        y=y+1
        Shapes.Move(circle1,x,y)
        getColor()
      EndIf
      GraphicsWindow.Title=  "X= " + Shapes.GetLeft(circle1) + "  Y= " + Shapes.GetTop(circle1)
    EndSub
    
    Sub getColor
      color = GraphicsWindow.GetPixel(x,y)
      color = "R:"+Text.GetSubText(color,2,2) + " G:"+Text.GetSubText(color,4,2) + " B:"+Text.GetSubText(color,6,2)
      Shapes.SetText(text1,color)
    EndSub


    • Edited by CompSystems Saturday, September 12, 2020 4:26 PM
    Saturday, September 12, 2020 4:24 PM
  • difference between

    color = GraphicsWindow.GetPixel(x,y)

    and

    color = LDGraphicsWindow.GetPixel(x,y)

    Saturday, September 12, 2020 6:38 PM
  • Use LDGraphicsWindow.Getpixel to get the color of bacjground, drawings and shapes.

    Jan [ WhTurner ] The Netherlands

    Sunday, September 13, 2020 12:39 PM
    Answerer
  • Hi CompSystems, I could confirmed that following program shows Exception has been thrown error.

    Turtle.Hide()
    Turtle.MoveTo(100, 100)

    I also confirmed SB 1.0 and 1.2 have this issue.  So, I will file this issue in the following TechNet Wiki article.  Thanks for your report.

    Microsoft Small Basic v1.0: Known Issues


    Nonki Takahashi

    Monday, September 21, 2020 7:10 AM
  • Hello Nonki, sorry for my bad english

    The following code also generates a problem
    To reproduce the error, click quickly on the graph window, then scroll in the text window, then return to the graph window.

    GraphicsWindow.MouseMove = mouse_move
    Sub mouse_move
      mouse_posX = GraphicsWindow.MouseX
      mouse_posY = GraphicsWindow.MouseY
      GraphicsWindow.Title = "mouse_posX =" + mouse_posX + ", mouse_posY =" + mouse_posY
    EndSub
    
    GraphicsWindow.MouseDown = clic_mouse
    Sub clic_mouse
      TextWindow.WriteLine( Mouse.IsLeftButtonDown )
    EndSub
    
    GraphicsWindow.MouseUp = clic_up
    Sub clic_up
      TextWindow.WriteLine( "up" )
    EndSub


    Wednesday, September 30, 2020 2:22 PM
  • To reproduce the error, click quickly on the graph window, then scroll in the text window, then return to the graph window.

    And what's the problem? Everything looks fine, except that the first "Up" is missing when creating the text window.
    Wednesday, September 30, 2020 3:14 PM
  • Hi CompSystems, events MouseMove, MouseDown, and MouseUp happen only when the mouse pointer is on the GraphicsWindow and the GraphicsWindow has its input focus.   After TextWindow comes up, the input focus moves to the TextWindow.  So sometimes "up" may lost.

    Nonki Takahashi

    Monday, October 5, 2020 5:21 AM