none
I need a lot of help please RRS feed

  • Question

  • Start:
    GraphicsWindow.Title = "Caltionary"
    GraphicsWindow.CanResize = "false"
    GraphicsWindow.BrushColor = "red"
    GraphicsWindow.Show()
    GraphicsWindow.Width = "1000"
    GraphicsWindow.Height = "300"
    GraphicsWindow.BrushColor = "green"
    DictionaryButton = Controls.AddButton("Dictionary",50,10)
    GraphicsWindow.BrushColor = "blue"
    CalculatorButton = Controls.AddButton("Calculator",150,10)
    GraphicsWindow.BrushColor = "Purple"
    NotePadButton = Controls.AddButton("Notepad",250,10)
    GraphicsWindow.BrushColor = "Black"
    IP = Controls.AddButton("Ip?",350,10)
    GraphicsWindow.BrushColor = "red"
    EndProgram = Controls.AddButton("Exit",120,50)
      i = Controls.LastClickedButton 
      Controls.ButtonClicked = OnButtonClicked
    Sub OnButtonClicked
       IF Controls.LastClickedButton = Getdef Then
          i = Controls.GetTextBoxText(Defword)
          x = Dictionary.GetDefinition(i)
          Controls.SetTextBoxText(Definition,x)
           Endif
           
           If Controls.LastClickedButton = DictionaryButton Then
             GraphicsWindow.Clear()
             GraphicsWindow.BrushColor = "green"
             options = Controls.AddButton("Options",500,10)
             GraphicsWindow.Width = 1100
             GraphicsWindow.Height = 700
             Getdef = Controls.AddButton("Find Definition",270,100)
             Defword = Controls.AddTextBox(100,100)
             Definition = Controls.AddMultiLineTextBox(100,200)
      Controls.SetSize(Definition,900,400)
    EndIf
    If Controls.LastClickedButton = options Then
      GraphicsWindow.Clear()
    GraphicsWindow.Title = "Caltionary"
    GraphicsWindow.CanResize = "false"
    GraphicsWindow.BrushColor = "red"
    GraphicsWindow.Show()
    GraphicsWindow.Width = "500"
    GraphicsWindow.Height = "300"
    GraphicsWindow.BrushColor = "green"
    DictionaryButton = Controls.AddButton("Dictionary",50,10)
    GraphicsWindow.BrushColor = "blue"
    CalculatorButton = Controls.AddButton("Calculator",150,10)
    GraphicsWindow.BrushColor = "Purple"
    NotePadButton = Controls.AddButton("Notepad",250,10)
    GraphicsWindow.BrushColor = "red"
    EndProgram = Controls.AddButton("Exit",120,50)
        EndIf
    If Controls.LastClickedButton = CalculatorButton Then
      GraphicsWindow.Height = "700"
      GraphicsWindow.Width = "1100"
      GraphicsWindow.BrushColor = "Blue"
      GraphicsWindow.Clear()
      options = Controls.AddButton("Options",500,10)
      GraphicsWindow.DrawBoundText(10,100,100,"First Number: ")
      GraphicsWindow.DrawBoundText(10,150,200,"Operation: ") 
      GraphicsWindow.DrawBoundText(10,200,100,"Second Number: ")
      GraphicsWindow.DrawBoundText(10,300,100,"Answer: ")
      Num1Box = Controls.AddTextBox(200,95)
      OppBox = Controls.AddTextBox(200,145)
      Num2Box = Controls.AddTextBox(200,195)
      CalAnswerBox = Controls.AddTextBox(200,295)
      GetCalAnswer = Controls.AddButton("Enter",250,250)
      CalClear = Controls.AddButton("Clear",250,350)
      CalAdd = Controls.AddButton("+",400,145)
      CalSub = Controls.AddButton("-",450,145)
      CalMul = Controls.AddButton("*",500,145)
      CalDiv = Controls.AddButton("/",550,145)
    EndIf
    If Controls.LastClickedButton = CalAdd Then
      Opp = "+"
      Controls.SetTextBoxText(OppBox,"+")
    EndIf
    If Controls.LastClickedButton = CalSub Then
      Opp = "-"
      Controls.SetTextBoxText(OppBox,"-")
    EndIf
    If Controls.LastClickedButton = CalMul Then
      Opp = "*"
      Controls.SetTextBoxText(OppBox,"*")
    EndIf
    If Controls.LastClickedButton = CalDiv Then
      Opp = "/"
      Controls.SetTextBoxText(OppBox,"/")
     EndIf
    If Controls.LastClickedButton = GetCalAnswer Then
      Num1 = Controls.GetTextBoxText(Num1Box)
      Num2 = Controls.GetTextBoxText(Num2Box)
      Opp = Controls.GetTextBoxText(OppBox)
      
      If Opp = "+" Then
        Num3 = Num1 + Num2
        Controls.SetTextBoxText(CalAnswerBox,Num3)
      EndIf
      If Opp = "-" Then
        Num3 = Num1 - Num2
        Controls.SetTextBoxText(CalAnswerBox,Num3)
      EndIf
      If Opp = "*" Then
        Num3 = Num1 * Num2
        Controls.SetTextBoxText(CalAnswerBox,Num3)
      EndIf
      If Opp = "/" Then
        Num3 = Num1 / Num2
        Controls.SetTextBoxText(CalAnswerBox,Num3)
        EndIf
      EndIf
      If Controls.LastClickedButton = CalClear Then
        Controls.SetTextBoxText(Num1Box,"")
        Controls.SetTextBoxText(Num2Box,"")
        Controls.SetTextBoxText(CalAnswerBox,"")
        Controls.SetTextBoxText(OppBox,"")
        EndIf
    If Controls.LastClickedButton = EndProgram Then
      Program.End()
      EndIf
    
    EndSub
    Controls.ButtonClicked = OnButtonClick
    Sub OnButtonClick
    If Controls.LastClickedButton = NotePadButton Then
      GraphicsWindow.Clear()
     GraphicsWindow.BackgroundColor = "Black"
    Box[1] = Controls.AddTextBox(375, 50)
    Controls.SetTextBoxText(Box[1], "Title")
    Box[2] = Controls.AddTextBox(375, 100)
    Controls.SetSize(Box[2], 160, 20)
    Controls.SetTextBoxText(Box[2], "Date")
    Box[3] = Controls.AddMultiLineTextBox(250, 150)
    Controls.SetSize(Box[3], 400, 300)
    Controls.SetTextBoxText(Box[3], "Notes")
    EndIf
    EndSub
    Controls.ButtonClicked = ShowMyIp
    Sub ShowMyIp
    If Controls.LastClickedButton = IP Then
      GraphicsWindow.Hide()
      TextWindow.Show()
      HostIP = Hardware.IP
     Textwindow.writeline(HostIP)
    EndIF
    EndSub
    

    I have this code and I for some reason the buttons won't work can anyone help me fix this! P.S. With bug fixes in the regular code!

    Thanks!

    Tuesday, March 27, 2012 1:40 AM

