Problem with valid email refresh btnbmp- RESOLVED

Problem with valid email refresh btnbmp- RESOLVED

Postby Silvio.Falconi » Wed Apr 03, 2024 12:30 pm

I can't get a bt bmp control to update from a tget control that has a valid to check whether the email entered is valid or not

initially the btnbmp check must be disabled

the btnbmp control has two bitmaps one when the logical value is true and another when the logical value is false

when I enter an email the btnbmp check doesn't update yet the email is true

the small test

Code: Select all  Expand view


#include "FiveWin.ch"
#include "Constant.ch"

// validate email


Function test()
local oDlg
local aGet:=array(20)
local oBtnSel:=array(20)

local cCodEmail:= space(30)
local lPienoEmail:=.f.

     local nRow:= 0,nCol:= 10
    local nInterlinea := 26
   local nSizeHGet:=21

DEFINE DIALOG oDlg SIZE 800,300 PIXEL TRUEPIXEL

@ 10, 420 GET aGet[11] VAR cCodEmail SIZE 180,nSizeHGet PIXEL OF oDlg;
           ON CHANGE  ( IIF(validaEmail(cCodEmail),lPienoEmail:=.f.,lPienoEmail:=.t.) ,;
                             oBtnSel[4]:REFRESH())

 @  10, 615 BTNBMP oBtnSel[4] ;
            RESOURCE IIF( lPienoEmail, "SEL_PIE","SEL_VUO") , "", "SEL_VUO", "";
            SIZE 120, 22 PIXEL FLAT NOROUND GDIP OF oDlg ;
            PROMPT "Account Invio" LEFT;
            ACTION ( Account_Invio_Email(@lPienoEmail),;
                IIF( !empty(cCodEmail),;
                 (oBtnSel[4]:Enable(), oBtnSel[4]:SETFILE("SEL_PIE")),;
                 (oBtnSel[4]:Disable(),oBtnSel[4]:SETFILE("SEL_VUO")) ) ) UPDATE


IIF( validaEmail(cCodEmail),;
                 (oBtnSel[4]:Enable(), oBtnSel[4]:SETFILE("SEL_PIE")),;
                 (oBtnSel[4]:Disable(),oBtnSel[4]:SETFILE("SEL_VUO")) )

ACTIVATE DIALOG oDLG  CENTERED
return nil


Function Account_Invio_Email(lPienoEmail);return nil


function validaEmail(cEmail)
    LOCAL pCompiled := hb_regexComp("^[_a-z0-9-]+(\.[_a-z0-9-]+)*@[a-z0-9-]+(\.[a-z0-9-]+)*(\.[a-z]{2,4})$")
    LOCAL aMatch
    LOCAL cRet := .t.
    aMatch = hb_regex( pCompiled, alltrim(cEmail) )
    if Empty( aMatch )
        cRet := .f.
    end
return cRet

 
Last edited by Silvio.Falconi on Sun Apr 14, 2024 6:38 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: 7004
Joined: Thu Oct 18, 2012 7:17 pm

Re: Problem with valid email refresh btnbmp

Postby Daniel Segura » Wed Apr 03, 2024 2:16 pm

change the line

@ 10, 420 GET aGet[11] VAR cCodEmail SIZE 180,nSizeHGet PIXEL OF oDlg;
ON CHANGE ( lPienoEmail:=validaEmail(aGet[11]:ctitle) , if( lPienoEmail , oBtnSel[4]:Enable() , oBtnSel[4]:Disable() ) )

if Valtype(aMatch)='A' //Empty( aMatch )
Daniel Segura
 
Posts: 7
Joined: Thu Sep 14, 2006 12:32 am
Location: Brasil - São Paulo - Mairinque

Re: Problem with valid email refresh btnbmp

Postby nageswaragunupudi » Wed Apr 03, 2024 5:08 pm

Try
Code: Select all  Expand view
function SilviBtnBmp()

   local oDlg, oGet, oBtn, oFont
   local cEmail      := Space( 40 )

   SetGetColorFocus()

   DEFINE FONT oFont NAME "Segoe UI" SIZE 0,-24
   DEFINE DIALOG oDlg SIZE 600,300 PIXEL TRUEPIXEL FONT oFont

   @  40,40 GET oGet VAR cEmail SIZE 400,40 PIXEL OF oDlg ;
      ON CHANGE ( oDlg:AEvalWhen(), oDlg:Update() )

   @ 120,40 BTNBMP oBtn PROMPT "Account Invio" LEFT ;
      FILE "..\bitmaps\alphabmp\gmail.bmp", "", ;
           "..\bitmaps\alphabmp\question.bmp", "" ;
      SIZE 220,60 PIXEL OF oDlg FLAT ;
      ACTION MsgInfo( cEmail ) ;
      WHEN ValidaEmail( cEmail )

