FiveTech Support Forums

FiveWin / Harbour / xBase community
Board index FiveWin for Harbour/xHarbour Simulate BackSpace on a Get resolved !!
Posts: 7317
Joined: Thu Oct 18, 2012 07:17 PM
Simulate BackSpace on a Get resolved !!
Posted: Sat Apr 27, 2013 08:03 AM

How I can simulate backspace on a get ? ( Explain : to delete one caracter from right to left)

Since from 1991/1992 ( fw for clipper Rel. 14.4 - Momos)

I use : FiveWin for Harbour March-April 2024 - Harbour 3.2.0dev (harbour_bcc770_32_20240309) - Bcc7.70 - xMate ver. 1.15.3 - PellesC - mail: silvio[dot]falconi[at]gmail[dot]com
Posts: 4043
Joined: Wed Dec 19, 2007 06:40 PM
Re: Simulate BackSpace on a Get
Posted: Sat Apr 27, 2013 04:35 PM

Silvio,

do You want to delete a caracter on BUTTONACTION ?

Regards
Uwe :?:

Since 1995 ( the first release of FW 1.9 )

i work with FW.

If you have any questions about special functions, maybe i can help.
Posts: 7317
Joined: Thu Oct 18, 2012 07:17 PM
Re: Simulate BackSpace on a Get
Posted: Sat May 04, 2013 04:14 PM

yes

Since from 1991/1992 ( fw for clipper Rel. 14.4 - Momos)

I use : FiveWin for Harbour March-April 2024 - Harbour 3.2.0dev (harbour_bcc770_32_20240309) - Bcc7.70 - xMate ver. 1.15.3 - PellesC - mail: silvio[dot]falconi[at]gmail[dot]com
Posts: 4840
Joined: Fri Nov 18, 2005 04:52 PM
Re: Simulate BackSpace on a Get
Posted: Sun May 05, 2013 03:08 PM

Maybe something like:

oGet:oGet:varPut(left(oGet:oGet:varGet(),len(rtrim(oGet:oGet:varGet())-1)))

Note that FW's TGet class contains an oGet object thus the syntax oGet:oGet.

Regards,
James

FWH 18.05/xHarbour 1.2.3/BCC7/Windows 10
Posts: 7317
Joined: Thu Oct 18, 2012 07:17 PM
Re: Simulate BackSpace on a Get
Posted: Sun May 05, 2013 04:26 PM

I need it on msgcalc and your line not run good

Since from 1991/1992 ( fw for clipper Rel. 14.4 - Momos)

I use : FiveWin for Harbour March-April 2024 - Harbour 3.2.0dev (harbour_bcc770_32_20240309) - Bcc7.70 - xMate ver. 1.15.3 - PellesC - mail: silvio[dot]falconi[at]gmail[dot]com
Posts: 4840
Joined: Fri Nov 18, 2005 04:52 PM
Re: Simulate BackSpace on a Get
Posted: Sun May 05, 2013 05:35 PM
Code (fw): Select all Collapse
// Purpose: Show simulated backspace for a GET
// Author : James Bott
// Date   : 5/5/2013

#include "fivewin.ch"

function Main()
   local oDlg, cVar, oGet, oBtn

   cVar:="12345    "

   define dialog oDlg

   @ 2,2 get oGet var cVar of oDlg

   @ 3,2 button oBtn ;
     action (oGet:oGet:varPut( left( oGet:oGet:varGet(),len( rtrim(oGet:oGet:varGet()) )-1) ), oGet:refresh() )

   activate dialog oDlg center

return nil
FWH 18.05/xHarbour 1.2.3/BCC7/Windows 10
Posts: 3358
Joined: Fri Oct 07, 2005 08:20 PM
Re: Simulate BackSpace on a Get
Posted: Sun May 05, 2013 06:06 PM
Silvio:

Using the James' example, try this code

Code (fw): Select all Collapse
// Purpose: Show simulated backspace for a GET
// Author : James Bott
// Date   : 5/5/2013

#include "fivewin.ch"
#include "vKey.ch"       // Don't forget this line

function Main()
   local oDlg, cVar, oGet, oBtn

   cVar:="12345    "

   define dialog oDlg

   @ 2,2 get oGet var cVar of oDlg

   @ 3,2 button oBtn ;
     action Teclado(oDlg,VK_BACK,1)

   activate dialog oDlg center

