Advertisement
PanzerFaustNL

Calculator

May 18th, 2020
2,548
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
  1. nomainwin
  2.     button     #calculator.btn, "Click Me", [btnClick], UL, 20,155,120,30
  3.     statictext #calculator.num1, "Vul een getal 1 in:", 20, 40, 120, 30
  4.     statictext #calculator.num2, "Vul een getal 2 in:", 20, 80, 120, 30
  5.     statictext #calculator.reken,"Vul een rekenteken in +,-,/,* :",20,120,200,30
  6.     TextBox    #calculator.getal1, 200,30,40,30
  7.     TextBox    #calculator.getal2, 200,70,40,30
  8.     TextBox    #calculator.rekenteken, 200,110,40,30
  9.     TextBox    #calculator.txt, 200,150,40,30
  10.     ' this doesn't work
  11.     Dim rekenteken$(4) = "+","-","/","*"
  12.     ComboBox   #calculator.rekenteken, 200,210,40,30
  13.     WindowWidth = 300 : WindowHeight = 200
  14.     open "Calculator" for window as #calculator
  15.     #calculator "trapclose [quit]"
  16.     nClicks = 0
  17. wait
  18.  
  19. [quit]
  20.     close #calculator
  21. end
  22.  
  23. [btnClick]
  24.     nClicks = nClicks + 1
  25.    
  26.     print #calculator.getal1,"!contents? nGetal1"
  27.     print #calculator.getal2,"!contents? nGetal2"
  28.     print #calculator.rekenteken,"!contents? sRekenteken$"
  29.     If sRekenteken$ = "+" Then
  30.         uitkomst = nGetal1 + nGetal2  
  31.         print #calculator.txt, str$(uitkomst)
  32.     End If  
  33.     if sRekenteken$ = "-" then
  34.         uitkomst = nGetal1 + nGetal2  
  35.         print #calculator.txt, str$(uitkomst)
  36.     End If
  37. wait
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement