Share via

Because it does not work ?

Palma Colapietro 136 Reputation points
2021-07-10T11:47:51.443+00:00

GraphicsWindow.Show()

GraphicsWindow.LastKey = onClick

Sub onClick

T = GraphicsWindow.LastKey

If T = 1 Then
Goto Parte1
EndIf

If T = 2 Then
Goto Parte2
EndIf

EndSub

Parte1:
GraphicsWindow.ShowMessage("Premuto 1","Avviso")

Program.End()

Parte2:
GraphicsWindow.ShowMessage("Parte2","Avviso")

Program.End()

Developer technologies | Small BASIC
Developer technologies | Small BASIC

A programming language created by Microsoft that serves a stepping stone for beginners from block-based coding languages to more complex text-based languages.

0 comments No comments

2 answers

Sort by: Most helpful
  1. WhTurner 1,616 Reputation points
    2021-07-14T12:43:19.95+00:00

    General hints for clean programming :

    • do NOT use GoTo xxx , especially out of subroutines,
    • put all subroutines at the end of ther program, after the main program.

    Was this answer helpful?

    0 comments No comments

  2. WhTurner 1,616 Reputation points
    2021-07-10T17:26:30.453+00:00

    The following program works! :

    GraphicsWindow.Show()
    GraphicsWindow.KEYUP = onClick
    
    While 0=0
      Program.Delay(100)
    EndWhile
    
    Sub onClick
    
      T = GraphicsWindow.LastKey
      GraphicsWindow.DrawText(10,10,T)  ''to show the key text returned
    
      If T = "D1" Then
        GraphicsWindow.ShowMessage("Premuto 1","Avviso")
        Program.End()
      EndIf
    
      If T = "D2" Then
        GraphicsWindow.ShowMessage("Parte2","Avviso")
        Program.End()
      EndIf
    
    EndSub
    

    Was this answer helpful?

    0 comments No comments

Your answer

Answers can be marked as 'Accepted' by the question author and 'Recommended' by moderators, which helps users know the answer solved the author's problem.