Simulates "Set Confirm Off" and Overwrite in TextBoxes

HMG Samples and Enhancements

Moderator: Rathinagiri

User avatar
Pablo César
Posts: 4059
Joined: Wed Sep 08, 2010 1:18 pm
Location: Curitiba - Brasil

Simulates "Set Confirm Off" and Overwrite in TextBoxes

Post by Pablo César »

This improved example was extracted from this post of Toledo forum which I believe could it be usefull and we wish to share with you.

Code: Select all

#include <hmg.ch>

Function Main()
SET NAVIGATION EXTENDED
SET DATE TO BRITISH
SET CENTURY ON

DEFINE WINDOW Form_1 AT 0,0 ;
    WIDTH 400 HEIGHT 175 NOSIZE ;
    TITLE 'Simulating SET CONFIRM OFF at TextBoxes' ;
    MAIN
    
    ON KEY ESCAPE ACTION ThisWindow.Release()
    
    DEFINE STATUSBAR FONT "Courier New" SIZE 9
        STATUSITEM PadC("Press <Insert> key and type again",44)
        STATUSITEM " Insert" WIDTH 94 ICON if ( IsInsertActive() , "zzz_led_off" , "zzz_led_on" )
    END STATUSBAR
    
    DEFINE LABEL Label_1
        ROW   20
        COL   30
        WIDTH 160
        VALUE 'Field 1 (Length 10):'
        FONTBOLD .T.
    END LABEL

    DEFINE TEXTBOX Text_1
        ROW       20
        COL       160
        WIDTH     180
        MAXLENGTH 10
        ON CHANGE {|| SetConfOFF(10,0) }
    END TEXTBOX

    DEFINE LABEL Label_2
        ROW    48
        COL    30
        WIDTH  160
        VALUE 'Field 2 (Length 10):'
        FONTBOLD .T.
    END LABEL

    DEFINE TEXTBOX Text_2
        ROW   48
        COL   160
        WIDTH   180
        MAXLENGTH 10
        DATE .T.
        ON CHANGE {|| SetConfOFF(10,0) }
    END TEXTBOX

    DEFINE LABEL Label_3
        ROW   76
        COL   30
        WIDTH 160
        VALUE 'Field 3 (Length 14):'
        FONTBOLD .T.
    END LABEL

    DEFINE TEXTBOX Text_3
        ROW     76
        COL     160
        WIDTH   180
        INPUTMASK "999.999.999-99"
        ON CHANGE {|| SetConfOFF(0,Len("999.999.999-99")) }
    END TEXTBOX
    
    _DefineTimer ( 'StatusKeyBrd' , "Form_1" , 50 , ;
        {|| _SetStatusIcon ( 'StatusBar' , "Form_1" , 2 , if ( IsInsertActive() , "zzz_led_off" , "zzz_led_on" ) ) } )

END WINDOW
CREATE EVENT PROCNAME OnkeyAllEditBox()
Form_1.Center
Form_1.Activate
Return Nil

Function SetConfOFF( nMaxLength, nInputMask )
Local cFrmName   := ThisWindow.Name
Local cCmpName   := This.FocusedControl

If nInputMask > 0
   nMaxLength := nInputMask
Endif
If !Empty(cCmpName)
   If nMaxLength == GetProperty(cFrmName,cCmpName,"CaretPos")
      InsertTab()
   Endif
Endif
Return Nil

Function OnkeyAllEditBox()
Local nIndex := GetControlIndexByHandle (EventHWND())

If nIndex > 0 .AND. GetControlTypeByIndex (nIndex) == "TEXT"
   If EventMSG() == WM_CHAR
      If .NOT. (GetKeyState (VK_INSERT) == 0) .AND. HMG_GetLastVirtualKeyDown() != VK_RETURN .AND. HMG_GetLastVirtualKeyDown() != VK_BACK
         SendMessage (EventHWND(), WM_KEYDOWN, VK_DELETE, 0)
         KSETINS(.T.)
      Else
         KSETINS(.F.)
      Endif
   Endif
Endif
Return NIL
This demo when editing and fill TextBox will change focus to next field. Also can be use overwrite editing but works only when is TEXT and with no mask in it.

I hope you enjoy it !
HMGing a better world
"Matter tells space how to curve, space tells matter how to move."
Albert Einstein
Javier Tovar
Posts: 1275
Joined: Tue Sep 03, 2013 4:22 am
Location: Tecámac, México

Re: Simulates "Set Confirm Off" and Overwrite in TextBoxes

Post by Javier Tovar »

Hola Pablo César,

Muy bonito ejemplo! Felicidades!

Saludos
User avatar
Pablo César
Posts: 4059
Joined: Wed Sep 08, 2010 1:18 pm
Location: Curitiba - Brasil

Simulates "Set Confirm Off" and Overwrite in TextBoxes

Post by Pablo César »

Gracias, Javier. Como siempre, muy atento ! :)
HMGing a better world
"Matter tells space how to curve, space tells matter how to move."
Albert Einstein
User avatar
mustafa
Posts: 1158
Joined: Fri Mar 20, 2009 11:38 am
DBs Used: DBF
Location: Alicante - Spain
Contact:

