Simulate BackSpace on a Get resolved !!

Simulate BackSpace on a Get resolved !!

Postby Silvio.Falconi » Sat Apr 27, 2013 8:03 am

How I can simulate backspace on a get ? ( Explain : to delete one caracter from right to left)
Last edited by Silvio.Falconi on Mon May 06, 2013 6:17 pm, edited 1 time in total.
Since from 1991/1992 ( fw for clipper Rel. 14.4 - Momos)
I use : FiveWin for Harbour November 2023 - January 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
User avatar
Silvio.Falconi
 
Posts: 7056
Joined: Thu Oct 18, 2012 7:17 pm

Re: Simulate BackSpace on a Get

Postby ukoenig » Sat Apr 27, 2013 4: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.
User avatar
ukoenig
 
Posts: 4043
Joined: Wed Dec 19, 2007 6:40 pm
Location: Germany

Re: Simulate BackSpace on a Get

Postby Silvio.Falconi » Sat May 04, 2013 4:14 pm

yes
Since from 1991/1992 ( fw for clipper Rel. 14.4 - Momos)
I use : FiveWin for Harbour November 2023 - January 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
User avatar
Silvio.Falconi
 
Posts: 7056
Joined: Thu Oct 18, 2012 7:17 pm

Re: Simulate BackSpace on a Get

Postby James Bott » Sun May 05, 2013 3: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
User avatar
James Bott
 
Posts: 4840
Joined: Fri Nov 18, 2005 4:52 pm
Location: San Diego, California, USA

Re: Simulate BackSpace on a Get

Postby Silvio.Falconi » Sun May 05, 2013 4: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 November 2023 - January 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
User avatar
Silvio.Falconi
 
Posts: 7056
Joined: Thu Oct 18, 2012 7:17 pm

Re: Simulate BackSpace on a Get

Postby James Bott » Sun May 05, 2013 5:35 pm

Code: Select all  Expand view
// 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
User avatar
James Bott
 
Posts: 4840
Joined: Fri Nov 18, 2005 4:52 pm
Location: San Diego, California, USA

Re: Simulate BackSpace on a Get

Postby Armando » Sun May 05, 2013 6:06 pm

Silvio:

Using the James' example, try this code

Code: Select all  Expand view

// 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
User avatar
Armando
 
Posts: 3223
Joined: Fri Oct 07, 2005 8:20 pm
Location: Toluca, México

Re: Simulate BackSpace on a Get

Postby Silvio.Falconi » Sun May 05, 2013 7:49 pm

Sorry but not run ok

I re-made msgcalc() on W7

Image

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 November 2023 - January 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
User avatar
Silvio.Falconi
 
Posts: 7056
Joined: Thu Oct 18, 2012 7:17 pm

Re: Simulate BackSpace on a Get

Postby James Bott » Mon May 06, 2013 1: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
User avatar
James Bott
 
Posts: 4840
Joined: Fri Nov 18, 2005 4:52 pm
Location: San Diego, California, USA

Re: Simulate BackSpace on a Get

Postby Silvio.Falconi » Mon May 06, 2013 8:17 am

I made a button "<-" command with the ACTION
ACTION (oGet:oGet:varPut(left(oGet:oGet:varGet(),len(rtrim(oGet: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:oGet:varPut(left(oGet:oGet:varGet(),len(rtrim(oGet: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 November 2023 - January 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
User avatar
Silvio.Falconi
 
Posts: 7056
Joined: Thu Oct 18, 2012 7:17 pm

Re: Simulate BackSpace on a Get

Postby James Bott » Mon May 06, 2013 2:40 pm

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


You left out the oGet:refresh().

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

James
User avatar
James Bott
 
Posts: 4840
Joined: Fri Nov 18, 2005 4:52 pm
Location: San Diego, California, USA

Re: Simulate BackSpace on a Get

Postby Silvio.Falconi » Mon May 06, 2013 4:53 pm

nOW GIVE ME THIS ERROR
Code: Select all  Expand view
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 November 2023 - January 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
User avatar
Silvio.Falconi
 
Posts: 7056
Joined: Thu Oct 18, 2012 7:17 pm

Re: Simulate BackSpace on a Get

Postby James Bott » Mon May 06, 2013 5: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
User avatar
James Bott
 
Posts: 4840
Joined: Fri Nov 18, 2005 4:52 pm
Location: San Diego, California, USA

Re: Simulate BackSpace on a Get

Postby Silvio.Falconi » Mon May 06, 2013 5: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 November 2023 - January 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
User avatar
Silvio.Falconi
 
Posts: 7056
Joined: Thu Oct 18, 2012 7:17 pm

Re: Simulate BackSpace on a Get

Postby FranciscoA » Mon May 06, 2013 6:10 pm

Silvio, I think the error is caused for this:

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

Fwxh-MySql-TMySql
User avatar
FranciscoA
 
Posts: 2158
Joined: Fri Jul 18, 2008 1:24 am
Location: Chinandega, Nicaragua, C.A.

Next

Return to FiveWin for Harbour/xHarbour

Who is online

Users browsing this forum: jmartial and 75 guests