Gentlefolk,
More on this one.
Created a simple test environment, one form, ZConnection, ZQuery, DataSource, DBGrid and one Button. Same database.
Columns, fields configured, all OK.
Empty database.
One event "onExit" on the DBGrid. Debug breakpoint stop here.
Start program, form displayed, one row displayed in DBgrid, first cell highlighted.
Click on highlighted cell, stop on OnExit debug.
Click on non-highlighted cell, cell is highlighted, second click on highlighted cell - stop on OnExit debug.
Enter some data into cell (no enter, cell not highlighted), click on button - no stop on DBGrid OnExit debug.
Enter <enter> (cell highlighted), click on button - stop on DBGrid exit.
You cannot get it any simpler, the only code I have written is the debug code in the Onexit event, one line saving a field to a string variable.
So:
Why do I take an OnExit when entering the DBgrid????
Why do I not take an exit when in a non-highlighted cell
l and change focus to the button????
Why (just noticed) does the DBGrid.AutoAdvance "aadown"
not work (worked in original program)????
Perplexed, does not seem logical and is impacting my project.
The following is an edited stack trace obtained when clicking on a empty DBGrid immediatley after loading the program:
Empty database, start program, click on highlighted cell in dbgrid
#0 TFORM1__DBGRID1EXIT(0x2e7f9a8, 0x2e7f548) at unit1.pas:42
#1 TWINCONTROL__DOEXIT(0x2e7f9a8) at wincontrol.inc:6091
#2 TCUSTOMGRID__DOEXIT(0x2e7f9a8) at grids.pas:5500
#3 TCUSTOMDBGRID__DOEXIT(0x2e7f9a8) at dbgrids.pas:2350
#4 TWINCONTROL__WMKILLFOCUS() at wincontrol.inc:6203
#5 TCUSTOMGRID__WMKILLFOCUS() at grids.pas:3795
#6 SYSTEM_TOBJECT_$__DISPATCH$formal at :0
#7 NEXTROWHEIGHT(43972080, 48757160, 0x0) at grids.pas:3695
#8 TWINCONTROL__WNDPROC() at wincontrol.inc:4920
#9 TCUSTOMGRID__WNDPROC() at grids.pas:3850
#10 TCUSTOMDBGRID__WNDPROC() at dbgrids.pas:1211
#11 DELIVERMESSAGE(0x2e7f9a8, void) at lclmessageglue.pas:111
#12 WINDOWPROC(1311154, 8, 1704596, 0) at win32callback.inc:2574
#13 USER32!GetDC at :0
#14 ?? at :0
#15 ?? at :0
#16 ?? at :0
#17 ?? at :0
Ian