//   oBtn:lDisColor := .f.

   ACTIVATE DIALOG oDlg CENTERED
   RELEASE FONT oFont

return nil

function validaEmail(cEmail)

   static preCompiled

   DEFAULT preCompiled := hb_regexComp("^[_a-z0-9-]+(\.[_a-z0-9-]+)*@[a-z0-9-]+(\.[a-z0-9-]+)*(\.[a-z]{2,4})$")

return !Empty( hb_regex( preCompiled, alltrim( cEmail ) ) )


Image
Regards

G. N. Rao.
Hyderabad, India
User avatar
nageswaragunupudi
 
Posts: 10595
Joined: Sun Nov 19, 2006 5:22 am
Location: India

Re: Problem with valid email refresh btnbmp

Postby Silvio.Falconi » Wed Apr 03, 2024 9:02 pm

nageswaragunupudi wrote:Try
Code: Select all  Expand view
function SilviBtnBmp()

   local oDlg, oGet, oBtn, oFont
   local cEmail      := Space( 40 )

   SetGetColorFocus()

   DEFINE FONT oFont NAME "Segoe UI" SIZE 0,-24
   DEFINE DIALOG oDlg SIZE 600,300 PIXEL TRUEPIXEL FONT oFont

   @  40,40 GET oGet VAR cEmail SIZE 400,40 PIXEL OF oDlg ;
      ON CHANGE ( oDlg:AEvalWhen(), oDlg:Update() )

   @ 120,40 BTNBMP oBtn PROMPT "Account Invio" LEFT ;
      FILE "..\bitmaps\alphabmp\gmail.bmp", "", ;
           "..\bitmaps\alphabmp\question.bmp", "" ;
      SIZE 220,60 PIXEL OF oDlg FLAT ;
      ACTION MsgInfo( cEmail ) ;
      WHEN ValidaEmail( cEmail )

//   oBtn:lDisColor := .f.

   ACTIVATE DIALOG oDlg CENTERED
   RELEASE FONT oFont

return nil

function validaEmail(cEmail)

   static preCompiled

   DEFAULT preCompiled := hb_regexComp("^[_a-z0-9-]+(\.[_a-z0-9-]+)*@[a-z0-9-]+(\.[a-z0-9-]+)*(\.[a-z]{2,4})$")

return !Empty( hb_regex( preCompiled, alltrim( cEmail ) ) )


Image




here not run ok


Image


I saw only "?" bitmap and btnbmp is allways disabled
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: 7004
Joined: Thu Oct 18, 2012 7:17 pm

Re: Problem with valid email refresh btnbmp

Postby Silvio.Falconi » Wed Apr 03, 2024 9:40 pm

perhaos validamail not run here return allways .f.
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: 7004
Joined: Thu Oct 18, 2012 7:17 pm

Re: Problem with valid email refresh btnbmp

Postby Silvio.Falconi » Wed Apr 03, 2024 10:21 pm

PERHAPS ??

function validaEmail(cEmail)
LOCAL pCompiled := hb_regexComp("^[_a-z0-9-]+(\.[_a-z0-9-]+)*@[a-z0-9-]+(\.[a-z0-9-]+)*(\.[a-z]{2,4})$")

LOCAL cRet := .t.

IF HB_RegExMatch( pCompiled, alltrim(cEmail), .F. )


cRet := .f.
end
return cRet
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: 7004
Joined: Thu Oct 18, 2012 7:17 pm

Re: Problem with valid email refresh btnbmp

Postby nageswaragunupudi » Wed Apr 03, 2024 10:25 pm

here not run ok

My program is perfectly working here and this is the proof:
Image
Regards

G. N. Rao.
Hyderabad, India
User avatar
nageswaragunupudi
 
Posts: 10595
Joined: Sun Nov 19, 2006 5:22 am
Location: India

Re: Problem with valid email refresh btnbmp

Postby Silvio.Falconi » Thu Apr 04, 2024 7:01 am

nageswaragunupudi wrote:
here not run ok

My program is perfectly working here and this is the proof:
Image




