Expert Software Company : News

miercuri, 16 februarie 2011

ObjRef of the last control before click

*!* put this in init method of your baseform class
*!*
this.AddProperty([oLastObject], .NULL.)
this.BindLostFocus(this)


*!* create this method
*!* BindLostFocus
LPARAMETERS toObject
LOCAL lcBase, loControl, loPage
lcBase = UPPER(toObject.BaseClass)
DO CASE
CASE INLIST(lcBase, [FORM], [CONTAINER], [PAGE])
FOR EACH loControl IN toObject.Controls
IF PEMSTATUS(loControl, [LostFocus], 5)
BINDEVENT(loControl, [LostFocus], this, [LostFocusEvent])
ENDIF
ENDFOR
CASE lcBase == [PAGEFRAME]
FOR EACH loPage IN toObject.Pages
this.BindLostFocus(loPage)
ENDFOR
ENDCASE


*!* create this method
*!* LostFocusEvent
LOCAL ARRAY laEvents[1]
LOCAL loExc, lnCount, loObject
TRY
lnCount = AEVENTS(laEvents, 0)
IF lnCount > 0
this.oLastObject = laEvents[1]
ENDIF
CATCH TO loExc
THROW
ENDTRY

Niciun comentariu:

Trimiteți un comentariu