Home AMX User Forum AMX General Discussion

Help making a Dialer?

I am making a telephone interface and would like to display the numbers as they are dialed. I am having trouble figuring out how to add each dialed digit to the string that is sent to the text area, and also how to remove a digit via a delete button. Can someone point me in the right direction?

thanks.

Comments

  • You can append strings by doing something like this:
    sPhoneNumber = "sPhoneNumber, cNewDigit"
    

    You can look up length_string on AMX-PI to learn how to shorten the string if the user backspaces.

    You can also consider using the system keypad. The text area on the system keypad will show the string as its entered, and handle the backspace for you. When the user pushes "dial" or however you mark the escape button, the whole string will be sent to the master as a string data_event.

    --John
  • You'll need something like this
        //cPhone_Number =0044
        cPHONE_NUMBER = "cPHONE_NUMBER, ITOA(<last digit dialled>)" // say dial 5
        //cPhone_Number =00445
        //Send cPhone_Number to TP
    
    
  • Thanks!!!

    The dialer is working now. Thanks for your help. The working code is below, FYI.

    ///TC Dialer Btn Numbers
    BUTTON_EVENT[dvTP_TC,Btn0]
    BUTTON_EVENT[dvTP_TC,Btn1]
    BUTTON_EVENT[dvTP_TC,Btn2]
    BUTTON_EVENT[dvTP_TC,Btn3]
    BUTTON_EVENT[dvTP_TC,Btn4]
    BUTTON_EVENT[dvTP_TC,Btn5]
    BUTTON_EVENT[dvTP_TC,Btn6]
    BUTTON_EVENT[dvTP_TC,Btn7]
    BUTTON_EVENT[dvTP_TC,Btn8]
    BUTTON_EVENT[dvTP_TC,Btn9]
    {
    PUSH:
    {
    NumPress = itoa(button.input.channel-10)
    NumDial = "NumDial,NumPress"
    SEND_COMMAND dvTp_TC,"'^txt-31,1&2,',NumDial"
    }
    }



    BUTTON_EVENT[dvTp_TC,BtnBackSpc] ///backspace
    {
    PUSH:
    {
    STACK_VAR NumDialLength
    NumDialLength = LENGTH_STRING(NumDial)
    NumDialLength = (NumDialLength-1)
    SET_LENGTH_STRING(NumDial,NumDialLength)
    SEND_COMMAND dvTp_TC,"'^txt-31,1&2,',NumDial"
    }
    }


    BUTTON_EVENT[dvTp_TC,BtnClear] /// clear dialer
    {
    PUSH:
    {
    SET_LENGTH_STRING(NumDial,0)
    SEND_COMMAND dvTp_TC,"'^txt-31,1&2,',NumDial"
    }
    }
  • Another way to bksp... FYI

    BUTTON_EVENT[dvTp_TC,BtnBackSpc] ///backspace
    {
    PUSH:
    {
    set_length_string(NumDial,length_string(NumDial)-1) //remove digit
    SEND_COMMAND dvTp_TC,"'^txt-31,1&2,',NumDial"
    }
    }
Sign In or Register to comment.