Nages I don't tell lies watch the video please



Image
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: 7004
Joined: Thu Oct 18, 2012 7:17 pm

Re: Problem with valid email refresh btnbmp

Postby Silvio.Falconi » Fri Apr 05, 2024 12:13 pm

nageswaragunupudi wrote:
here not run ok

My program is perfectly working here and this is the proof:
Image



So what should I do if it doesn't work for me? I tried it on several computers with Windows 10 Professional
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: 7004
Joined: Thu Oct 18, 2012 7:17 pm

Re: Problem with valid email refresh btnbmp

Postby karinha » Fri Apr 05, 2024 2:27 pm

Simples,

Code: Select all  Expand view

// C:\FWH\SAMPLES\SILVMAIL.PRG - By: kapiabafwh@gmail.com

#include "FiveWin.ch"

STATIC lIsValid := .F., oBtn

FUNCTION Main()

   LOCAL oDlg, oGet, oFont, oFnt, oSaida, oSil, cTitle, oSay, cSay, oBrush
   LOCAL cEmail := SPACE( 50 ), cSilv := SPACE(50)

   SetBalloon( .T. ) // Balloon shape required for tooltips
   SetGetColorFocus()
   SkinButtons()

   cSay   := "INGRESE EL CORREO ELECTRÓNICO:"
   cTitle := "FIVEWIN: VALIDAR EMAIL BY SILVIO FALCONI"

   DEFINE BRUSH oBrush FILE "..\bitmaps\sea.bmp" RESIZE

   DEFINE FONT oFnt  NAME "Segoe UI" SIZE 0, -12 BOLD
   DEFINE FONT oFont NAME "Segoe UI" SIZE 0, -18 BOLD

   DEFINE DIALOG oDlg SIZE 600, 300 PIXEL TRUEPIXEL BRUSH oBrush             ;
      TITLE cTitle FONT oFont TRANSPARENT

   oDlg:lHelpIcon := .F.

   IF Set( _SET_INSERT, ! Set( _SET_INSERT ) )
      Set( _SET_INSERT, ! Set( _SET_INSERT ) )
   ENDIF

   // SOLO PARA TESTES:
   @ 05, 40 GET oSil VAR cSilv SIZE 400, 40 PIXEL PICTURE "@K" OF oDlg       ;
      FONT oFont UPDATE COLOR CLR_BLACK, CLR_WHITE WHEN( .F. )

   @ 50, 40 SAY oSay VAR cSay SIZE 400, 40 PIXEL PICTURE "@!" OF oDlg        ;
      FONT oFont UPDATE COLOR CLR_WHITE, CLR_BLACK TRANSPARENT

   @ 80, 40 GET oGet VAR cEmail SIZE 400, 40 PIXEL PICTURE "@K" OF oDlg      ;
      FONT oFont UPDATE COLOR CLR_BLACK, CLR_WHITE                           ;
      VALID( VALIDA_EMAIL_SILVIO( cEmail ) )

   oGet:cToolTip := "Ingrese el Email Correcto"

   oGet:bLostFocus := { || oGet:SetColor( CLR_BLACK, CLR_WHITE) }

   oGet:bGotFocus  := { || oGet:SetColor( CLR_BLACK, nRGB( 255, 255, 45 ) ), ;
                           oGet:SetSel( 0, 0 ) }

   @ 200, 40 BTNBMP oBtn PROMPT "Enviar Email Via OutLook Express" LEFT      ;
      FILE "..\bitmaps\alphabmp\gmail.bmp", "",                              ;
           "..\bitmaps\alphabmp\question.bmp", ""                            ;
      SIZE 220, 60 PIXEL OF oDlg FLAT 2007 FONT oFont                        ;
      COLOR CLR_WHITE, CLR_BLACK                                             ;
      ACTION( ENVIAR_EMAIL( cEmail ) )                                       ;
      WHEN( lIsValid )

   oBtn:cToolTip := "Enviar Email Final"

   oBtn:bClrGrad := { |lInvert| If( lInvert, 0x80FFA54A, nARGB( 54, 0, 192, 0 ) ) }

   WITH OBJECT oBtn
      :nClrBorder := { |lInvert| If( lInvert, 0x80FFA54A, nARGB( 54, 0, 192, 0 ) ) } // CLR_BLACK //  border color
      :bColorMap  := { || { { CLR_YELLOW, CLR_BLACK } } }  // image color
   END

   @ 200, 350 BTNBMP oSaida PROMPT "Salida del Programa" LEFT FONT oFont     ;
      FILE "..\bitmaps\Exit.bmp" SIZE 220, 60 PIXEL OF oDlg FLAT 2007        ;
      COLOR CLR_WHITE, CLR_BLACK ACTION( oDlg:End() )

   oSaida:cToolTip := "Salida - Exit - Cancelar"

   oSaida:bClrGrad := { |lInvert| If( lInvert, 0x60FFA54A, nARGB( 64, 0, 192, 0 ) ) }

   WITH OBJECT oSaida
      :nClrBorder := { |lInvert| If( lInvert, 0x80FFA54A, nARGB( 54, 0, 192, 0 ) ) } // CLR_BLACK //  border color
      :bColorMap  := { || { { CLR_YELLOW, CLR_BLACK } } }  // image color
   END

   oSaida:lCancel := .T.

   @ 275, 05 SAY "<ESC> Salir" SIZE 100, 40 PIXEL PICTURE "@!" OF oDlg        ;
      FONT oFnt UPDATE COLOR CLR_HRED, CLR_WHITE TRANSPARENT

   @ 275, 350 SAY "kapiabafwh@gmail.com" SIZE 200, 40 PIXEL PICTURE "@"       ;
      OF oDlg FONT oFont UPDATE COLOR CLR_HBLUE, CLR_WHITE TRANSPARENT

   ACTIVATE DIALOG oDlg CENTERED ON INIT( oSil:Hide() )

   IF Set( _SET_INSERT, ! Set( _SET_INSERT ) )
      Set( _SET_INSERT, ! Set( _SET_INSERT ) )
   ENDIF

   RELEASE BRUSH oBrush

   RELEASE FONT oFnt
   RELEASE FONT oFont

