Plateforme Level Extreme
Abonnement
Profil corporatif
Produits & Services
Support
Légal
English
Valid and LostFocus events don't fire
Message
Information générale
Forum:
Visual FoxPro
Catégorie:
Gestionnaire d'écran & Écrans
Versions des environnements
Visual FoxPro:
VFP 9 SP2
OS:
Windows 7
Network:
Windows 2003 Server
Database:
MS SQL Server
Divers
Thread ID:
01482629
Message ID:
01482651
Vues:
66
I've adjusted BindEvent code to not fire for at all (here is a new code):
for each loControl in this.controls foxobject
	if pemstatus(m.loControl,'InteractiveChange',5)
		DO case
		  case m.loControl.class = 'Vfpdatepicker'
		    bindevent(m.loControl,"DateChanged",thisform,"InfoChanged",1)
		 CASE INLIST(m.loControl.Baseclass,'Combobox','Checkbox','Spinner')   
			bindevent(m.loControl,"InteractiveChange",thisform,"InfoChanged",1)
		 *   bindevent(m.loControl,"Valid",thisform,"InfoChanged")
		otherwise
			** We'll invoke code manually			
		endcase
and this is a new code in Valid event:
local lnColon, lnReturn, lcValue
lnReturn = 1
SET STEP ON 
*** Pad leading zeros onto the hours and minutes.  I.e. "8 :00" or " 8: 0" becomes "08:00"
lnColon = atc(":", this.value, 1)
lcValue = padl(alltrim(left(this.value,lnColon-1)), 2, '0') + ':' + padl(alltrim(substr(this.value,lnColon+1)), 2, '0')
if val(left(m.lcValue, 2)) >= 24 or val(substr(m.lcValue, 4, 2)) >= 60
    WAIT WINDOW NOWAIT 'Invalid entry!'
	lnReturn = 0
endif

if m.lnReturn = 1
    IF m.lcValue <> this.Value
       this.Value = m.lcValue
    endif   
	try
		if val(strtran(this.value,':','.')) < val(strtran(this.parent.start_time.value, ':','.'))
			=messagebox('End Time must be greater than Start Time',48,'Invalid Time range')
			lnReturn = 0
		endif
	catch
*
	endtry
endif

IF m.lnReturn = 1 AND this.Tag <> this.Value && Value has changed
   IF PEMSTATUS(thisform,'oRecord',5) AND thisform.tList2.SelectedNodes.Count > 1 
       ADDPROPERTY(thisform.oRecord, 'End_Time', this.value)
       STORE this.value TO thisform.oRecord.End_Time 
   ENDIF
    
  STORE .T. TO thisform.lMadeChanges, thisform.lGlobalChanges
ENDIF

return m.lnReturn
And yet the code doesn't fire!!!!!!!! Very perplexing!

I'll try adding some messageboxes now instead of the SET STEP ON


>>Hi everybody,
>>
>>I have a complex form with a few ActiveX controls. On the right side of the form I have a container with many controls (some of them quite complex).
>>
>>In the Init of the container I have this code
>>
>>for each loControl in this.controls foxobject
>>	if pemstatus(m.loControl,'InteractiveChange',5)
>>		if m.loControl.class <> 'Vfpdatepicker'
>>			bindevent(m.loControl,"InteractiveChange",thisform,"InfoChanged",1)
>>		 *   bindevent(m.loControl,"Valid",thisform,"InfoChanged")
>>		else
>>			bindevent(m.loControl,"DateChanged",thisform,"InfoChanged",1)
>>		endif
>>	endif
>>
>>And in the Valid event of the textbox (that represents time control) I have this code
>>
>>local lnColon, lnReturn
>>lnReturn = 1
>>SET STEP ON 
>>*** Pad leading zeros onto the hours and minutes.  I.e. "8 :00" or " 8: 0" becomes "08:00"
>>lnColon = atc(":", this.value, 1)
>>this.value = padl(alltrim(left(this.value,lnColon-1)), 2, '0') + ':' + padl(alltrim(substr(this.value,lnColon+1)), 2, '0')
>>if val(left(this.value, 2)) >= 24 or val(substr(this.value, 4, 2)) >= 60
>>    WAIT WINDOW NOWAIT 'Invalid entry!'
>>	lnReturn = 0
>>endif
>>
>>if m.lnReturn = 1
>>	try
>>		if val(strtran(this.value,':','.')) < val(strtran(this.parent.start_time.value, ':','.'))
>>			=messagebox('End Time must be greater than Start Time',48,'Invalid Time range')
>>			lnReturn = 0
>>		endif
>>	catch
>>*
>>	endtry
>>endif
>>
>>return m.lnReturn
>>
>>
>>However, when I leave the control, the SET STEP ON is not firing and I never got my messagebox. I have the same behavior with the prior control (which is much much more complex - it's a date picker control). I can not make validation for these controls to test start vs. end dates.
>>
>>I'm guessing a possibility can be to put a transparent shape behind controls and put validation code in the shape LostFocus event. But is there a way to do this with my current implementation?
>>
>>Can you tell me what may be wrong in my code?
>>
>>Thanks in advance.
>
>Is there anything in the interactivechage() or when() event of the textbox or anything in the lostfocus() of the container?
If it's not broken, fix it until it is.


My Blog
Précédent
Répondre
Fil
Voir

Click here to load this message in the networking platform