Level Extreme platform
Subscription
Corporate profile
Products & Services
Support
Legal
Français
Grids & Valid
Message
 
 
General information
Forum:
Visual FoxPro
Category:
Coding, syntax & commands
Title:
Miscellaneous
Thread ID:
00154359
Message ID:
00154785
Views:
18
<snip>

>I think that valid of the control will not fire if you click outside the grid, which I'm >guessing is why Ed suggested the BRCC.

>-Michelle

Yes, there is a bug with clicking outside a grid. The grid1.column1.text1 does fire (calculation would be executed), but a RETURN .F. does not keep focus in grid1.column1.text1. Also I believe that possibly the control.controlsource is not updated with the control.value. How quickly we forget. I worked over 100 hours on this and the toolbar/menu not taking focus issue. The workaround that I came up with was to keep an object reference to the lastcontrol (like the lastactivecontrol).

In evey control.GotFocus:

this.parent.lastcontrol = this

In grid1.valid:

if type ("this.parent.lastcontrol") == 'O' and not isnull (this.parent.lastcontrol)
hold_return = this.parent.lastcontrol.vaid()
if !hold_return
return .f.
endif
return = this.brcc() && put any beforerowcolumnchange code here
endif


In grid1.beforerowcolumnchange:

hold_return = this.brcc()
if !hold_return
this.refresh
nodefault
endif

There is a bit more to it: initalizing lastcontrol, removing lastcontrol object reference, updating the control.value with the control.controlsource, etc. Took me quite awhile. But the lastcontrol object reference made it possible to also handle the toolbar/menu not taking focus. Was able to this.parent.lastcontrol.valid() from the toolbar/menu code. That way the control.valid was fired before a Save/Add/ etc.

keeping my fingers crossed - brenda
Previous
Reply
Map
View

Click here to load this message in the networking platform