RETURN NIL

FUNCTION VALIDA_EMAIL_SILVIO( cEmailSivio )

   LOCAL cContaUsuario, cNomeUsuario
   LOCAL cRegEx := "^[_a-z0-9-]+(\.[_a-z0-9-]+)*@[a-z0-9-]+(\.[a-z0-9-]+)*(\.[a-z]{2,4})$"

   IF GETASYNCKEY( VK_UP )

      lIsValid := .F.

      oBtn:Disable()
      oBtn:Refresh()

      RETURN( .F. )

   ENDIF

   IF EMPTY( cEmailSivio )

      MsgInfo( OemToAnsi( "ATEN€ÇO USUµRIO:                    " )+CRLF+ ;
               OemToAnsi( "DIGITE O NOME DA CONTA DE EMAIL.    " )+CRLF+ ;
               OemToAnsi( "Exemplo: kapiabafwh@gmail.com       " ),      ;
               OemToAnsi( "EMAIL(Conta) NÇO INFORMADO. CUIDADO!" ) )

      RETURN( .F. )

   ENDIF

   IF ( ALLTRIM(LOWER( cEmailSivio ) ) LIKE cRegEx )

      lIsValid := .T.

   ELSE

      MsgInfo( OemToAnsi( "ATEN€ÇO USUµRIO:                    " )+CRLF+ ;
               OemToAnsi( "DIGITE UM EMAIL VÇLIDO..            " )+CRLF+ ;
               OemToAnsi( "ESTA CONTA DE EMAIL ESTµ ERRADA..   " )+CRLF+ ;
               OemToAnsi( "Exemplo: kapiabafwh@gmail.com       " )+CRLF+ ;
               OemToAnsi( "VOCÒ DIGITOU: " + ALLTRIM( cEmailSivio ) ), ;
               OemToAnsi( "EMAIL(Conta) CONTENDO ERROS... VEJA!" ) )

   ENDIF

   IF( lIsValid )
 
      XFOCUS( oBtn ) // foco en el botton de envio.

   ENDIF

RETURN( lIsValid )

FUNCTION ENVIAR_EMAIL( cEmailEnv )

  ? "Enviar Email Final"

RETURN NIL

STATIC FUNCTION xFocus( oObj )

   xSetFocus( oObj )
   xSetFocus( oObj )

RETURN( .T. )

STATIC FUNCTION xSetFocus( oObj )

   LOCAL _oWnd := oObj:oWnd, _oTempo := ""

   DEFINE Timer _oTempo Interval 10 OF _oWnd ;
      ACTION ( oObj:SetFocus(), _oTempo:End() )

   ACTIVATE Timer _oTempo

