Level Extreme platform
Subscription
Corporate profile
Products & Services
Support
Legal
Français
Grid - CursorAdapter
Message
From
02/12/2005 11:28:45
 
 
To
02/12/2005 03:58:30
General information
Forum:
Visual FoxPro
Category:
Forms & Form designer
Miscellaneous
Thread ID:
01073232
Message ID:
01074281
Views:
23
Hi!

Thanks for the sample code it showed me a few things that I did not expect.

Do you think there is a way to make the cursoradapter work with parent/child grids?

Thanks.

Sarosh

>>Hi!
>>
>>I have a form with two grids on it grdCustomer (Parent) and grdOrders (Child) and the grid's RecordSources are a cursors created by cursoradapters in the dataenvironment of the form.
>>
>>In the grdCustomer's AfterRowColChange Event I have tried calling the cursoradapter's CursorRefresh() and CursorFill() -ThisForm.DataEnvironment.cadOrders.CursorRefresh()/CursorFill() methods and the grid looses all its column settings because a new underlying cursor gets created each time I call CursorRefresh() or CursorFill().
>>
>>Other than saving the grids columns settings (I would not like to do this as there are many columns and many currentcontrols in columns - very complicated dynamic expressions etc.) and then restoring them after calling CursorRefresh() or CursorFill() is there any other way?
>>
>>Thanks.
>>
>>Sarosh
>
>The CursorRefresh() implementation it is horrid.
>
>If the CA's Attached Alias is binded to a Grid:
>- you cannot call CursorFill()
>- you can call CursorRefresh() with the focus into the grid,
> but many events are fired, with a buggy sequence,
>and if you have code on these,
>you can have a sea of side effects.
>When you do a requery()/CursorRefresh go away of the grid.
>
>Run this and look Output window:
>
>Clear
>
>Clear All
>*--
>ACTIVATE WINDOW "DEBUG OUTPUT"
>SET EVENTLIST TO "Afterrowcolchange","beforerowcolchange"
>SET EVENTLIST TO "beforeCursorRefresh","afterCursorRefresh" ADDITIVE
>SET EVENTLIST TO "LostFocus","Valid","When" ADDITIVE
>SET EVENTTRACKING ON
>
>
>WITH CREATEOBJECT("myForm")
>	SET DATASESSION TO .Datasessionid
>	Set Talk Off
>	Open Database Home(2)+"Northwind\Northwind"
>	
>	.ADDPROPERTY("CA",CreateObject("Cursoradapter"))
>
>	WITH .CA
>		.DataSourceType = "NATIVE"
>		.addproperty("RN",0)
>		.SelectCmd = "select * from customers where RECNO() > ?this.RN"
>	
>		DEBUGOUT  "1] CursorFill()", .CursorFill()
>	ENDWITH
>	.grid.RECORDSOURCE = ALIAS()
>	.SHOW
>	
>	DOEVENTS
>
>	=ADDPROPERTY(_screen.ActiveForm,"LOCKME",_screen.ActiveForm)
>
>ENDWITH
>	
>DEFINE CLASS myForm AS Form
>	Allowoutput = .F.
>	
>	DATASESSION = 2
>	
>	ADD OBJECT grid as grid
>
>	PROCEDURE grid.Afterrowcolchange(cc)
>		IF THISFORM.CA.rn < 3
>			THISFORM.CA.rn = (THISFORM.CA.rn+1) % 91
>			DEBUGOUT "************ REQUERY **********"
>			=REQUERY()	&& THIS CALL THE CA CursorRefresh
>			WAIT WINDOW "WAIT" TIMEOUT 2
>			KEYBOARD '{DNARROW}' PLAIN
>		ENDIF
>	ENDPROC
>	
>	PROCEDURE grid.beforerowcolchange(cc)
>		DEBUGOUT "FILE =",DBF(),THISFORM.CA.rn
>	
>ENDDEFINE
>
Previous
Next
Reply
Map
View

Click here to load this message in the networking platform