FiveTech Support Forums

FiveWin / Harbour / xBase community
Board index FiveWin for Harbour/xHarbour Need to see the length of MEMO Edit box as it is filled.
Posts: 233
Joined: Sat Dec 30, 2006 06:10 AM
Need to see the length of MEMO Edit box as it is filled.
Posted: Tue Jun 10, 2008 03:42 PM
Hi all.

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?


 
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
Many thanks

Ollie.



Using:

xHarbour Compiler build 1.2.1 (SimpLex) (Rev. 6406)

Borland C++ 5.5.1

FWH 9.04 (2009 Apr)
Posts: 44162
Joined: Thu Oct 06, 2005 05:47 PM
Need to see the length of MEMO Edit box as it is filled.
Posted: Thu Jun 12, 2008 07:30 AM
Ollie,

Try it this way:

REDEFINE GET cMessage MEMO ID 4002 OF oDlg ON CHANGE oSay:Refresh()

REDEFINE SAY oSay ID 4003 PROMPT ALLTRIM(STR(LEN(cMessage)))+" of 160 characters used"
regards, saludos

Antonio Linares
www.fivetechsoft.com
Posts: 233
Joined: Sat Dec 30, 2006 06:10 AM
Need to see the length of MEMO Edit box as it is filled.
Posted: Thu Jun 12, 2008 08:18 AM

Works perfectly.

Thanks.

Many thanks

Ollie.



Using:

xHarbour Compiler build 1.2.1 (SimpLex) (Rev. 6406)

Borland C++ 5.5.1

FWH 9.04 (2009 Apr)

Continue the discussion