Small BASIC 1.2


Este interprete de BASIC esta desarrollado por Microsoft. Tiene un entorno muy sencillo. Dispone de un completo manual en Español de 82 paginas. Es gratuito. Hay cientos de programas de ejemplo en la web de Microsoft. Esta disponible en un montón de idiomas. Tiene mucho soporte. Realmente vale la pena probarlo. Permite exportar el código a Visual BASIC.
Dispone de muchas extensiones que lo complementan, por ejemplo Oculus RV, Lego Mindstorms...
En pocas palabras un soporte fuera de lo normal. Se nota que esta detrás Microsoft.














p = 0

GraphicsWindow.CanResize = 0
GraphicsWindow.Width = 260
GraphicsWindow.Height = 230
GraphicsWindow.Title = "Calculator v. 1.0 by Alex_2000"

GraphicsWindow.BackgroundColor = GraphicsWindow.GetColorFromRGB(240, 240, 240)
GraphicsWindow.FontBold = "False"
GraphicsWindow.BrushColor = "Black"

m = Shapes.AddText("M")
Shapes.Move(m, 22, 62)
Shapes.HideShape(m)

t = Controls.AddTextBox(10, 10)
Controls.SetSize(t, 240, 22)
Controls.SetTextBoxText(t, "")

GraphicsWindow.BrushColor = "Red"
keyMC = Controls.AddButton("MC", 10, 95)
Controls.SetSize(keyMC, 35, 25)
keyMR = Controls.AddButton("MR", 10, 128)
Controls.SetSize(keyMR, 35, 25)
keyMS = Controls.AddButton("MS", 10, 161)
Controls.SetSize(keyMS, 35, 25)
keyMP = Controls.AddButton("M+", 10, 194)
Controls.SetSize(keyMP, 35, 25)
keyC = Controls.AddButton("C", 202, 58)
Controls.SetSize(keyC, 55, 25, )
keyCE = Controls.AddButton("CE", 139, 58)
Controls.SetSize(keyCE, 55, 25)
keyBackspase = Controls.AddButton("Backspase", 58, 58)
Controls.SetSize(keyBackspase, 70, 25)
keydelenie = Controls.AddButton("/", 181, 95)
Controls.SetSize(keydelenie, 35, 25)
keyumnogenie = Controls.AddButton("*", 181, 128)
Controls.SetSize(keyumnogenie, 35, 25)
keyminus = Controls.AddButton("-", 181, 161)
Controls.SetSize(keyminus, 35, 25)
keyplus = Controls.AddButton("+", 181, 194)
Controls.SetSize(keyplus, 35, 25)
keyravno = Controls.AddButton("=", 222, 194)
Controls.SetSize(keyravno, 35, 25)




GraphicsWindow.BrushColor = "Blue"
key7 = Controls.AddButton("7", 58, 95)
Controls.SetSize(key7, 35, 25)
key8 = Controls.AddButton("8", 99, 95)
Controls.SetSize(key8, 35, 25)
key9 = Controls.AddButton("9", 140, 95)
Controls.SetSize(key9, 35, 25)
key4 = Controls.AddButton("4", 58, 128)
Controls.SetSize(key4, 35, 25)
key5 = Controls.AddButton("5", 99, 128)
Controls.SetSize(key5, 35, 25)
key6 = Controls.AddButton("6", 140, 128)
Controls.SetSize(key6, 35, 25)
key1 = Controls.AddButton("1", 58, 161)
Controls.SetSize(key1, 35, 25)
key2 = Controls.AddButton("2", 99, 161)
Controls.SetSize(key2, 35, 25)
key3 = Controls.AddButton("3", 140, 161)
Controls.SetSize(key3, 35, 25)
key0 = Controls.AddButton("0", 58, 194)
Controls.SetSize(key0, 35, 25)
keyplusminus = Controls.AddButton("+/-", 99, 194)
Controls.SetSize(keyplusminus, 35, 25)
keytochka = Controls.AddButton(".", 140, 194)
Controls.SetSize(keytochka, 35, 25)
keysqrt = Controls.AddButton("sgrt", 222, 95)
Controls.SetSize(keysqrt, 35, 25)
keyprocent = Controls.AddButton("%", 222, 128)
Controls.SetSize(keyprocent, 35, 25)
keynax = Controls.AddButton("1/x", 222, 161)
Controls.SetSize(keynax, 35, 25)

Controls.ButtonClicked = click

