Loading ...
Sorry, an error occurred while loading the content.

41592RE: [libertybasic] SIMPLE

Expand Messages
  • Stefan Pendl
    Oct 3, 2010
    • 0 Attachment
      >
      > Hello Stefan
      > Following to my previous message, I tried to have the
      > following code working ok but it does not, the first column
      > of txtboxes “time” is working ok but the second column of
      > “distance” doesn’t. I tried to modify your code in a right way.
      > Could you please help by copying the following variables,
      > each group to its txtboxes, so that the code will work ok.  Thank you.

      The part to initiate the second timer will never be executed and you can only have one timer for one program.
      You will have to read the help file topics about the commands you use very carefully.

      You need to manage all in one timer event handler, which is easy.
      You do not have ten values for the distance, so you need to start with the first word in the distance string too, not with the
      sixth.

      As always, not only check the code, but more important check the commands used.

      '---code start (watch for line wraps)
      nomainwin
      WindowWidth = 600
      WindowHeight = 400
      BUTTON #A.1 "Quit", [quit],UL, 500, 300, 70, 25
      BUTTON #A.Default, " Calculate ",[enter],UL, 400,300 , 70, 25
      TEXTBOX #A.txtbox1, 10,60,50,25
      TEXTBOX #A.txtbox2, 10,100,50,25
      TEXTBOX #A.txtbox3, 10,140,50,25
      TEXTBOX #A.txtbox4, 10,180,50,25
      TEXTBOX #A.txtbox5, 10,220, 50, 25
      TEXTBOX #A.txtbox6, 70,60,50,25
      TEXTBOX #A.txtbox7, 70,100,50,25
      TEXTBOX #A.txtbox8, 70,140,50,25
      TEXTBOX #A.txtbox9, 70,180,50,25
      TEXTBOX #A.txtbox10, 70,220, 50, 25
      STATICTEXT #A "time", 20,25, 250, 25
      STATICTEXT #A "distance", 70,25, 250, 25
      GRAPHICBOX #A.textresult, 180, 60, 300, 180
      OPEN "Velocity" FOR DIALOG AS #A
      #A "trapclose [quit]"
      #A "font Times_New_Roman 12"
      #A.textresult "place 5 15 "
      #A.textresult "\";"time"
      #A.textresult "\";"-----------------------------------------------------"
      #A.textresult "place 90 15 "
      #A.textresult "\";"distance "
      #A.textresult "place 180 15 "
      #A.textresult "\";"velocity"
      #A.txtbox1 "!contents? OldTimes$"
      #A.txtbox6 "!contents? OldDistance$"
      #A.txtbox1 "!setfocus"
      timer 100, [CheckInput]
      wait
      [CheckInput]
      #A.txtbox1 "!contents? Times$"
      if Times$ <> OldTimes$ then
      #A.txtbox1 word$(Times$, 1)
      #A.txtbox2 word$(Times$, 2)
      #A.txtbox3 word$(Times$, 3)
      #A.txtbox4 word$(Times$, 4)
      #A.txtbox5 word$(Times$, 5)
      #A.txtbox1 "!contents? OldTimes$"
      end if
      #A.txtbox6 "!contents? Distance$"
      if Distance$ <> OldDistance$ then
      #A.txtbox6 word$(Distance$, 1)
      #A.txtbox7 word$(Distance$, 2)
      #A.txtbox8 word$(Distance$, 3)
      #A.txtbox9 word$(Distance$, 4)
      #A.txtbox10 word$(Distance$, 5)
      #A.txtbox6 "!contents? OldDistance$"
      end if
      wait
      [enter]
      PRINT #A.txtbox1, "!contents? a"
      PRINT #A.txtbox2, "!contents? b"
      PRINT #A.txtbox3, "!contents? c"
      PRINT #A.txtbox4, "!contents? d"
      PRINT #A.txtbox5, "!contents? e"
      PRINT #A.txtbox6, "!contents? f"
      PRINT #A.txtbox7, "!contents? g"
      PRINT #A.txtbox8, "!contents? h"
      PRINT #A.txtbox9, "!contents? i"
      PRINT #A.txtbox10, "!contents? j"
      #A.textresult "place 5 50"
      #A.textresult "\" ; a
      #A.textresult "place 5 70"
      #A.textresult "\" ; b
      #A.textresult "place 5 90"
      #A.textresult "\" ; c
      #A.textresult "place 5 110"
      #A.textresult "\" ; d
      #A.textresult "place 5 130"
      #A.textresult "\" ; e
      #A.textresult "place 100 50"
      #A.textresult "\" ; f
      #A.textresult "place 100 70"
      #A.textresult "\" ; g
      #A.textresult "place 100 90"
      #A.textresult "\" ; h
      #A.textresult "place 100 110"
      #A.textresult "\" ; i
      #A.textresult "place 100 130"
      #A.textresult "\" ; j
      #A.textresult "place 200 50"
      #A.textresult "\" ; a*f
      #A.textresult "place 200 70"
      #A.textresult "\" ; b*g
      #A.textresult "place 200 90"
      #A.textresult "\" ; c*h
      #A.textresult "place 200 110"
      #A.textresult "\" ; d*i
      #A.textresult "place 200 130"
      #A.textresult "\" ; e*j
      wait
      [quit]
      CLOSE #A
      END
      '---code end

      ---
      Stefan Pendl
      http://stefanpendl.runbasichosting.com/

      Liberty BASIC 4.04 Pro ... http://www.libertybasic.com/assist.html
      Liberty BASIC 4.04 ....... http://www.libertybasic.com/lb404setup.exe

      Liberty BASIC Bug Tracker ... http://libertybasicbugs.wikispaces.com/

      Books at http://www.lulu.com/ and http://www.amazon.com/
      Alyce Watson ... APIs for Liberty BASIC
      Carl Gundel .... Beginning Programming with Liberty BASIC

      Windows 7 Home Premium 64-bit RTM
      AMD Turion X2 RM-70 2GHz, 4GB RAM
    • Show all 17 messages in this topic