return nil


/*
* -------------------------------------------------------------------------*
* -------------------------------------------------------------------------*
*/
FUNCTION Teclado(oDlg,nKey,nTimes)
    LOCAL nTime
    DEFAULT nTimes := 1

    oDlg:SETFOCUS()
    FOR nTime := 1 TO nTimes
        oDlg:POSTMSG(WM_KEYDOWN,nKey,0)
    NEXT
RETURN (NIL)


Regards
SOI, s.a. de c.v.
estbucarm@gmail.com
http://www.soisa.mex.tl/
http://sqlcmd.blogspot.com/
Tel. (722) 174 44 45
Carpe diem quam minimum credula postero
Posts: 7317
Joined: Thu Oct 18, 2012 07:17 PM
Re: Simulate BackSpace on a Get
Posted: Sun May 05, 2013 07:49 PM
Sorry but not run ok

I re-made msgcalc() on W7



I wish use the butoon <- to erase cr on the get
Since from 1991/1992 ( fw for clipper Rel. 14.4 - Momos)

I use : FiveWin for Harbour March-April 2024 - Harbour 3.2.0dev (harbour_bcc770_32_20240309) - Bcc7.70 - xMate ver. 1.15.3 - PellesC - mail: silvio[dot]falconi[at]gmail[dot]com
Posts: 4840
Joined: Fri Nov 18, 2005 04:52 PM
Re: Simulate BackSpace on a Get
Posted: Mon May 06, 2013 01:25 AM

Silvio,

>Sorry but not run ok

First my example does run OK. Making the statement above does not give us anything to work with. You haven't showed us the code or explained exactly what you are trying to do, nor have you said exactly what is happening with what you tried (i.e. error message, not working the way you want, nothing happening, or what?).

James

FWH 18.05/xHarbour 1.2.3/BCC7/Windows 10
Posts: 7317
Joined: Thu Oct 18, 2012 07:17 PM
Re: Simulate BackSpace on a Get
Posted: Mon May 06, 2013 08:17 AM
I made a button "<-" command with the ACTION
ACTION (oGet:varPut(left(oGet:varGet(),len(rtrim(oGet:varGet())-1))))

I have a Get oGet and a GEt oRes
if you see msgcalc() function perhaps you understand

I put thi command insteas of btnpaste button

@ 0,0.5 GET oGet VAR cGet OF oDlg SIZE 95,10
oGet:bChange := {|nKey,nFlag,oB|(Chr(nKey)$"0123456789.")} // Logical
oGet:bKeyDown := { | nKey | VerKey(nKey,oBSum,oBMin,oBMol,oBDiv,oBPer,oBCan,oBRes) }

@ 1,5.6 GET oRes VAR cRes OF oDlg SIZE 55,10 RIGHT COLOR CLR_RED,CLR_WHITE READONLY
//@ 1.3,1 BUTTON oBtn PROMPT "&Paste" OF oDlg ACTION (oBCan:Click(),SayNum(oGet,nVal)) FONT oFont SIZE 38,10

@ 1.3,1 BUTTON oBtn PROMPT "<-" OF oDlg ACTION(oGet:varPut(left(oGet:varGet(),len(rtrim(oGet:varGet())-1)))) FONT oFont SIZE 38,10


I click on <- button and it not make any command
Since from 1991/1992 ( fw for clipper Rel. 14.4 - Momos)

I use : FiveWin for Harbour March-April 2024 - Harbour 3.2.0dev (harbour_bcc770_32_20240309) - Bcc7.70 - xMate ver. 1.15.3 - PellesC - mail: silvio[dot]falconi[at]gmail[dot]com
Posts: 4840
Joined: Fri Nov 18, 2005 04:52 PM
Re: Simulate BackSpace on a Get
Posted: Mon May 06, 2013 02:40 PM
@ 1.3,1 BUTTON oBtn PROMPT "<-" OF oDlg ACTION(oGet:varPut(left(oGet:varGet(),len(rtrim(oGet:varGet())-1)))) FONT oFont SIZE 38,10


You left out the oGet:refresh().

