none
Help with code RRS feed

  • Question

  • My program code allows me to type information in the graphics window and I can backspace and retype, like filling in a form. The code I use shown below works fine with text entry, However, it will not work when numbers (two or more digets) are typed (unless I prefix a number with text ie.#123). Does anyone have a suggestion on how I can get numbers (like a zip code) to be input in the same manner?

      'ST
      If GraphicsWindow.MouseX >=260 And GraphicsWindow.MouseX <=285 And GraphicsWindow.MouseY >=50 And GraphicsWindow.MouseY <=65 Then
        GraphicsWindow.TextInput = StateInput
      EndIf

    Sub StateInput
      If GraphicsWindow.LastKey = "Back" Then
        State = Text.GetSubText(state, 1, Text.GetLength(State) - 1)
      Else
        State = State + GraphicsWindow.LastText
      EndIf
      FFB ()
      GraphicsWindow.FillRectangle (260,50,25,15)
      GraphicsWindow.DrawRectangle (260,50,25,15)
      BoxText ()
      GraphicsWindow.DrawText (262,51,State )
    EndSub


    Any suggestions are greatly appreciated.

    Wednesday, August 26, 2009 11:17 PM

Answers

  • Try using Text.Append(text1, text2)

      State = Text.Append(State, GraphicsWindow.LastText)

    SB will try to Add the numbers together, if no letters(or other characters) are present.

    1+2+3+4 -> 10

    instead of

    1234
    • Edited by Rushworks Thursday, August 27, 2009 12:29 AM
    • Marked as answer by SFC123 Thursday, August 27, 2009 3:13 PM
    Thursday, August 27, 2009 12:23 AM

All replies

  • Try using Text.Append(text1, text2)

      State = Text.Append(State, GraphicsWindow.LastText)

    SB will try to Add the numbers together, if no letters(or other characters) are present.

    1+2+3+4 -> 10

    instead of

    1234
    • Edited by Rushworks Thursday, August 27, 2009 12:29 AM
    • Marked as answer by SFC123 Thursday, August 27, 2009 3:13 PM
    Thursday, August 27, 2009 12:23 AM
  • Thanks for your help Rushworks
    Saturday, August 29, 2009 9:27 PM