Level Extreme platform
Subscription
Corporate profile
Products & Services
Support
Legal
Français
Can't Relase Form from Menu if Focus is in a Grid
Message
 
 
To
27/06/2003 00:44:13
James Hansen
Canyon Country Consulting
Flagstaff, Arizona, United States
General information
Forum:
Visual FoxPro
Category:
Other
Miscellaneous
Thread ID:
00804368
Message ID:
00807331
Views:
16
Jim,
I don't see a difference when running this. Whther the cursor is in the textbox or the grid, the form goes through the release process as soon as the Release method method is called. The Destroy event fires and when that is complete, the form disappears.

The only thing different with my test is I didn't have your database so I substituted the Tastrade database and used the "CUSTOMER LISTING" view instead. There was no parameter needed for it.

>Larry,
>
>No code in the grid. Here is the code for the test form:
>
>**************************************************
>*-- Class:        testgrid (c:\clients\nccc\rapidref2\libs\atemp.vcx)
>*-- ParentClass:  form
>*-- BaseClass:    form
>*-- Time Stamp:   06/26/03 11:05:04 AM
>*
>DEFINE CLASS testgrid AS form
>
>	DoCreate = .T.
>	Caption = "Form"
>	Name = "testgrid"
>
>	ADD OBJECT grid1 AS grid WITH ;
>		Height = 157, ;
>		Left = 26, ;
>		RecordSource = "ContactList", ;
>		Top = 10, ;
>		Width = 313, ;
>		Name = "Grid1"
>
>	ADD OBJECT text1 AS textbox WITH ;
>		ControlSource = "contactlist.cName", ;
>		Height = 24, ;
>		Left = 47, ;
>		Top = 188, ;
>		Width = 274, ;
>		Name = "Text1"
>
>	PROCEDURE Init
>		if  ! dodefault()
>			return  .F.
>		endif
>
>		define pad TestGridRelease of _mSysMenu prompt "\<Test" before _MEdit
>		on selection pad TestGridRelease of _mSysMenu do TestRelease
>	ENDPROC
>
>
>	PROCEDURE Load
>		open database data\maintenance\rapidref
>		set database to RAPIDREF
>		private  vp_providerid
>		vp_providerid = 1
>		use lv_providercontacts alias contactlist
>	ENDPROC
>
>
>	PROCEDURE Destroy
>		set SysMenu to default
>
>		dodefault()
>	ENDPROC
>
>
>ENDDEFINE
>*
>*-- EndDefine: testgrid
>**************************************************
>
>
>Here is the test driver program:
>
>x=newobject("testgrid","libs\atemp.vcx")
>x.Show()
>
>read events
>
>cancel
>
>procedure TestRelease
>	I = _screen.FormCount
>	do while  m.I > 0
>		loForm = _screen.Forms[m.I]
>		if  upper(loForm.Class) = "TESTGRID"
>			loForm.Release()
>			exit
>		endif
>	enddo
>
>
>I set a breakpoint in the TestRelease procedure and step through the release. If the cursor is in the text box, the form is released before exiting the procedure. If the cursor is in the grid, the form isn't released until the procedure is exited.
>
>BTW, I get the same result whether the grid source is a view or a table, so that is not the issue.
>
>...Jim
>
>>James,
>>Do you have any validation code in your grid controls? This could cause your grid (or more specifically, your grid control) not to lose focus.
>>
>>Regards.
>>
Larry Miller
MCSD
LWMiller3@verizon.net

Accumulate learning by study, understand what you learn by questioning. -- Mingjiao
Previous
Reply
Map
View

Click here to load this message in the networking platform