@ 1.3,1 BUTTON oBtn PROMPT "<-" OF oDlg ACTION(oGet:varPut(left(oGet:varGet(),len(rtrim(oGet:varGet())-1)))), oGet:refresh() ) FONT oFont SIZE 38,10

James
FWH 18.05/xHarbour 1.2.3/BCC7/Windows 10
Posts: 7317
Joined: Thu Oct 18, 2012 07:17 PM
Re: Simulate BackSpace on a Get
Posted: Mon May 06, 2013 04:53 PM
nOW GIVE ME THIS ERROR
Code (fw): Select all Collapse
Application
===========
   Path and name: C:\Work\Prg\msgcalc\msgcalc.Exe (32 bits)
   Size: 2,137,088 bytes
   Compiler version: xHarbour build 1.2.1 Intl. (SimpLex) (Rev. 6715)
   FiveWin  Version: FWHX 12.03
   Windows version: 6.1, Build 7600 

   Time from start: 0 hours 0 mins 5 secs 
   Error occurred at: 05/06/13, 18:52:15
   Error description: Error BASE/1082  Argument error: -
   Args:
     [   1] = C   123456
     [   2] = N   1

Stack Calls
===========
   Called from: msgcalc.prg => (b)MSGCALC( 126 )
   Called from: .\source\classes\BUTTON.PRG => TBUTTON:CLICK( 157 )
   Called from: .\source\classes\CONTROL.PRG => TBUTTON:HANDLEEVENT( 1654 )
   Called from: .\source\classes\WINDOW.PRG => _FWH( 3153 )
   Called from:  => SENDMESSAGE( 0 )
   Called from: .\source\classes\DIALOG.PRG => TDIALOG:COMMAND( 379 )
   Called from:  => TWINDOW:HANDLEEVENT( 0 )
   Called from: .\source\classes\DIALOG.PRG => TDIALOG:HANDLEEVENT( 886 )
   Called from:  => DIALOGBOXINDIRECT( 0 )
   Called from: .\source\classes\DIALOG.PRG => TDIALOG:ACTIVATE( 270 )
   Called from: msgcalc.prg => MSGCALC( 369 )
Since from 1991/1992 ( fw for clipper Rel. 14.4 - Momos)

I use : FiveWin for Harbour March-April 2024 - Harbour 3.2.0dev (harbour_bcc770_32_20240309) - Bcc7.70 - xMate ver. 1.15.3 - PellesC - mail: silvio[dot]falconi[at]gmail[dot]com
Posts: 4840
Joined: Fri Nov 18, 2005 04:52 PM
Re: Simulate BackSpace on a Get
Posted: Mon May 06, 2013 05:34 PM

Well, I answered your original question of how to simulate a backspace with a button. Now you are trying to debug a larger program which could take some work. I suggest commenting out the bChange and bKeydown codeblocks first to see if they are causing the problem.

James

FWH 18.05/xHarbour 1.2.3/BCC7/Windows 10
Posts: 7317
Joined: Thu Oct 18, 2012 07:17 PM
Re: Simulate BackSpace on a Get
Posted: Mon May 06, 2013 05:59 PM

James,
do you Know msgcalc() ?
I not think it have problems on

oGet:bChange := {|nKey,nFlag,oB|(Chr(nKey)$"0123456789.")}
oGet:bKeyDown := { | nKey | Load_Get(oGet),VerKey( nKey, oBSum, oBMin, oBMol,oBDiv, oBPer, oBCan, oBRes ) }

and if we change Len(AllTrim(oGet:cText) instead of oGet:oGet ... ?

Since from 1991/1992 ( fw for clipper Rel. 14.4 - Momos)

I use : FiveWin for Harbour March-April 2024 - Harbour 3.2.0dev (harbour_bcc770_32_20240309) - Bcc7.70 - xMate ver. 1.15.3 - PellesC - mail: silvio[dot]falconi[at]gmail[dot]com
Posts: 2170
Joined: Fri Jul 18, 2008 01:24 AM
Re: Simulate BackSpace on a Get
Posted: Mon May 06, 2013 06:10 PM
Silvio, I think the error is caused for this:

The code You show is: len(rtrim(oGet:varGet())-1)
I think the correct way is: len( rtrim(oGet:varGet()) )-1
Regards.
Francisco J. Alegría P.

Chinandega, Nicaragua.



Fwxh-MySql-TMySql