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 17:09:33
Dragan Nedeljkovich (Online)
Now officially retired
Zrenjanin, Serbia
 
General information
Forum:
Visual FoxPro
Category:
Coding, syntax & commands
Miscellaneous
Thread ID:
00141362
Message ID:
00141629
Views:
28
>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

I was playing around with this last night, but couldn't find anything to stop the outer control's GotFocus() to fire. There are various events which fire before it - like grid.valid, grid.lostfocus and such (easier to track in the event tracker if you omit MouseMove events from the list of events to track), but there's nothing you can do - maybe setting the control to disabled, if you only knew which one.

Eventually, I've found a workaround - a form property to keep the reference to the control whose Valid() fires (it fires for sure) and to control it if it's empty in all the outer controls' GotFocus, like this:

** any other control's GotFocus:
If not isnull(thisform.ControlInGrid)
     thisform.ControlInGrid.SetFocus
     nodefault
endif
in any column.text1.valid event, before any return of false:
If < value is valid >
     thisform.ControlInGrid=.null.
     return .t.
else
     thisform.ControlInGrid=this
     return 0
endif
This is the only kludge I can come up with, and it's as ugly as E.T., but may work in absence of a better solution. The .ControlInGrid property should be .null.ed from QueryUnload and/or Destroy as well, in case the user cancels out (though this case should be better served from the column.text.valid). These two should be repeated for every control in a form and every control in the grid, so it's also very non-OOP (I just hate to cut/paste around, and it's a nightmare to maintain). Sure enough, this can be done by inserting this code in their classes, but then the grid's textbox is always the default textbox unless you explicitly play around it, and there's also lots of other controls that already belong to various classes, so adding this code at a class level just for working around this bu... behavior is nearly an overkill.

Hopefully this may be a starting point for a real solution.

back to same old

the first online autobiography, unfinished by design
What, me reckless? I'm full of recks!
Balkans, eh? Count them.
Previous
Next
Reply
Map
View

Click here to load this message in the networking platform