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
Has thanked: 100 times
Been thanked: 182 times

Simulates "Set Confirm Off" and Overwrite in TextBoxes

Post by Pablo César » Sun Mar 23, 2014 1:47 am

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
Has thanked: 1 time
Been thanked: 2 times

Post by Javier Tovar » Sun Mar 23, 2014 2:10 am

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
Has thanked: 100 times
Been thanked: 182 times

Post by Pablo César » Sun Mar 23, 2014 2:25 am

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: 829
Joined: Fri Mar 20, 2009 11:38 am
DBs Used: DBF
Location: Alicante - Spain
Been thanked: 117 times
Contact:

Post by mustafa » Sun Mar 23, 2014 9:30 am

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 3069 times
Money_Exchange.zip
(20.04 KiB) Downloaded 139 times
Last edited by mustafa on Sun Mar 23, 2014 4:43 pm, edited 2 times in total.

User avatar
esgici
Posts: 4508
Joined: Wed Jul 30, 2008 9:17 pm
DBs Used: DBF
Location: iskenderun / Turkiye
Has thanked: 386 times
Been thanked: 111 times
Contact:

Post by esgici » Sun Mar 23, 2014 10:31 am

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
Has thanked: 100 times
Been thanked: 182 times

Post by Pablo César » Sun Mar 23, 2014 2:53 pm

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: 829
Joined: Fri Mar 20, 2009 11:38 am
DBs Used: DBF
Location: Alicante - Spain
Been thanked: 117 times
Contact:

Post by mustafa » Tue Apr 01, 2014 9:19 am

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 142 times
screenshot.jpg
screenshot.jpg (70.94 KiB) Viewed 2979 times

Javier Tovar
Posts: 1275
Joined: Tue Sep 03, 2013 4:22 am
Location: Tecámac, México
Has thanked: 1 time
Been thanked: 2 times

Post by Javier Tovar » Tue Apr 01, 2014 5:07 pm

Gracias Mustafa por compartir! :D

Saludos

User avatar
danielmaximiliano
Posts: 2117
Joined: Fri Apr 09, 2010 4:53 pm
Location: Argentina
Has thanked: 144 times
Been thanked: 20 times
Contact:

Post by danielmaximiliano » Tue Apr 01, 2014 5:20 pm

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

Saludos / Regards
DaNiElMaXiMiLiAnO

Whatsapp. : +54901169026142
Telegram Name : DaNiElMaXiMiLiAnO

User avatar
mustafa
Posts: 829
Joined: Fri Mar 20, 2009 11:38 am
DBs Used: DBF
Location: Alicante - Spain
Been thanked: 117 times
Contact:

Post by mustafa » Fri Apr 04, 2014 10:40 am

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 136 times
screenshot.jpg
screenshot.jpg (114.53 KiB) Viewed 2887 times

Post Reply