Message
General information
Forum:
Visual FoxPro
Category:
Forms & Form designer
Miscellaneous
Thread ID:
01173909
Message ID:
01174484
Views:
9
Thanks Sergey and Naomi.

I'm playing with it now. I tried aevents() but didn't know how to use it correctly until I saw Naomi's example.

One interesting thing, although not surprising, is that you cannot bind to old school 'valid'. Lostfocus works, but it's interesting to see that when binding to dblclick the grid activerow and activecolumn props return valid values. However, when binding to the lostfocus event the grid activerow and activecolumn return 0. Maybe that's to be expected as well.
from form.init()
bindevent(this.grdMain.column1.text1,'dblclick',ohandler,'click')
bindevent(this.grdMain.column2.text1,'dblclick',ohandler,'click')
bindevent(this.grdMain.column3.text1,'lostfocus',ohandler,'click')
bindevent(this.grdMain.column4.text1,'lostfocus',ohandler,'click')


public gnRow,gnCol,goCol
store -1 to gnRow,gnCol
public ohandler
ohandler=newobject("myhandler")

do form junkbind

define class myhandler as custom
procedure click
  aevents(laEvent,0)
  loCalledBy = laEvent[1]
  ?loCalledBy.value,;
   loCalledBy.name,;
   loCalledby.parent.name,;
   loCalledby.parent.parent.name

  loCol = loCalledby.parent
  ?'controlsource',loCol.controlsource
  loGrid = loCalledby.parent.parent
  ?'col',loGrid.activecolumn
  ?'row',loGrid.activerow

  loActiveControl = _SCREEN.ACTIVEFORM.ACTIVECONTROL
  ?loActiveControl.baseclass
  ?loActiveControl.value
  ?loActiveControl.activecolumn
  ?loActiveControl.activerow
  return .t.
enddefine
Previous
Next
Reply
Map
View