> >
> >
> > BINDEVENT to the recordsource?
> > Not tested though :-)
> >
> >
> > -----------------
> > Borislav Borissov
> >
> >
Against Stupidity the Gods themselves Contend in Vain - Johann Christoph Friedrich von Schiller> >
The only thing normal about database guys is their tables.>
> BINDEVENT() supposed to
have an event to bind to, which is exactly my question: what event is fired when an empty grid gets populated?
>
> BTW, I tried to use GRID.When event, but it requires grdMyGrid.SetFocus in the container's program and would not work without it.
>
> Regards,
>
> Ilya
Ilya,
In VFP, you can BINDEVENTS() to events but also to methods and properties (in case of a property, it is actually a binding to its _assign event). That's what Boris suggested you.
I don't know exactly what you are trying to do, but here it is a demo to complete Boris suggestion:
CREATE CURSOR C1 (Id Int, C1_Data Varchar(10))
INSERT INTO C1 VALUES (1, "Hello")
INSERT INTO C1 VALUES (2, "World")
GO TOP
CREATE CURSOR C2 (Id Int, C2_Data Varchar(50))
INSERT INTO C2 VALUES (1, "Venus")
INSERT INTO C2 VALUES (2, "Mercury")
INSERT INTO C2 VALUES (3, "Earth")
GO TOP
LOCAL test AS onGridPopulate
m.test = CREATEOBJECT("onGridPopulate")
m.test.Show(1)
DEFINE CLASS onGridPopulate AS Form
ADD OBJECT C1 AS CommandButton WITH Top = 10, Caption = "C1"
ADD OBJECT C2 AS CommandButton WITH Top = 30, Caption = "C2"
ADD OBJECT grd AS Grid WITH Top = 50, RecordSource = "C1"
PROCEDURE Init
BINDEVENT(This.grd, "RecordSource", This.grd, "Alert")
ENDPROC
PROCEDURE Destroy
UNBINDEVENTS(This.grd)
ENDPROC
PROCEDURE grd.Alert
MESSAGEBOX("User selected a new cursor")
ENDPROC
PROCEDURE C1.Click
Thisform.grd.RecordSource = "C1"
ENDPROC
PROCEDURE C2.Click
Thisform.grd.RecordSource = "C2"
ENDPROC
ENDDEFINE