Information générale
Catégorie:
Codage, syntaxe et commandes
<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
Précédent
Répondre
Voir le fil de ce thread
Voir le fil de ce thread à partir de ce message seulement
Voir tous les messages de ce thread
Voir tous les messages de ce thread à partir de ce message seulement