I am writing an application that sends an SMS. The maximum characters I want the user to enter is 160. I would like to show the user how many chars he has typed so far.
The code below doesn't work because it moves the cursor to the start of the memo field everytime a key is pressed, so typing "ABC" produces "CBA".
How can I do this?
- Code: Select all Expand view
DEFINE DIALOG oDlg RESOURCE "SMS"
REDEFINE GET cCellnumber ID 4001 OF oDlg UPDATE
REDEFINE GET cMessage MEMO ID 4002 OF oDlg UPDATE on CHANGE oDlg:UPDATE()
REDEFINE SAY ID 4003 PROMPT ALLTRIM(STR(LEN(cMessage)))+" of 160 characters used" UPDATE
REDEFINE BUTTON ID 10 of oDlg ACTION ( sendsms( cCellnumber, cMessage ), oDlg:END() ) ) ) //OK
REDEFINE BUTTON ID 20 of oDlg ACTION ( oDlg:END() ) //Cancel