Undo function (Ctrl+Z) in :TGet
Undo function (Ctrl+Z) in :TGet
Has it got UNDO function alike Ctrl+Z in :TGet? I cannot find it.
Thank you in advance for any suggestion and idea.
Dutch
Thank you in advance for any suggestion and idea.
Dutch
Regards,
Dutch
FWH 19.01 / xHarbour Simplex 1.2.3 / BCC73 / Pelles C / UEStudio
FWPPC 10.02 / Harbour for PPC (FTDN)
ADS V.9 / MySql / MariaDB
R&R 12 Infinity / Crystal Report XI R2
(Thailand)
Dutch
FWH 19.01 / xHarbour Simplex 1.2.3 / BCC73 / Pelles C / UEStudio
FWPPC 10.02 / Harbour for PPC (FTDN)
ADS V.9 / MySql / MariaDB
R&R 12 Infinity / Crystal Report XI R2
(Thailand)
- nageswaragunupudi
- Posts: 10721
- Joined: Sun Nov 19, 2006 5:22 am
- Location: India
- Been thanked: 8 times
- Contact:
Re: Undo function (Ctrl+Z) in :TGet
Please try
Code: Select all | Expand
oGet:Undo()
Regards
G. N. Rao.
Hyderabad, India
G. N. Rao.
Hyderabad, India
Re: Undo function (Ctrl+Z) in :TGet
Dear Master,
It doesn't work. Nothing change, any editing still the same. It doesn't change back to original.
It doesn't work. Nothing change, any editing still the same. It doesn't change back to original.
nageswaragunupudi wrote:Please tryCode: Select all | Expand
oGet:Undo()
Last edited by dutch on Sun Oct 31, 2021 2:07 pm, edited 1 time in total.
Regards,
Dutch
FWH 19.01 / xHarbour Simplex 1.2.3 / BCC73 / Pelles C / UEStudio
FWPPC 10.02 / Harbour for PPC (FTDN)
ADS V.9 / MySql / MariaDB
R&R 12 Infinity / Crystal Report XI R2
(Thailand)
Dutch
FWH 19.01 / xHarbour Simplex 1.2.3 / BCC73 / Pelles C / UEStudio
FWPPC 10.02 / Harbour for PPC (FTDN)
ADS V.9 / MySql / MariaDB
R&R 12 Infinity / Crystal Report XI R2
(Thailand)
- karinha
- Posts: 7935
- Joined: Tue Dec 20, 2005 7:36 pm
- Location: São Paulo - Brasil
- Been thanked: 3 times
- Contact:
Re: Undo function (Ctrl+Z) in :TGet
Code: Select all | Expand
// By Marco Boschi
#Include "Fivewin.Ch"
#Define EM_SETSEL 177
FUNCTION main()
LOCAL oDlg
LOCAL oGet1, cGet1 := "Marco "
LOCAL oGet2, cGet2 := "Enrico "
LOCAL oGet3, cGet3 := " "
DEFINE DIALOG oDlg
@ 1,1 GET oGet1 VAR cGet1 OF oDlg UPDATE
oGet1:bGotFocus := { || oGet1:PostMsg( EM_SETSEL, Len( RTrim( cGet1 ) ), 0 ) }
oGet1:bRClicked := { || PopGet( oGet1 ) }
@ 2,1 get oGet2 VAR cGet2 of oDlg UPDATE
oGet2:bGotFocus := { || oGet2:PostMsg( EM_SETSEL, Len( RTrim( cGet2 ) ), 0 ) }
oGet2:bRClicked := { || PopGet( oGet2 ) }
@ 3,1 get oGet3 VAR cGet3 of oDlg UPDATE
oGet3:bGotFocus := { || oGet3:PostMsg( EM_SETSEL, Len( RTrim( cGet3 ) ), 0 ) }
oGet3:bRClicked := { || PopGet( oGet3 ) }
ACTIVATE DIALOG oDlg CENTERED
RETURN NIL
FUNCTION POPGET( oGet )
LOCAL oMenu
MENU POPUP oMenu 2007
MENUITEM "Cut" ; // "Cortar"
ACTION( oGet:Cut() )
MENUITEM "Copy" ; // "Copiar"
ACTION( oGet:Copy() )
MENUITEM "Paste" ; // "Pegar"
ACTION( cPaste( oGet ) )
MENUITEM "Cancel" ; // "Cancelar"
ACTION( oGet:Undo() )
MENUITEM "Empty" ; // "Vacío"
ACTION( sClear( oGet ) )
MENUITEM "Select" ; // "Seleccionar"
ACTION oGet:PostMsg( EM_SETSEL, Len( RTrim( oGet:Varget() ) ), 0 )
MENUITEM "Select all" ; // "Seleccionar todo"
ACTION( oGet:SelectAll() )
ENDMENU
oMenu:Activate( oGet:nBottom, oGet:nLeft, oGet )
RETURN NIL
FUNCTION sClear( oGet )
M->xSvuotata := oGet:Varget()
M->cGetCargo := oGet:Cargo
oGet:VarPut( uValBlank( oGet:VarGet() ) )
oGet:Refresh()
RETURN NIL
FUNCTION cPaste( oGet )
LOCAL nLo, nHi
oGet:GetSelPos( @nLo, @nHi )
IF nHi != nLo
oGet:GetDelSel( nLo, nHi )
ENDIF
oGet:EditUpdate()
oGet:Paste()
RETURN NIL
Regards, saludos.
João Santos - São Paulo - Brasil - Phone: +55(11)95150-7341
Re: Undo function (Ctrl+Z) in :TGet
Dear karinha,
Your sample is working and I got it. TGet:undo() must still TGet in Focus.
Is it possible to add Ctrl+Z to TGet for :undo()?
I try as below at the main but ;
1. it works in case of typing more charactor.
2. it doesn't work in case delete some charactor.
Your sample is working and I got it. TGet:undo() must still TGet in Focus.
Is it possible to add Ctrl+Z to TGet for :undo()?
I try as below at the main but ;
1. it works in case of typing more charactor.
2. it doesn't work in case delete some charactor.
Code: Select all | Expand
SETKEY( 26 , {|p, l, v| v:Undo() } )
karinha wrote:Code: Select all | Expand
// By Marco Boschi
#Include "Fivewin.Ch"
#Define EM_SETSEL 177
FUNCTION main()
LOCAL oDlg
LOCAL oGet1, cGet1 := "Marco "
LOCAL oGet2, cGet2 := "Enrico "
LOCAL oGet3, cGet3 := " "
DEFINE DIALOG oDlg
@ 1,1 GET oGet1 VAR cGet1 OF oDlg UPDATE
oGet1:bGotFocus := { || oGet1:PostMsg( EM_SETSEL, Len( RTrim( cGet1 ) ), 0 ) }
oGet1:bRClicked := { || PopGet( oGet1 ) }
@ 2,1 get oGet2 VAR cGet2 of oDlg UPDATE
oGet2:bGotFocus := { || oGet2:PostMsg( EM_SETSEL, Len( RTrim( cGet2 ) ), 0 ) }
oGet2:bRClicked := { || PopGet( oGet2 ) }
@ 3,1 get oGet3 VAR cGet3 of oDlg UPDATE
oGet3:bGotFocus := { || oGet3:PostMsg( EM_SETSEL, Len( RTrim( cGet3 ) ), 0 ) }
oGet3:bRClicked := { || PopGet( oGet3 ) }
ACTIVATE DIALOG oDlg CENTERED
RETURN NIL
FUNCTION POPGET( oGet )
LOCAL oMenu
MENU POPUP oMenu 2007
MENUITEM "Cut" ; // "Cortar"
ACTION( oGet:Cut() )
MENUITEM "Copy" ; // "Copiar"
ACTION( oGet:Copy() )
MENUITEM "Paste" ; // "Pegar"
ACTION( cPaste( oGet ) )
MENUITEM "Cancel" ; // "Cancelar"
ACTION( oGet:Undo() )
MENUITEM "Empty" ; // "Vacío"
ACTION( sClear( oGet ) )
MENUITEM "Select" ; // "Seleccionar"
ACTION oGet:PostMsg( EM_SETSEL, Len( RTrim( oGet:Varget() ) ), 0 )
MENUITEM "Select all" ; // "Seleccionar todo"
ACTION( oGet:SelectAll() )
ENDMENU
oMenu:Activate( oGet:nBottom, oGet:nLeft, oGet )
RETURN NIL
FUNCTION sClear( oGet )
M->xSvuotata := oGet:Varget()
M->cGetCargo := oGet:Cargo
oGet:VarPut( uValBlank( oGet:VarGet() ) )
oGet:Refresh()
RETURN NIL
FUNCTION cPaste( oGet )
LOCAL nLo, nHi
oGet:GetSelPos( @nLo, @nHi )
IF nHi != nLo
oGet:GetDelSel( nLo, nHi )
ENDIF
oGet:EditUpdate()
oGet:Paste()
RETURN NIL
Regards, saludos.
Regards,
Dutch
FWH 19.01 / xHarbour Simplex 1.2.3 / BCC73 / Pelles C / UEStudio
FWPPC 10.02 / Harbour for PPC (FTDN)
ADS V.9 / MySql / MariaDB
R&R 12 Infinity / Crystal Report XI R2
(Thailand)
Dutch
FWH 19.01 / xHarbour Simplex 1.2.3 / BCC73 / Pelles C / UEStudio
FWPPC 10.02 / Harbour for PPC (FTDN)
ADS V.9 / MySql / MariaDB
R&R 12 Infinity / Crystal Report XI R2
(Thailand)
- karinha
- Posts: 7935
- Joined: Tue Dec 20, 2005 7:36 pm
- Location: São Paulo - Brasil
- Been thanked: 3 times
- Contact:
Re: Undo function (Ctrl+Z) in :TGet
Maybe:
http://forums.fivetechsupport.com/viewtopic.php?f=6&t=8985
Regards, saludos.
Code: Select all | Expand
#Define VK_Z 26 // 538 ?
SetKey( VK_Z, {|| IF( GetKeyState( VK_CONTROL ), MY_FUNCTION(), NIL ) } )
http://forums.fivetechsupport.com/viewtopic.php?f=6&t=8985
Regards, saludos.
João Santos - São Paulo - Brasil - Phone: +55(11)95150-7341
- nageswaragunupudi
- Posts: 10721
- Joined: Sun Nov 19, 2006 5:22 am
- Location: India
- Been thanked: 8 times
- Contact:
Re: Undo function (Ctrl+Z) in :TGet
dutch wrote:Dear Master,
It doesn't work. Nothing change, any editing still the same. It doesn't change back to original.nageswaragunupudi wrote:Please tryCode: Select all | Expand
oGet:Undo()
This is far better than oGet:Undo()
Code: Select all | Expand
oGet:cText := oGet:uOriginalValue
Regards
G. N. Rao.
Hyderabad, India
G. N. Rao.
Hyderabad, India
Re: Undo function (Ctrl+Z) in :TGet
Dear Karinha,
SetKey() do not accept CTRL+Z. It doesn't go through My_Function().
SetKey() do not accept CTRL+Z. It doesn't go through My_Function().
karinha wrote:Maybe:Code: Select all | Expand
#Define VK_Z 26 // 538 ?
SetKey( VK_Z, {|| IF( GetKeyState( VK_CONTROL ), MY_FUNCTION(), NIL ) } )
http://forums.fivetechsupport.com/viewtopic.php?f=6&t=8985
Regards, saludos.
Regards,
Dutch
FWH 19.01 / xHarbour Simplex 1.2.3 / BCC73 / Pelles C / UEStudio
FWPPC 10.02 / Harbour for PPC (FTDN)
ADS V.9 / MySql / MariaDB
R&R 12 Infinity / Crystal Report XI R2
(Thailand)
Dutch
FWH 19.01 / xHarbour Simplex 1.2.3 / BCC73 / Pelles C / UEStudio
FWPPC 10.02 / Harbour for PPC (FTDN)
ADS V.9 / MySql / MariaDB
R&R 12 Infinity / Crystal Report XI R2
(Thailand)
Re: Undo function (Ctrl+Z) in :TGet
Dear Master,
The problem is SetKey() do not accept CTRL+Z.
Code: Select all | Expand
oGet:undo() -> works
oGet:cText := v:oGet:Original -> works
// Do not response
SETKEY( 26 , {|p, l, v| GetUndo(v) } ) // or
SetKey( VK_Z, {|p, l, v| IF( GetKeyState( VK_CONTROL ), GetUndo(v), NIL ) } )
The problem is SetKey() do not accept CTRL+Z.
nageswaragunupudi wrote:dutch wrote:Dear Master,
It doesn't work. Nothing change, any editing still the same. It doesn't change back to original.nageswaragunupudi wrote:Please tryCode: Select all | Expand
oGet:Undo()
This is far better than oGet:Undo()Code: Select all | Expand
oGet:cText := oGet:uOriginalValue
Regards,
Dutch
FWH 19.01 / xHarbour Simplex 1.2.3 / BCC73 / Pelles C / UEStudio
FWPPC 10.02 / Harbour for PPC (FTDN)
ADS V.9 / MySql / MariaDB
R&R 12 Infinity / Crystal Report XI R2
(Thailand)
Dutch
FWH 19.01 / xHarbour Simplex 1.2.3 / BCC73 / Pelles C / UEStudio
FWPPC 10.02 / Harbour for PPC (FTDN)
ADS V.9 / MySql / MariaDB
R&R 12 Infinity / Crystal Report XI R2
(Thailand)
- nageswaragunupudi
- Posts: 10721
- Joined: Sun Nov 19, 2006 5:22 am
- Location: India
- Been thanked: 8 times
- Contact:
Re: Undo function (Ctrl+Z) in :TGet
oGet:undo() -> works
Works only when oGet has focus. By any chance/mistake if oGet:undo() is called when oGet is out of focus, unexpected and undesirable results can happen.
oGet:cText := v:oGet:Original -> works
This works always.
Actually, I am testing and considering changing Undo() method of TGet to implement the second logic.
Do not use SETKEY.
If you want to undo when the user presses Ctrl-Z while editing the Get, then
Code: Select all | Expand
oGet:bKeyChar := { |k,f,o| If( k == 26, ( o:cText := o:uOriginalValue, 0 ), nil ) }
Regards
G. N. Rao.
Hyderabad, India
G. N. Rao.
Hyderabad, India
Re: Undo function (Ctrl+Z) in :TGet
Dear Master,
Can it do in TGet classes?
Can it do in TGet classes?
nageswaragunupudi wrote:Do not use SETKEY.
If you want to undo when the user presses Ctrl-Z while editing the Get, thenCode: Select all | Expand
oGet:bKeyChar := { |k,f,o| If( k == 26, ( o:cText := o:uOriginalValue, 0 ), nil ) }
Regards,
Dutch
FWH 19.01 / xHarbour Simplex 1.2.3 / BCC73 / Pelles C / UEStudio
FWPPC 10.02 / Harbour for PPC (FTDN)
ADS V.9 / MySql / MariaDB
R&R 12 Infinity / Crystal Report XI R2
(Thailand)
Dutch
FWH 19.01 / xHarbour Simplex 1.2.3 / BCC73 / Pelles C / UEStudio
FWPPC 10.02 / Harbour for PPC (FTDN)
ADS V.9 / MySql / MariaDB
R&R 12 Infinity / Crystal Report XI R2
(Thailand)
- nageswaragunupudi
- Posts: 10721
- Joined: Sun Nov 19, 2006 5:22 am
- Location: India
- Been thanked: 8 times
- Contact:
Re: Undo function (Ctrl+Z) in :TGet
Can it do in TGet classes?
Yes.
Posted after testing.
Regards
G. N. Rao.
Hyderabad, India
G. N. Rao.
Hyderabad, India