FiveTech Support Forums

FiveWin / Harbour / xBase community
Board index FiveWin for Harbour/xHarbour How to count input word in TGet?
Posts: 866
Joined: Tue Oct 16, 2007 08:57 AM
How to count input word in TGet?
Posted: Fri Dec 21, 2007 03:41 AM

Hi

this function like Web site Send SMS input UI.

Redefine GET ... ON CHNAGE....

I need show how many space can input in GET Object.

The problem is ON CHANGE can't Refresh other Object of FWH.

Source code:


nLEFT1:=LEN(PAY->RMK1)-LEN(TRIM(PAY->RMK1))
nLEFT2:=LEN(PAY->RMK2)-LEN(TRIM(PAY->RMK2))

REDEFINE GET PAY->RMK1 ID 21 OF oDlg ;
ON CHANGE LEFT_SHOW(1) ;
UPDATE

REDEFINE GET PAY->RMK2 ID 23 OF oDlg ;
ON CHANGE LEFT_SHOW(2) ;
UPDATE

REDEFINE SAY oLEFT1 PROMPT nLEFT1 PICTURE "99" ID 12 OF oDlg ;
UPDATE

REDEFINE SAY oLEFT2 PROMPT nLEFT2 PICTURE "99" ID 14 OF oDlg ;
UPDATE
....


STATIC FUNCTION LEFT_SHOW(nLINE)

DO CASE
CASE nLINE=1
nLEFT1:=LEN(PAY->RMK1)-LEN(TRIM(PAY->RMK1))

     oLEFT1:REFRESH() ==> NOT WORK

  CASE nLINE=2
     nLEFT2:=LEN(PAY->RMK2)-LEN(TRIM(PAY->RMK2))

     oLEFT2:REFRESH() ==> NOT WORK

ENDCASE

RETURN NIL


Best Regards,



Richard



Harbour 3.2.0dev (r2503251254) => Borland C++ v7.7 32bit

MySQL v8.0

Harbour 3.2.0dev (r2503251254) => Borland C++ v7.7 64bit
Posts: 44158
Joined: Thu Oct 06, 2005 05:47 PM
How to count input word in TGet?
Posted: Fri Dec 21, 2007 09:56 AM

Richard,

>
nLEFT1:=LEN(PAY->RMK1)-LEN(TRIM(PAY->RMK1))
oLEFT1:REFRESH() ==> NOT WORK
>

oLeft1:SetText( Str( nLeft1 ) )

regards, saludos

Antonio Linares
www.fivetechsoft.com
Posts: 866
Joined: Tue Oct 16, 2007 08:57 AM
How to count input word in TGet?
Posted: Fri Dec 21, 2007 01:27 PM
Antonio Linares wrote:Richard,

>
nLEFT1:=LEN(PAY->RMK1)-LEN(TRIM(PAY->RMK1))
oLEFT1:REFRESH() ==> NOT WORK
>

oLeft1:SetText( Str( nLeft1 ) )


Hi Antonio,

I try it but not work. TSay object not Refresh.
oLEFT1:REFRESH() not work.

Have you any idea for it?

Regards,

Richard
Best Regards,



Richard



Harbour 3.2.0dev (r2503251254) => Borland C++ v7.7 32bit

MySQL v8.0

Harbour 3.2.0dev (r2503251254) => Borland C++ v7.7 64bit
Posts: 59
Joined: Thu May 17, 2007 08:27 AM
How to count input word in TGet?
Posted: Mon Dec 24, 2007 03:57 AM

Antonio :

nLEFT1:=LEN(PAY->RMK1)-LEN(TRIM(PAY->RMK1))
oLeft1:SetText( Str( nLeft1 ) )
oLeft1:REFRESH()



hi Antonio:

Get ...On Change => can't refresh other objects .

Same problem to me , look like a bug .

Best Regards
kokoo
-------------

best regards

kokoo Kao
Posts: 10733
Joined: Sun Nov 19, 2006 05:22 AM
How to count input word in TGet?
Posted: Mon Dec 24, 2007 05:08 AM
Please try this code. You can use the same logic to achieve what you want.
FUNCTION Main()

   LOCAL oDlg,oFont
   LOCAL nLen := 20
   LOCAL nRem := 20
   LOCAL cVar := SPACE(20)
   LOCAL oSay, oGet


   DEFINE FONT oFont NAME 'TAHOMA' SIZE 0,-12
   DEFINE DIALOG oDlg SIZE 300,200 PIXEL

   @ 10,10 GET oGet VAR cVar SIZE 100,12 PIXEL OF oDlg ON CHANGE oSay:Refresh()
   @ 10,120 SAY oSay PROMPT STR( 20 - LEN(TRIM(oGet:cText)), 3, 0 ) SIZE 20,10 PIXEL OF oDlg COLOR CLR_BLACK,CLR_WHITE

   ACTIVATE DIALOG oDlg CENTERED

   RELEASE FONT oFont

RETURN NIL

Whenever the user enters a character in the get, the say displays the remaining number of characters he can enter.
Regards



G. N. Rao.

Hyderabad, India
Posts: 10733
Joined: Sun Nov 19, 2006 05:22 AM
How to count input word in TGet?
Posted: Mon Dec 24, 2007 05:11 AM

Get ...On Change => can't refresh other objects .

Same problem to me , look like a bug .


From my above example you see that get on change can refresh other objects. There is no bug anywhere. It is just the way you use.
Regards



G. N. Rao.

Hyderabad, India
Posts: 59
Joined: Thu May 17, 2007 08:27 AM
How to count input word in TGet?
Posted: Mon Dec 24, 2007 06:02 AM
nageswaragunupudi , Thank YOU.



Define Get ...On Change oSAY1:REFRESH() ==> WORK

Define Get ...On Change OBJECT_REFRESH() ==> NOT WORK
..
FUNTION OBJECT_REFRESH()
..
..
oBJECT1():REFRESH()
oBJECT2():REFRESH()
oBJECT3():REFRESH()

RETURN NIL




Best Regards
kokoo
-------------

best regards

kokoo Kao
Posts: 10733
Joined: Sun Nov 19, 2006 05:22 AM
How to count input word in TGet?
Posted: Mon Dec 24, 2007 06:12 AM

Objects do refresh. You should ensure correct values to be reassigned to the object variables.
for example you wrote
nLEFT1:=LEN(PAY->RMK1)-LEN(TRIM(PAY->RMK1))
not correct
it should be
nLEFT1:=LEN(PAY->RMK1)-LEN(TRIM(oGet:cText))

Regards



G. N. Rao.

Hyderabad, India

Continue the discussion