Level Extreme platform
Subscription
Corporate profile
Products & Services
Support
Legal
Français
Anyone understand events when clicking outside a grid?
Message
From
28/09/1998 09:35:19
Cetin Basoz
Engineerica Inc.
Izmir, Turkey
 
General information
Forum:
Visual FoxPro
Category:
Coding, syntax & commands
Miscellaneous
Thread ID:
00141362
Message ID:
00141413
Views:
29
>focus is in the grid. client clicks outside the grid onto another control on the form. would like to validate the activecell's contents. got some notes from cetin that i am working on to validate the grid contents. but it is bothersome that i do not understand vfp sequence of events for this. turned on event tracking of the debugger, but it seems screwy. the activecell valid is never triggered, yet i get my error message. tried executing the lastcontrol.valid from the when, but does not behave as expected. anyone understand the events, or have any ideas on this?
>
>thanks - brenda
Hi Brenda,
I think notes were about interactivechange and beforerowcolchange.
With a statistics of controls I use, it's like that I'm a grid fanatic :) Still though, I find it rather complex, events execution order and grid behaviour. Instead this is what I find to be simpliest to validate columns :
DEFINE CLASS grdvalidate AS grid
  Name = "grdvalidate"
  *-- Control losing focus
  PROTECTED lastcontrol

  PROCEDURE BeforeRowColChange
  LPARAMETERS nColIndex
   * Save control ref that's losing focus as txt
   this.lastcontrol = "this.columns("+ltrim(str(this.activecolumn))+ ")."+;
	this.columns(this.activecolumn).currentcontrol
  ENDPROC
  PROCEDURE Valid
   with evaluate(this.lastcontrol)
    lCanLeave = .valid() && Explicitly call valid of control
   endwith
   return lCanLeave && if control.valid returns .f. do not let grid lose focus
  ENDPROC
ENDDEFINE
Of course this one assumes validation code is in "currentcontrol" and should be polished for other cases (ie: dynamicurrentcontrol used and valid code is there). But so few ppl use dynamiccurrentcontrol (I think). And also doesn't deal with extra cosmetics like selectall for control when validation return .f. At last it's a simple class demonstrating grid.control.valid could work when clicked outside too.
Cetin
Çetin Basöz

The way to Go
Flutter - For mobile, web and desktop.
World's most advanced open source relational database.
.Net for foxheads - Blog (main)
FoxSharp - Blog (mirror)
Welcome to FoxyClasses

LinqPad - C#,VB,F#,SQL,eSQL ... scratchpad
Previous
Next
Reply
Map
View

Click here to load this message in the networking platform