On 2017-09-25 10:55, Matt Slay wrote:
Textbox in grid column question.... When is the value entered in a textbox in a grid column applied to the underlying bound cursor relative to the firing of the grid.AfterRowColChange() when user hits tab to move to the next column?
Here is the situation I am struggling to understand: When entering a new value in a column and then hitting tab to go to the next column, it appears that the value from the textbox which you are exiting is not applied to the cursor yet at the time AfterRowColChange() fires. I have some calculation logic on AfterRowColChange() and the old value is what I am seeing.
As a hack, I have gone this route, but I hate it: In order to get the value from the textbox in the cursor soon enough to be seen by the AfterRowColChange() method code, I have put explicit code in the textbox.Valid() to say “Replace {field} with This.Value in {lcCursor}” and then the cursor is updated so that when AfterRowColChange() is called, it will see the new value in the row for that field.
Am I making any sense with this explanation? What am I missing?
Hi Matt,
That workaround is exactly what I did almost 20 years ago when trying to do the same thing in a VFP6 app. Then, thanks to tips here (or the predecessor, FoxShare by Darcy White?), I changed the design to not do editing in grids directly but pop up an edit form instead, using objects in said-pop-up-form and then doing a GATHER in the underlying cursor if the user pressed Save in the edit form.
Your scenario above reminds me of similar workarounds due to the Toolbar object not getting focus as expected. Saw that in FoxPro Advisor back then!
--Mike