Problem with valid email refresh btnbmp- RESOLVED
Posted: 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
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