Re: Simulates "Set Confirm Off" and Overwrite in TextBoxes

Post by mustafa »

Hola amigo Pablo César
Encontre un sample del amigo LuchoMiranda "El Salmes"
sobre desglose de Cambio en la Moneda, estaba adaptando el
su ejemplo, cuando he visto tu magnifica rutina, me he permitido
adaptarla a mi codigo simplificando un poco, espero que les guste

Para que haga el salto automatico en TEXTBOX hay que poner
tambien los decimales ejemplo 234,00 € para que haga el salto
hay que poner los 2 ceros

Saludos
Mustafa
*-------------------------------- Google ----------------------------------------------*
Hello friend Pablo César
I found a sample LuchoMiranda Friend "The Salmes"
on breakdown of Currency Substitution, was adapting the
his example, when I saw your magnificent routine, I have allowed
adapt it to my code simplifying a bit, hope you like it

To make the automatic jump TEXTBOX must put
also decimal example 234.00 €to do the jump
must add 2 zeros

Regards
Mustafa :idea:
Attachments
Screenshot.jpg
Screenshot.jpg (57.72 KiB) Viewed 6465 times
Money_Exchange.zip
(20.04 KiB) Downloaded 316 times
Last edited by mustafa on Sun Mar 23, 2014 4:43 pm, edited 2 times in total.
User avatar
esgici
Posts: 4543
Joined: Wed Jul 30, 2008 9:17 pm
DBs Used: DBF
Location: iskenderun / Turkiye
Contact:

Re: Simulates "Set Confirm Off" and Overwrite in TextBoxes

Post by esgici »

Thanks, Pablo and Mustafa :)

Both samples are useful and educative :arrow:

Viva HMG :D
Viva INTERNATIONAL HMG :D
User avatar
Pablo César
Posts: 4059
Joined: Wed Sep 08, 2010 1:18 pm
Location: Curitiba - Brasil

Simulates "Set Confirm Off" and Overwrite in TextBoxes

Post by Pablo César »

Gracias Mustafa por tu contribuicion y me alegra que te haya sido útil.

Thank you Esgici for your usual interest.
HMGing a better world
"Matter tells space how to curve, space tells matter how to move."
Albert Einstein
User avatar
mustafa
Posts: 1158
Joined: Fri Mar 20, 2009 11:38 am
DBs Used: DBF
Location: Alicante - Spain
Contact:

Re: Simulates "Set Confirm Off" and Overwrite in TextBoxes

Post by mustafa »

Hola amigos:
Les presento una ampliación del Sample anterior
he incorporado opción tarjeta de Crédito, salvar
ventas en un fichero y opción a Listado Reporter
espero que les guste.
Saludos
Mustafa
*--------------- Google -----------------------*
Hello friends:
I present an extension of the previous Sample
I have incorporated credit card option, save
sales in a file and option Reporter Listing
hope you like.
regards
Mustafa :idea:
Attachments
Money_Exchange_New.zip
(130.52 KiB) Downloaded 324 times
screenshot.jpg
screenshot.jpg (70.94 KiB) Viewed 6375 times
Javier Tovar
Posts: 1275
Joined: Tue Sep 03, 2013 4:22 am
Location: Tecámac, México

Re: Simulates "Set Confirm Off" and Overwrite in TextBoxes

Post by Javier Tovar »

Gracias Mustafa por compartir! :D

Saludos
User avatar
danielmaximiliano
Posts: 2611
Joined: Fri Apr 09, 2010 4:53 pm
Location: Argentina
Contact:

Re: Simulates "Set Confirm Off" and Overwrite in TextBoxes

Post by danielmaximiliano »

Muy bueno Mustafá.....
*´¨)
¸.·´¸.·*´¨) ¸.·*¨)
(¸.·´. (¸.·` *
.·`. Harbour/HMG : It's magic !
(¸.·``··*

Saludos / Regards
DaNiElMaXiMiLiAnO

Whatsapp. := +54901169026142
Telegram Name := DaNiElMaXiMiLiAnO
User avatar
mustafa
Posts: 1158
Joined: Fri Mar 20, 2009 11:38 am
DBs Used: DBF
Location: Alicante - Spain
Contact:

Re: Simulates "Set Confirm Off" and Overwrite in TextBoxes

Post by mustafa »

Hola amigos:
Nueva ampliación del Sample
He incorporado Password y Usuario
que se graba en Base de Datos de Ventas
asi como Hora de la operación ver listado
Lean Fichero 'readme_key.pdf' donde hay
unos permisos autorizados.
Espero les guste
Saludos
Mustafa
*----------------- Google -------------------*
Hello friends:
Further enlargement of the Sample
I incorporated Password and User
which is recorded in Sales Database
also see Operation Time List
Read file 'readme_key.pdf' where
some permits authorized.
Hope you like
regards
Mustafa :idea:
Attachments
Money_Exchange_New.zip
(1.34 MiB) Downloaded 314 times
screenshot.jpg
screenshot.jpg (114.53 KiB) Viewed 6283 times
Post Reply