RETURN( .T. )

// FIN / END - kapiabafwh@gmail.com
 


Regards, saludos.
João Santos - São Paulo - Brasil - Phone: +55(11)95150-7341
User avatar
karinha
 
Posts: 7766
Joined: Tue Dec 20, 2005 7:36 pm
Location: São Paulo - Brasil

Re: Problem with valid email refresh btnbmp

Postby Silvio.Falconi » Fri Apr 05, 2024 3:49 pm

Karinha
for one btnbmp I must write all this ?
you're a joke


then

Progetto: karinha, Ambiente: bcc7Harbor:
[1]:Harbour.Exe karinha.prg /m /n0 /gc1 /es2 /kh /a /iC:\Work\fwh\include /iC:\work\HARBOUR\Include /jC:\Work\errori\BTNBMP~1\I18n\Main.hil /iinclude;c:\work\fwh\include;C:\work\HARBOUR\include /oObj\karinha.c
Harbour 3.2.0dev (r2403071241)
Copyright (c) 1999-2021, https://harbour.github.io/
Compiling 'karinha.prg'...
karinha.prg(130) Error E0030 Syntax error "syntax error at 'LIKE'"
karinha.prg(134) Error E0014 ELSE does not match IF
karinha.prg(143) Error E0010 ENDIF does not match IF
3 errors

No code generated.
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: 7004
Joined: Thu Oct 18, 2012 7:17 pm

Re: Problem with valid email refresh btnbmp

Postby karinha » Fri Apr 05, 2024 4:01 pm

Yo uso xHarbour. No conozco el comando equivalente en Harbour.

Write whatever you want. The important thing is that my example works and yours doesn't. Compile with xHarbour. Be professional. If you understand my logic, you will be able to do it your way.

Escribe lo que quieras. Lo importante es que mi ejemplo funciona y el tuyo no. Compile con xHarbour. Sea profesional. Si entiendes mi lógica, podrás hacerlo a tu manera.

Regards, saludos.
João Santos - São Paulo - Brasil - Phone: +55(11)95150-7341
User avatar
karinha
 
Posts: 7766
Joined: Tue Dec 20, 2005 7:36 pm
Location: São Paulo - Brasil

Re: Problem with valid email refresh btnbmp

Postby karinha » Fri Apr 05, 2024 4:26 pm

En HARBOUR, intente asi:

Code: Select all  Expand view

   // IF ( HB_REGEXLIKE( ALLTRIM( LOWER( cEmailSivio ) ), cRegEx )  )

   // XHARBOUR:
   IF ( ALLTRIM(LOWER( cEmailSivio ) ) LIKE cRegEx )


   // HARBOUR:
   IF ( HB_REGEXLIKE( ( cRegEx ), ( ALLTRIM(LOWER( cEmailSivio ) ) ) ) )
 


Regards, saludos.
João Santos - São Paulo - Brasil - Phone: +55(11)95150-7341
User avatar
karinha
 
Posts: 7766
Joined: Tue Dec 20, 2005 7:36 pm
Location: São Paulo - Brasil

Re: Problem with valid email refresh btnbmp

Postby karinha » Fri Apr 05, 2024 4:42 pm

Simples demás.... hahahaha y no uso HABROUR ni de pago. hahahahahaha.

Silvio: #include "HbCompat.ch" // para Harbour Silvio.

Code: Select all  Expand view

// C:\FWH\SAMPLES\SILVMAIL.PRG - By: kapiabafwh@gmail.com

#include "FiveWin.ch"
#include "HbCompat.ch"  // para Harbour Silvio.

STATIC lIsValid := .F., oBtn