Answers

  • Try this. You'd better use Controls.GetButtonCaption

    GraphicsWindow.Title = "Caltionary"
    GraphicsWindow.CanResize = "false"
    GraphicsWindow.BrushColor = "red"
    GraphicsWindow.Show()
    GraphicsWindow.Width = "1000"
    GraphicsWindow.Height = "300"
    GraphicsWindow.BrushColor = "green"
    DictionaryButton = Controls.AddButton("Dictionary",50,10)
    GraphicsWindow.BrushColor = "blue"
    CalculatorButton = Controls.AddButton("Calculator",150,10)
    GraphicsWindow.BrushColor = "Purple"
    NotePadButton = Controls.AddButton("Notepad",250,10)
    GraphicsWindow.BrushColor = "Black"
    IP = Controls.AddButton("Ip?",350,10)
    GraphicsWindow.BrushColor = "red"
    EndProgram = Controls.AddButton("Exit",120,50)

    Controls.ButtonClicked = OnButtonClicked
     
    Sub OnButtonClicked
     cap= Controls.GetButtonCaption(Controls.LastClickedButton)
      IF cap = "Dictionary" Then
             GraphicsWindow.Clear()
             GraphicsWindow.BrushColor = "green"
             options = Controls.AddButton("Options",500,10)
             GraphicsWindow.Width = 1100
             GraphicsWindow.Height = 700
             Getdef = Controls.AddButton("Find Definition",270,100)
             Defword = Controls.AddTextBox(100,100)
             Definition = Controls.AddMultiLineTextBox(100,200)
             Controls.SetSize(Definition,900,400)
      ElseIf  cap="Find Definition" Then     
            i = Controls.GetTextBoxText(Defword)
            x = Dictionary.GetDefinition(i)
            Controls.SetTextBoxText(Definition,x)
      elseif cap="Options" then     
            GraphicsWindow.Clear()
            GraphicsWindow.Title = "Caltionary"
            GraphicsWindow.CanResize = "false"
            GraphicsWindow.BrushColor = "red"
            GraphicsWindow.Show()
            GraphicsWindow.Width = "500"
            GraphicsWindow.Height = "300"
            GraphicsWindow.BrushColor = "green"
            DictionaryButton = Controls.AddButton("Dictionary",50,10)
            GraphicsWindow.BrushColor = "blue"
            CalculatorButton = Controls.AddButton("Calculator",150,10)
            GraphicsWindow.BrushColor = "Purple"
            NotePadButton = Controls.AddButton("Notepad",250,10)
            GraphicsWindow.BrushColor = "red"
            EndProgram = Controls.AddButton("Exit",120,50)
       
      elseIf cap="Calculator" Then
            GraphicsWindow.Height = "700"
            GraphicsWindow.Width = "1100"
            GraphicsWindow.BrushColor = "Blue"
            GraphicsWindow.Clear()
            options = Controls.AddButton("Options",500,10)
            GraphicsWindow.DrawBoundText(10,100,100,"First Number: ")
            GraphicsWindow.DrawBoundText(10,150,200,"Operation: ")
            GraphicsWindow.DrawBoundText(10,200,100,"Second Number: ")
            GraphicsWindow.DrawBoundText(10,300,100,"Answer: ")
            Num1Box = Controls.AddTextBox(200,95)
            OppBox = Controls.AddTextBox(200,145)
            Num2Box = Controls.AddTextBox(200,195)
            CalAnswerBox = Controls.AddTextBox(200,295)
            GetCalAnswer = Controls.AddButton("Enter",250,250)
            CalClear = Controls.AddButton("Clear",250,350)
            CalAdd = Controls.AddButton("+",400,145)
            CalSub = Controls.AddButton("-",450,145)
            CalMul = Controls.AddButton("*",500,145)
            CalDiv = Controls.AddButton("/",550,145)

          elseIf cap="+" Then
             Opp = "+"
             Controls.SetTextBoxText(OppBox,"+")
          elseif cap="-" Then
             Opp = "-"
             Controls.SetTextBoxText(OppBox,"-")
          elseIf cap="*" Then
             Opp = "*"
             Controls.SetTextBoxText(OppBox,"*")
          elseIf cap="/" Then
             Opp = "/"
             Controls.SetTextBoxText(OppBox,"/")
           elseif cap="Enter" Then
             Num1 = Controls.GetTextBoxText(Num1Box)
             Num2 = Controls.GetTextBoxText(Num2Box)
             Opp = Controls.GetTextBoxText(OppBox)
             If Opp = "+" Then
                Num3 = Num1 + Num2
                Controls.SetTextBoxText(CalAnswerBox,Num3)
             elseIf Opp = "-" Then
                Num3 = Num1 - Num2
                Controls.SetTextBoxText(CalAnswerBox,Num3)
             elseIf Opp = "*" Then
                Num3 = Num1 * Num2
                Controls.SetTextBoxText(CalAnswerBox,Num3)
             elseIf Opp = "/" Then
                Num3 = Num1 / Num2
                Controls.SetTextBoxText(CalAnswerBox,Num3)
             EndIf
      elseIf cap = "Clear" Then
             Controls.SetTextBoxText(Num1Box,"")
             Controls.SetTextBoxText(Num2Box,"")
             Controls.SetTextBoxText(CalAnswerBox,"")
             Controls.SetTextBoxText(OppBox,"")
      elseIf cap = "Exit" Then
            Program.End()
      elseIf cap = "Notepad" Then
           GraphicsWindow.Clear()
           GraphicsWindow.Height = "700"
           GraphicsWindow.Width = "1100"
           GraphicsWindow.BackgroundColor = "Black"
           options = Controls.AddButton("Options",500,10)  '<--------- necessary
           Box[1] = Controls.AddTextBox(375, 50)
           Controls.SetTextBoxText(Box[1], "Title")
           Box[2] = Controls.AddTextBox(375, 100)
           Controls.SetSize(Box[2], 160, 20)
           Controls.SetTextBoxText(Box[2], "Date")
           Box[3] = Controls.AddMultiLineTextBox(250, 150)
           Controls.SetSize(Box[3], 400, 300)
           Controls.SetTextBoxText(Box[3], "Notes")
      elseIf cap = "Ip?" Then
           GraphicsWindow.Hide()
           TextWindow.Show()
           HostIP = Hardware.IP
          Textwindow.writeline(HostIP)
     EndIF
    EndSub

    Tuesday, March 27, 2012 4:14 AM
    Answerer
  • Hey CodingLikeCrazy (previously CodingCrazy)!

    Look, I was able to more-or-less fix your program by just deleting some lines inbetween Sub..EndSub blocks!
    Once Sub...EndSub routines begins to show up within your source, do not put any more code between an EndSub & Sub like below. It is assured to cause erratic behaviour!

    ...
    EndSub
    Controls.ButtonClicked = ShowMyIp    ' <- this does not belong here
    Sub ShowMyIp
    ...
    Tuesday, March 27, 2012 4:27 AM
    Answerer