Sub click
  Sound.PlayClick()
  If Controls.LastClickedButton = key0 Then
    Controls.SetTextBoxText(t, Text.Append(Controls.GetTextBoxText(t), "0"))
  ElseIf Controls.LastClickedButton = key1 Then
    Controls.SetTextBoxText(t, Text.Append(Controls.GetTextBoxText(t), "1"))
  ElseIf Controls.LastClickedButton = key2 Then
    Controls.SetTextBoxText(t, Text.Append(Controls.GetTextBoxText(t), "2"))
  ElseIf Controls.LastClickedButton = key3 Then
    Controls.SetTextBoxText(t, Text.Append(Controls.GetTextBoxText(t), "3"))
  ElseIf Controls.LastClickedButton = key4 Then
    Controls.SetTextBoxText(t, Text.Append(Controls.GetTextBoxText(t), "4"))
  ElseIf Controls.LastClickedButton = key5 Then
    Controls.SetTextBoxText(t, Text.Append(Controls.GetTextBoxText(t), "5"))
  ElseIf Controls.LastClickedButton = key6 Then
    Controls.SetTextBoxText(t, Text.Append(Controls.GetTextBoxText(t), "6"))
  ElseIf Controls.LastClickedButton = key7 Then
    Controls.SetTextBoxText(t, Text.Append(Controls.GetTextBoxText(t), "7"))
  ElseIf Controls.LastClickedButton = key8 Then
    Controls.SetTextBoxText(t, Text.Append(Controls.GetTextBoxText(t), "8"))
  ElseIf Controls.LastClickedButton = key9 Then
    Controls.SetTextBoxText(t, Text.Append(Controls.GetTextBoxText(t), "9"))
  ElseIf Controls.LastClickedButton = keytochka Then
    Controls.SetTextBoxText(t, Text.Append(Controls.GetTextBoxText(t), "."))
  ElseIf Controls.LastClickedButton = keyplusminus Then
    If p = 0 Then
      Controls.SetTextBoxText(t, Text.Append("-", Controls.GetTextBoxText(t)))
      p = 1
    Else
      Controls.SetTextBoxText(t, Math.Abs(Controls.GetTextBoxText(t)))
      p = 0
    EndIf
  ElseIf Controls.LastClickedButton = keyplus Then
    a = Controls.GetTextBoxText(t)
    Controls.SetTextBoxText(t, "")
    знак = "+"
  ElseIf Controls.LastClickedButton = keyminus Then
    a = Controls.GetTextBoxText(t)
    Controls.SetTextBoxText(t, "")
    знак = "-"
  ElseIf Controls.LastClickedButton = keyumnogenie Then
    a = Controls.GetTextBoxText(t)
    Controls.SetTextBoxText(t, "")
    знак = "*"
  ElseIf Controls.LastClickedButton = keydelenie Then
    a = Controls.GetTextBoxText(t)
    Controls.SetTextBoxText(t, "")
    знак = "/"
  ElseIf Controls.LastClickedButton = keysqrt Then
    Controls.SetTextBoxText(t, Math.SquareRoot(Controls.GetTextBoxText(t)))
  ElseIf Controls.LastClickedButton = keynax Then
    Controls.SetTextBoxText(t, 1/Controls.GetTextBoxText(t))
  ElseIf Controls.LastClickedButton = keyC Then
    a = ""
    b = ""
    Controls.SetTextBoxText(t, "")
  ElseIf Controls.LastClickedButton = keyCE Then
    Controls.SetTextBoxText(t, "")
  ElseIf Controls.LastClickedButton = keyBackspase Then
    Controls.SetTextBoxText(t, Text.GetSubText(Controls.GetTextBoxText(t), 1, Text.GetLength(Controls.GetTextBoxText(t))-1))
  ElseIf Controls.LastClickedButton = keyMP Or Controls.LastClickedButton = keyMS Then
    c = Controls.GetTextBoxText(t)
    Shapes.ShowShape(m)
  ElseIf Controls.LastClickedButton = keyMC Then
    c = ""
    Shapes.HideShape(m)
  ElseIf Controls.LastClickedButton = keyMR Then
    Controls.SetTextBoxText(t, c)
  ElseIf Controls.LastClickedButton = keyprocent Then
    Controls.SetTextBoxText(t, (a * Controls.GetTextBoxText(t))/100)
  ElseIf Controls.LastClickedButton = keyravno Then
    b = Controls.GetTextBoxText(t)
    If знак = "+" Then
      Controls.SetTextBoxText(t, a + b)
    ElseIf знак = "-" Then
      Controls.SetTextBoxText(t, a - b)
    ElseIf знак = "*" Then
      Controls.SetTextBoxText(t, a * b)
    ElseIf знак = "/" Then
      If b = 0 Then
        Controls.SetTextBoxText(t, "Divide by zero is impossible!")
      Else
        Controls.SetTextBoxText(t, a / b)
      EndIf
    EndIf
  EndIf
EndSub





http://smallbasic.com/

https://www.microsoft.com/es-es/download/confirmation.aspx?id=46392

https://blogs.msdn.microsoft.com/smallbasic/

https://blogs.msdn.microsoft.com/smallbasic/2013/02/17/small-basic-program-gallery-listed-by-category/

http://social.technet.microsoft.com/wiki/contents/articles/17553.wiki-small-basic-portal.aspx


No hay comentarios:

Publicar un comentario

Nota: solo los miembros de este blog pueden publicar comentarios.