none
Click on the "Return" button and perform the operation RRS feed

  • Question

  • Hello everyone, I apologize for my English, I'm using google translator
    I have a textbox where I enter a value, and if I press send the program goes to me to see if this value is equal to a given string, if the value is equal then appears on screen a new textbox, where I perform the same operation, that is, I enter a string and hit enter, where it is checked whether this string is equal to another string. But the problem arises when I click the send button a second time, not making me maintain control.

    I enclose code written by me

         

                      titoloCodiceCassa = Shapes.AddText("Codice Cassa")
      Shapes.Move(titoloCodiceCassa,10,10)
      txtCodiceCassa = Controls.AddTextBox(10,30)
      GraphicsWindow.KeyDown = OnKeyDown
      While(0 = 0)
        If(lastkey = "Return")Then
          appValoreCodiceCassa = Controls.GetTextBoxText(txtCodiceCassa)
          valoreCodiceCassa = Text.ConvertToUpperCase(appValoreCodiceCassa)
          If(valoreCodiceCassa = "halo" or valoreCodiceCassa = "HALO") then
              titoloCodiceNegozio = Shapes.AddText("Codice Negozio")
              Shapes.Move(titoloCodiceNegozio,10,60)
              txtCodiceNegozio = Controls.AddTextBox(10,80)
              LDFocus.SetFocus(txtCodiceNegozio)

              If(lastkey = "Return") then
                 appValoreCodiceNegozio = Controls.GetTextBoxText(txtCodiceNegozio)
                 valoreCodiceNegozio = Text.ConvertToUpperCase(appValoreCodiceNegozio)
                 if(valoreCodiceNegozio = "ole" or valoreCodiceNegozio = "OLE") then 
                       etc etc....
       EndIf
          lastkey = ""
        EndIf
      EndWhile

    T.U.

    Monday, April 4, 2016 2:47 PM

Answers

  • I managed to solve the problem, I am attaching the code if someone has the same problem

    Sub OnKeyDown
      lastkey = GraphicsWindow.LastKey
      If(lastkey = "Return") Then
        If(LDFocus.IsFocus(txtCodiceCassa)) Then
          controlloCodiceCassa()
        ElseIf(LDFocus.IsFocus(txtCodiceNegozio)) then
          controlloCodiceNegozio()
        EndIf
      EndIf
    EndSub

    Sub controlloCodiceCassa
      appValoreCodiceCassa = Controls.GetTextBoxText(txtCodiceCassa)
      valoreCodiceCassa = Text.ConvertToUpperCase(appValoreCodiceCassa)
       If(valoreCodiceCassa = "Hola") Then
          Goto fuoriCodiceCassa
        EndIf
      EndFor
      fuoriCodiceCassa:
      titoloCodiceNegozio = Shapes.AddText("Codice Negozio")
      Shapes.Move(titoloCodiceNegozio,10,60)
      txtCodiceNegozio = Controls.AddTextBox(10,80)
      LDFocus.SetFocus(txtCodiceNegozio)
    EndSub

    Sub controlloCodiceNegozio
      appValoreCodiceNegozio = Controls.GetTextBoxText(txtCodiceNegozio)
      valoreCodiceNegozio = Text.ConvertToUpperCase(appValoreCodiceNegozio)
        If(valoreCodiceNegozio = "Good") Then
          Goto fuoriCodiceNegozio
        Else
          goto adios
        EndIf
      'EndFor
      fuoriCodiceNegozio:
      GraphicsWindow.ShowMessage("Complete","Success")
      LDFocus.SetFocus(txtCodiceOV)
      adios:
    EndSub

    • Marked as answer by Carmenello Tuesday, April 5, 2016 10:11 AM
    Tuesday, April 5, 2016 10:11 AM

All replies

  • Were you after something like:

    string = "hallo" txtBox = Controls.AddTextBox(10 10)

    LDFocus.SetFocus(txtBox) GraphicsWindow.KeyDown = OnKeyDown While 0=0 If key = "Return" Then If Text.ConvertToLowerCase(Controls.GetTextBoxText(txtBox)) = string Then Controls.SetTextBoxText(txtBox, "") ElseIf Controls.GetTextBoxText(txtBox) <> "" Then GraphicsWindow.ShowMessage("Text is NOT equal to" "Message") EndIf key = "" EndIf Program.Delay(100) EndWhile Sub OnKeyDown key = GraphicsWindow.LastKey EndSub

    VHZ817



    Monday, April 4, 2016 10:34 PM
    Moderator
  • more or less the idea is that, just when the first word is equal to "Hallo" and click on "Return", you will see a new textbox where I have to write a new word, such as "Good" and re always control clicking on the "Return" .... But me problems on the second click the "Return"
    I do not know if I did well understand the idea
    Tuesday, April 5, 2016 6:49 AM
  • I managed to solve the problem, I am attaching the code if someone has the same problem

    Sub OnKeyDown
      lastkey = GraphicsWindow.LastKey
      If(lastkey = "Return") Then
        If(LDFocus.IsFocus(txtCodiceCassa)) Then
          controlloCodiceCassa()
        ElseIf(LDFocus.IsFocus(txtCodiceNegozio)) then
          controlloCodiceNegozio()
        EndIf
      EndIf
    EndSub

    Sub controlloCodiceCassa
      appValoreCodiceCassa = Controls.GetTextBoxText(txtCodiceCassa)
      valoreCodiceCassa = Text.ConvertToUpperCase(appValoreCodiceCassa)
       If(valoreCodiceCassa = "Hola") Then
          Goto fuoriCodiceCassa
        EndIf
      EndFor
      fuoriCodiceCassa:
      titoloCodiceNegozio = Shapes.AddText("Codice Negozio")
      Shapes.Move(titoloCodiceNegozio,10,60)
      txtCodiceNegozio = Controls.AddTextBox(10,80)
      LDFocus.SetFocus(txtCodiceNegozio)
    EndSub

    Sub controlloCodiceNegozio
      appValoreCodiceNegozio = Controls.GetTextBoxText(txtCodiceNegozio)
      valoreCodiceNegozio = Text.ConvertToUpperCase(appValoreCodiceNegozio)
        If(valoreCodiceNegozio = "Good") Then
          Goto fuoriCodiceNegozio
        Else
          goto adios
        EndIf
      'EndFor
      fuoriCodiceNegozio:
      GraphicsWindow.ShowMessage("Complete","Success")
      LDFocus.SetFocus(txtCodiceOV)
      adios:
    EndSub

    • Marked as answer by Carmenello Tuesday, April 5, 2016 10:11 AM
    Tuesday, April 5, 2016 10:11 AM