FUNCTION Main()

   LOCAL oDlg, oGet, oFont, oFnt, oSaida, oSil, cTitle, oSay, cSay, oBrush
   LOCAL cEmail := SPACE( 50 ), cSilv := SPACE(50)

   SetBalloon( .T. ) // Balloon shape required for tooltips
   SetGetColorFocus()
   SkinButtons()

   cSay   := "INGRESE EL CORREO ELECTRÓNICO:"
   cTitle := "FIVEWIN: VALIDAR EMAIL BY SILVIO FALCONI"

   DEFINE BRUSH oBrush FILE "..\bitmaps\sea.bmp" RESIZE

   DEFINE FONT oFnt  NAME "Segoe UI" SIZE 0, -12 BOLD
   DEFINE FONT oFont NAME "Segoe UI" SIZE 0, -18 BOLD

   DEFINE DIALOG oDlg SIZE 600, 300 PIXEL TRUEPIXEL BRUSH oBrush             ;
      TITLE cTitle FONT oFont TRANSPARENT

   oDlg:lHelpIcon := .F.

   IF Set( _SET_INSERT, ! Set( _SET_INSERT ) )
      Set( _SET_INSERT, ! Set( _SET_INSERT ) )
   ENDIF

   // SOLO PARA TESTES:
   @ 05, 40 GET oSil VAR cSilv SIZE 400, 40 PIXEL PICTURE "@K" OF oDlg       ;
      FONT oFont UPDATE COLOR CLR_BLACK, CLR_WHITE WHEN( .F. )

   @ 50, 40 SAY oSay VAR cSay SIZE 400, 40 PIXEL PICTURE "@!" OF oDlg        ;
      FONT oFont UPDATE COLOR CLR_WHITE, CLR_BLACK TRANSPARENT

   @ 80, 40 GET oGet VAR cEmail SIZE 400, 40 PIXEL PICTURE "@K" OF oDlg      ;
      FONT oFont UPDATE COLOR CLR_BLACK, CLR_WHITE                           ;
      VALID( VALIDA_EMAIL_SILVIO( cEmail ) )

   oGet:cToolTip := "Ingrese el Email Correcto"

   oGet:bLostFocus := { || oGet:SetColor( CLR_BLACK, CLR_WHITE) }

   oGet:bGotFocus  := { || oGet:SetColor( CLR_BLACK, nRGB( 255, 255, 45 ) ), ;
                           oGet:SetSel( 0, 0 ) }

   @ 200, 40 BTNBMP oBtn PROMPT "Enviar Email Via OutLook Express" LEFT      ;
      FILE "..\bitmaps\alphabmp\gmail.bmp", "",                              ;
           "..\bitmaps\alphabmp\question.bmp", ""                            ;
      SIZE 220, 60 PIXEL OF oDlg FLAT 2007 GDIPLUS FONT oFont                ;
      COLOR CLR_WHITE, CLR_BLACK                                             ;
      ACTION( ENVIAR_EMAIL( cEmail ) )                                       ;
      WHEN( lIsValid )

   oBtn:cToolTip := "Enviar Email Final"

   oBtn:bClrGrad := { |lInvert| If( lInvert, 0x80FFA54A, nARGB( 54, 0, 192, 0 ) ) }

   WITH OBJECT oBtn
      :nClrBorder := { |lInvert| If( lInvert, 0x80FFA54A, nARGB( 54, 0, 192, 0 ) ) } // CLR_BLACK //  border color
      :bColorMap  := { || { { CLR_YELLOW, CLR_BLACK } } }  // image color
   END

   @ 200, 350 BTNBMP oSaida PROMPT "Salida del Programa" LEFT FONT oFont     ;
      FILE "..\bitmaps\Exit.bmp" SIZE 220, 60 PIXEL OF oDlg FLAT 2007 GDIPLUS;
      COLOR CLR_WHITE, CLR_BLACK ACTION( oDlg:End() )

   oSaida:cToolTip := "Salida - Exit - Cancelar"

   oSaida:bClrGrad := { |lInvert| If( lInvert, 0x60FFA54A, nARGB( 64, 0, 192, 0 ) ) }

   WITH OBJECT oSaida
      :nClrBorder := { |lInvert| If( lInvert, 0x80FFA54A, nARGB( 54, 0, 192, 0 ) ) } // CLR_BLACK //  border color
      :bColorMap  := { || { { CLR_YELLOW, CLR_BLACK } } }  // image color
   END

   oSaida:lCancel := .T.

   @ 275, 05 SAY "<ESC> Salir" SIZE 100, 40 PIXEL PICTURE "@!" OF oDlg        ;
      FONT oFnt UPDATE COLOR CLR_HRED, CLR_WHITE TRANSPARENT

   @ 275, 350 SAY "kapiabafwh@gmail.com" SIZE 200, 40 PIXEL PICTURE "@"       ;
      OF oDlg FONT oFont UPDATE COLOR CLR_HBLUE, CLR_WHITE TRANSPARENT

   ACTIVATE DIALOG oDlg CENTERED ON INIT( oSil:Hide() )

   IF Set( _SET_INSERT, ! Set( _SET_INSERT ) )
      Set( _SET_INSERT, ! Set( _SET_INSERT ) )
   ENDIF

   RELEASE BRUSH oBrush

   RELEASE FONT oFnt
   RELEASE FONT oFont

