Level Extreme platform
Subscription
Corporate profile
Products & Services
Support
Legal
Français
Design bug: ASSERT reactivate the fail form
Message
From
12/05/2004 12:08:20
 
 
To
All
General information
Forum:
Visual FoxPro
Category:
Other
Title:
Design bug: ASSERT reactivate the fail form
Miscellaneous
Thread ID:
00903217
Message ID:
00903217
Views:
51
If you use ASSERT into a form, the ASSERT dialog is a VFP window
and VFP start a losefocus sequence, when you push a dialog button ( ignore )
a full reactivate sequence is fired !

Result :
- a ASSERT command is not a hidden debug message, but it change the program state
- all the error context is lose ( this occur with the debug windows, too )
PUBLIC oform1

oform1=NEWOBJECT("form1")
oform1.Show
RETURN

DEFINE CLASS form1 AS form

	DoCreate = .T.
	AutoCenter = .T.
	Caption = "Form1"
	AllowOutput = .F.
	Name = "Form1"

	ADD OBJECT grid1 AS grid WITH ;
		Height = 200, ;
		Left = 17, ;
		Top = 24, ;
		Width = 320, ;
		Name = "Grid1"

	PROCEDURE Load
		CLEAR
		SET ASSERTS ON
		CREATE CURSOR CA (id I DEFAULT RECNO(),fname C(100) DEFAULT REPLICATE(CHR(RAND()*255),rand()*100))
		FOR n=1 TO 100
			APPEND BLANK
		ENDFOR
		GO TOP
	ENDPROC

	PROCEDURE Activate
		? "ActiveForm reactivated !!!!!",SECONDS()
	ENDPROC

	PROCEDURE grid1.AfterRowColChange
		LPARAMETERS nColIndex
		ASSERT .F. MESSAGE "MY MESSAGE"
		* workaround template
*		IF ! .F. AND MESSAGEBOX("MY MESSAGE",4+32,"Assert fail")=6
*			SET STEP ON
*		ENDIF
	ENDPROC

ENDDEFINE
I have seen this thousands of times, but 10' in the past a ASSERT in to grid event sent to me in crash VFP to repetition.
Remove ASSERT and using a simple print of the trace of the application are only successful mode to correct the error.
Result, ASSERT is little useful.

I do not expect a external debug,
but debug event free is the acceptable minimum.

Fabio
Next
Reply
Map
View

Click here to load this message in the networking platform