All replies

  • I also was wondering how might I do like a "controls.lastbuttonclick  =" with game window because im making my own browser.

    GameWindow.Height = Desktop.Height
    GameWindow.Width = Desktop.Width
    GameWindow.BackgroundColor = "Black"
    GameWindow.Show()
    Web = "http://www.msn.com/"
    GameWindow.WindowState = "Maximized"
    Browser = GameControls.AddWebBrowser(0, 0, GameWindow.Width, GameWindow.Height - 40, Web)
    WebBar = GameControls.AddTextBox("About;Blank", GameWindow.Width - 1224,GameWindow.Height -35, 700, 30)
    Enter = GameControls.AddButton("Enter", GameWindow.Width - 514, GameWindow.Height -35, 100, 30)
    Zoom_Control_Bar = GameControls.AddSlider(100,GameWindow.Width - 120,GameWindow.Height - 30,100,20)
    GameControls.RegisterValueChangedEvent(Zoom_Control_Bar,"Zoom_Set")
    Sub WebPageFind
      If Game
    EndSub
    Sub Zoom_Set
      value = GameControls.GetValue(Zoom_Control_Bar)
      scale = value/100
      width = scale*GameWindow.Width
      height = scale*(GameWindow.Height - 40)
      posX = (GameWindow.Width - width)/2
      posY = ((GameWindow.Height - 40) - height)/2
      GameControls.Move(Browser,posX,posY,0)
      GameControls.SetSize(Browser,width,height)
    EndSub
    
      

    Tuesday, March 27, 2012 2:18 AM
  • Try this. You'd better use Controls.GetButtonCaption

    GraphicsWindow.Title = "Caltionary"
    GraphicsWindow.CanResize = "false"
    GraphicsWindow.BrushColor = "red"
    GraphicsWindow.Show()
    GraphicsWindow.Width = "1000"
    GraphicsWindow.Height = "300"
    GraphicsWindow.BrushColor = "green"
    DictionaryButton = Controls.AddButton("Dictionary",50,10)
    GraphicsWindow.BrushColor = "blue"
    CalculatorButton = Controls.AddButton("Calculator",150,10)
    GraphicsWindow.BrushColor = "Purple"
    NotePadButton = Controls.AddButton("Notepad",250,10)
    GraphicsWindow.BrushColor = "Black"
    IP = Controls.AddButton("Ip?",350,10)
    GraphicsWindow.BrushColor = "red"
    EndProgram = Controls.AddButton("Exit",120,50)

    Controls.ButtonClicked = OnButtonClicked
     
    Sub OnButtonClicked
     cap= Controls.GetButtonCaption(Controls.LastClickedButton)
      IF cap = "Dictionary" Then
             GraphicsWindow.Clear()
             GraphicsWindow.BrushColor = "green"
             options = Controls.AddButton("Options",500,10)
             GraphicsWindow.Width = 1100
             GraphicsWindow.Height = 700
             Getdef = Controls.AddButton("Find Definition",270,100)
             Defword = Controls.AddTextBox(100,100)
             Definition = Controls.AddMultiLineTextBox(100,200)
             Controls.SetSize(Definition,900,400)
      ElseIf  cap="Find Definition" Then     
            i = Controls.GetTextBoxText(Defword)
            x = Dictionary.GetDefinition(i)
            Controls.SetTextBoxText(Definition,x)
      elseif cap="Options" then     
            GraphicsWindow.Clear()
            GraphicsWindow.Title = "Caltionary"
            GraphicsWindow.CanResize = "false"
            GraphicsWindow.BrushColor = "red"
            GraphicsWindow.Show()
            GraphicsWindow.Width = "500"
            GraphicsWindow.Height = "300"
            GraphicsWindow.BrushColor = "green"
            DictionaryButton = Controls.AddButton("Dictionary",50,10)
            GraphicsWindow.BrushColor = "blue"
            CalculatorButton = Controls.AddButton("Calculator",150,10)
            GraphicsWindow.BrushColor = "Purple"
            NotePadButton = Controls.AddButton("Notepad",250,10)
            GraphicsWindow.BrushColor = "red"
            EndProgram = Controls.AddButton("Exit",120,50)
       
      elseIf cap="Calculator" Then
            GraphicsWindow.Height = "700"
            GraphicsWindow.Width = "1100"
            GraphicsWindow.BrushColor = "Blue"
            GraphicsWindow.Clear()
            options = Controls.AddButton("Options",500,10)
            GraphicsWindow.DrawBoundText(10,100,100,"First Number: ")
            GraphicsWindow.DrawBoundText(10,150,200,"Operation: ")
            GraphicsWindow.DrawBoundText(10,200,100,"Second Number: ")
            GraphicsWindow.DrawBoundText(10,300,100,"Answer: ")
            Num1Box = Controls.AddTextBox(200,95)
            OppBox = Controls.AddTextBox(200,145)
            Num2Box = Controls.AddTextBox(200,195)
            CalAnswerBox = Controls.AddTextBox(200,295)
            GetCalAnswer = Controls.AddButton("Enter",250,250)
            CalClear = Controls.AddButton("Clear",250,350)
            CalAdd = Controls.AddButton("+",400,145)
            CalSub = Controls.AddButton("-",450,145)
            CalMul = Controls.AddButton("*",500,145)
            CalDiv = Controls.AddButton("/",550,145)

          elseIf cap="+" Then
             Opp = "+"
             Controls.SetTextBoxText(OppBox,"+")
          elseif cap="-" Then
             Opp = "-"
             Controls.SetTextBoxText(OppBox,"-")
          elseIf cap="*" Then
             Opp = "*"
             Controls.SetTextBoxText(OppBox,"*")
          elseIf cap="/" Then
             Opp = "/"
             Controls.SetTextBoxText(OppBox,"/")
           elseif cap="Enter" Then
             Num1 = Controls.GetTextBoxText(Num1Box)
             Num2 = Controls.GetTextBoxText(Num2Box)
             Opp = Controls.GetTextBoxText(OppBox)
             If Opp = "+" Then
                Num3 = Num1 + Num2
                Controls.SetTextBoxText(CalAnswerBox,Num3)
             elseIf Opp = "-" Then
                Num3 = Num1 - Num2
                Controls.SetTextBoxText(CalAnswerBox,Num3)
             elseIf Opp = "*" Then
                Num3 = Num1 * Num2
                Controls.SetTextBoxText(CalAnswerBox,Num3)
             elseIf Opp = "/" Then
                Num3 = Num1 / Num2
                Controls.SetTextBoxText(CalAnswerBox,Num3)
             EndIf
      elseIf cap = "Clear" Then
             Controls.SetTextBoxText(Num1Box,"")
             Controls.SetTextBoxText(Num2Box,"")
             Controls.SetTextBoxText(CalAnswerBox,"")
             Controls.SetTextBoxText(OppBox,"")
      elseIf cap = "Exit" Then
            Program.End()
      elseIf cap = "Notepad" Then
           GraphicsWindow.Clear()
           GraphicsWindow.Height = "700"
           GraphicsWindow.Width = "1100"
           GraphicsWindow.BackgroundColor = "Black"
           options = Controls.AddButton("Options",500,10)  '<--------- necessary
           Box[1] = Controls.AddTextBox(375, 50)
           Controls.SetTextBoxText(Box[1], "Title")
           Box[2] = Controls.AddTextBox(375, 100)
           Controls.SetSize(Box[2], 160, 20)
           Controls.SetTextBoxText(Box[2], "Date")
           Box[3] = Controls.AddMultiLineTextBox(250, 150)
           Controls.SetSize(Box[3], 400, 300)
           Controls.SetTextBoxText(Box[3], "Notes")
      elseIf cap = "Ip?" Then
           GraphicsWindow.Hide()
           TextWindow.Show()
           HostIP = Hardware.IP
          Textwindow.writeline(HostIP)
     EndIF
    EndSub

    Tuesday, March 27, 2012 4:14 AM
    Answerer
  • Hey CodingLikeCrazy (previously CodingCrazy)!

    Look, I was able to more-or-less fix your program by just deleting some lines inbetween Sub..EndSub blocks!
    Once Sub...EndSub routines begins to show up within your source, do not put any more code between an EndSub & Sub like below. It is assured to cause erratic behaviour!

    ...
    EndSub
    Controls.ButtonClicked = ShowMyIp    ' <- this does not belong here
    Sub ShowMyIp
    ...
    Tuesday, March 27, 2012 4:27 AM
    Answerer
  • Hello again Coding!

    I remember that you once asked for help for an early version of this same program when it only had the "Dictionary" part working. You can see that at this thread -> I need HelpGraphicsWindow.Height = 500GraphicsWindow.Height = 500GraphicsWindow.Height = 500
    In there, I've fixed and remodeled it to use a more flexible button-click verification method and also, branched the "Dictionary" block to reside in its own subroutine and have a "WaitLoop" to its own buttons.
    Now your current program has more buttons and moves forward to accomplish even more functionalities. In fact, each of those buttons are themselves, a separate mini-utility software! That is: dictionary, calculator, notepad and an IP check.
    Problem is, you're making all of them reside together inside a special subroutine (Sub OnButtonClicked), which is invoked every time any button is selected.
    When a Small Basic is run, it is created an "instance" for it. This is the main instance. But when an event trigger happens, it is then created an extra instance, which is run parallel to the main one. This is very powerful, but at the same time more difficult to tame, thus prone to bugs!
    It is advisable to concentrate most of your code inside the main instance, and not linger too much on those extra instance subs. Just for quick capture and register of last button, mouse and/or key pressed.
    Another tip is, try to create separate subs for each of those mini-programs, so you can manage them better, and it becomes easier to debug if need arises.
    Tuesday, March 27, 2012 5:30 AM
    Answerer
  • naochanON I tried your code but when I tried to add another function it said I cant use another elseif.

    GraphicsWindow.Title = "Caltionary"
     GraphicsWindow.CanResize = "false"
     GraphicsWindow.BrushColor = "red"
     GraphicsWindow.Show()
     GraphicsWindow.Width = "1000"
     GraphicsWindow.Height = "300"
     GraphicsWindow.BrushColor = "green"
     DictionaryButton = Controls.AddButton("Dictionary",50,10)
     GraphicsWindow.BrushColor = "blue"
     CalculatorButton = Controls.AddButton("Calculator",150,10)
     GraphicsWindow.BrushColor = "Purple"
     NotePadButton = Controls.AddButton("Notepad",250,10)
     GraphicsWindow.BrushColor = "Black"
     IP = Controls.AddButton("Ip?",350,10)
     GraphicsWindow.BrushColor = "Teal"
     Guessing = Controls.AddButton("Web!", 450, 10)
     GraphicsWindow.BrushColor = "red"
     EndProgram = Controls.AddButton("Exit",120,50)
     
    Controls.ButtonClicked = OnButtonClicked
       
    Sub OnButtonClicked
      cap= Controls.GetButtonCaption(Controls.LastClickedButton)
       IF cap = "Dictionary" Then
              GraphicsWindow.Clear()
              GraphicsWindow.BrushColor = "green"
              options = Controls.AddButton("Options",500,10)
              GraphicsWindow.Width = 1100
              GraphicsWindow.Height = 700
              Getdef = Controls.AddButton("Find Definition",270,100)
              Defword = Controls.AddTextBox(100,100)
              Definition = Controls.AddMultiLineTextBox(100,200)
              Controls.SetSize(Definition,900,400)
       ElseIf  cap="Find Definition" Then      
            i = Controls.GetTextBoxText(Defword)
             x = Dictionary.GetDefinition(i)
             Controls.SetTextBoxText(Definition,x)
       elseif cap="Options" then      
            GraphicsWindow.Clear()
             GraphicsWindow.Title = "Caltionary"
             GraphicsWindow.CanResize = "false"
             GraphicsWindow.BrushColor = "red"
             GraphicsWindow.Show()
             GraphicsWindow.Width = "500"
             GraphicsWindow.Height = "300"
             GraphicsWindow.BrushColor = "green"
             DictionaryButton = Controls.AddButton("Dictionary",50,10) 
            GraphicsWindow.BrushColor = "blue"
             CalculatorButton = Controls.AddButton("Calculator",150,10)
             GraphicsWindow.BrushColor = "Purple"
             NotePadButton = Controls.AddButton("Notepad",250,10)
             GraphicsWindow.BrushColor = "red"
             EndProgram = Controls.AddButton("Exit",120,50)
         
      elseIf cap="Calculator" Then
             GraphicsWindow.Height = "700"
             GraphicsWindow.Width = "1100"
             GraphicsWindow.BrushColor = "Blue"
             GraphicsWindow.Clear()
             options = Controls.AddButton("Options",500,10)
             GraphicsWindow.DrawBoundText(10,100,100,"First Number: ")
             GraphicsWindow.DrawBoundText(10,150,200,"Operation: ") 
            GraphicsWindow.DrawBoundText(10,200,100,"Second Number: ")
             GraphicsWindow.DrawBoundText(10,300,100,"Answer: ")
             Num1Box = Controls.AddTextBox(200,95)
             OppBox = Controls.AddTextBox(200,145)
             Num2Box = Controls.AddTextBox(200,195)
             CalAnswerBox = Controls.AddTextBox(200,295)
             GetCalAnswer = Controls.AddButton("Enter",250,250)
             CalClear = Controls.AddButton("Clear",250,350)
             CalAdd = Controls.AddButton("+",400,145)
             CalSub = Controls.AddButton("-",450,145)
             CalMul = Controls.AddButton("*",500,145)
             CalDiv = Controls.AddButton("/",550,145)
     
          elseIf cap="+" Then
              Opp = "+"
              Controls.SetTextBoxText(OppBox,"+")
           elseif cap="-" Then
              Opp = "-"
              Controls.SetTextBoxText(OppBox,"-")
           elseIf cap="*" Then
              Opp = "*"
              Controls.SetTextBoxText(OppBox,"*")
           elseIf cap="/" Then
              Opp = "/"
              Controls.SetTextBoxText(OppBox,"/")
            elseif cap="Enter" Then
              Num1 = Controls.GetTextBoxText(Num1Box)
              Num2 = Controls.GetTextBoxText(Num2Box)
              Opp = Controls.GetTextBoxText(OppBox)
              If Opp = "+" Then
                 Num3 = Num1 + Num2
                 Controls.SetTextBoxText(CalAnswerBox,Num3)
              elseIf Opp = "-" Then
                 Num3 = Num1 - Num2
    
                 Controls.SetTextBoxText(CalAnswerBox,Num3)
              elseIf Opp = "*" Then
                 Num3 = Num1 * Num2
                 Controls.SetTextBoxText(CalAnswerBox,Num3)
              elseIf Opp = "/" Then
                 Num3 = Num1 / Num2
                 Controls.SetTextBoxText(CalAnswerBox,Num3)
              EndIf
       elseIf cap = "Clear" Then
              Controls.SetTextBoxText(Num1Box,"")
              Controls.SetTextBoxText(Num2Box,"")
              Controls.SetTextBoxText(CalAnswerBox,"")
              Controls.SetTextBoxText(OppBox,"")
       elseIf cap = "Exit" Then
             Program.End()
       elseIf cap = "Notepad" Then
            GraphicsWindow.Clear()
            GraphicsWindow.Height = "700"
            GraphicsWindow.Width = "1100"
            GraphicsWindow.BackgroundColor = "Black"
            options = Controls.AddButton("Options",500,10)  '<--------- necessary
            Box[1] = Controls.AddTextBox(375, 50)
            Controls.SetTextBoxText(Box[1], "Title")
            Box[2] = Controls.AddTextBox(375, 100)
            Controls.SetSize(Box[2], 160, 20)
            Controls.SetTextBoxText(Box[2], "Date")
            Box[3] = Controls.AddMultiLineTextBox(250, 150)
            Controls.SetSize(Box[3], 400, 300)
            Controls.SetTextBoxText(Box[3], "Notes")
       elseIf cap = "Ip?" Then
            GraphicsWindow.Hide()
            TextWindow.Show()
            HostIP = Hardware.IP
           Textwindow.writeline(HostIP)
         EndIF
       EndSub
       elseIf cap = "Web!"  Then
       GraphicsWindow.Hide()
       GameWindow.Show()
       GameWindow.Height = Desktop.Height
    GameWindow.Width = Desktop.Width
    GameWindow.BackgroundColor = "Black"
    GameWindow.Show()
    GameWindow.Title = "
    Web = "http://www.msn.com/"
    GameWindow.WindowState = "Maximized"
    Browser = GameControls.AddWebBrowser(0, 0, GameWindow.Width, GameWindow.Height - 40, Web)
    WebBar = GameControls.AddTextBox("About;Blank", GameWindow.Width - 1224,GameWindow.Height -35, 700, 30)
    Enter = GameControls.AddButton("Enter", GameWindow.Width - 514, GameWindow.Height -35, 100, 30)
    Zoom_Control_Bar = GameControls.AddSlider(100,GameWindow.Width - 120,GameWindow.Height - 30,100,20)
    GameControls.RegisterValueChangedEvent(Zoom_Control_Bar,"Zoom_Set")
    Sub Zoom_Set
      value = GameControls.GetValue(Zoom_Control_Bar)
      scale = value/100
      width = scale*GameWindow.Width
      height = scale*(GameWindow.Height - 40)
      posX = (GameWindow.Width - width)/2
      posY = ((GameWindow.Height - 40) - height)/2
      GameControls.Move(Browser,posX,posY,0)
      GameControls.SetSize(Browser,width,height)
    EndSub
    
    
    
      
       
    

    Tuesday, March 27, 2012 1:30 PM
  • Try   XHH663  

     GameControls.RegisterMouseDown(Enter," something") is necessary . 

    sub something

      In XHH663, bubble moves in the window. ( under browser)

    endsub

    *Note  ;You don't have to write  "if controls.lastbuttonclick ".

    If you push "Enter" button, then "something" works.  

    And after that, PC waits untill you push some button.



    Wednesday, March 28, 2012 12:50 AM
    Answerer