RETURN NIL

FUNCTION VALIDA_EMAIL_SILVIO( cEmailSivio )

   LOCAL cContaUsuario, cNomeUsuario
   // LOCAL cRegEx := "^[_a-z0-9-]+(\.[_a-z0-9-]+)*@[a-z0-9-]+(\.[a-z0-9-]+)*(\.[a-z]{2,4})$"
   // LOCAL cRegEx := "^[a-zA-Z0-9._%-]+@[a-zA-Z0-9.-]+\.[a-zA-Z]{2,4}$"
   // LOCAL cRegEx := hb_regexComp("^[_a-z0-9-]+(\.[_a-z0-9-]+)*@[a-z0-9-]+(\.[a-z0-9-]+)*(\.[a-z]{2,4})$")
   LOCAL cRegEx := "^[_a-z0-9-]+(\.[_a-z0-9-]+)*@[a-z0-9-]+(\.[a-z0-9-]+)*(\.[a-z]{2,4})$"


   IF GETASYNCKEY( VK_UP )

      lIsValid := .F.

      oBtn:Disable()
      oBtn:Refresh()

      RETURN( .F. )

   ENDIF

   IF EMPTY( cEmailSivio )

      MsgInfo( OemToAnsi( "ATEN€ÇO USUµRIO:                    " )+CRLF+ ;
               OemToAnsi( "DIGITE O NOME DA CONTA DE EMAIL.    " )+CRLF+ ;
               OemToAnsi( "Exemplo: kapiabafwh@gmail.com       " ),      ;
               OemToAnsi( "EMAIL(Conta) NÇO INFORMADO. CUIDADO!" ) )

      RETURN( .F. )

   ENDIF

   //   IF ( HB_REGEXLIKE( ALLTRIM( LOWER( cEmailSivio ) ), cRegEx )  )
   // funciona con HBCOMPAT.CH
   IF ( ALLTRIM(LOWER( cEmailSivio ) ) LIKE cRegEx )

      lIsValid := .T.

   ELSE

      MsgInfo( OemToAnsi( "ATEN€ÇO USUµRIO:                    " )+CRLF+ ;
               OemToAnsi( "DIGITE UM EMAIL VÇLIDO..            " )+CRLF+ ;
               OemToAnsi( "ESTA CONTA DE EMAIL ESTµ ERRADA..   " )+CRLF+ ;
               OemToAnsi( "Exemplo: kapiabafwh@gmail.com       " )+CRLF+ ;
               OemToAnsi( "VOCÒ DIGITOU: " + ALLTRIM( cEmailSivio ) ),   ;
               OemToAnsi( "EMAIL(Conta) CONTENDO ERROS... VEJA!" ) )

   ENDIF

   IF( lIsValid )
 
      XFOCUS( oBtn ) // foco en el botton de envio.

   ENDIF

RETURN( lIsValid )

FUNCTION ENVIAR_EMAIL( cEmailEnv )

  ? "Enviar Email Final harbour/xHarbour"

RETURN NIL

STATIC FUNCTION xFocus( oObj )

   xSetFocus( oObj )
   xSetFocus( oObj )

RETURN( .T. )

STATIC FUNCTION xSetFocus( oObj )

   LOCAL _oWnd := oObj:oWnd, _oTempo := ""

   DEFINE Timer _oTempo Interval 10 OF _oWnd ;
      ACTION ( oObj:SetFocus(), _oTempo:End() )

   ACTIVATE Timer _oTempo

RETURN( .T. )

// FIN / END - kapiabafwh@gmail.com
 


Regards, saludos.
João Santos - São Paulo - Brasil - Phone: +55(11)95150-7341
User avatar
karinha
 
Posts: 7766
Joined: Tue Dec 20, 2005 7:36 pm
Location: São Paulo - Brasil

Re: Problem with valid email refresh btnbmp

Postby Silvio.Falconi » Mon Apr 08, 2024 7:13 am

Karinha,
For me it's no good
I have a dialog with many get , how row of source I must make for insert your source ?

look the sample's Nages , why here not run ?
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: 7004
Joined: Thu Oct 18, 2012 7:17 pm

Next

Return to FiveWin for Harbour/xHarbour

Who is online

Users browsing this forum: Google [Bot] and 34 guests