Weirdness of data bound grid
Posted: Sat Nov 17, 2012 4:09 pm
Hi all:
As a beginner, I worked on SAMPLES\GRID.25 sample program (and related DBF file) which is about a data bound grid.
I introduced a ON CHANGE function
You will see that ON CHANGing by using the keyboard (Up and Down arrows, PgUp, PgDown, Home, End), the value of the dataset pointer is changed only after the control leaves the function called by the ON CHANGE.
Conversely, the a/m value is correctly updated ON CHANGing with the mouse.
If the the goto statement is uncommented the discrepancy seems to be fixed, however I feel uncomfortable with that.
Is it about a bug or... am I missing something?
Thanks in advance for your kind assistance
Carlo
As a beginner, I worked on SAMPLES\GRID.25 sample program (and related DBF file) which is about a data bound grid.
I introduced a ON CHANGE function
Code: Select all
#include "hmg.ch"
Function Main
DEFINE WINDOW Form_1 ;
AT 0,0 ;
WIDTH 800 ;
HEIGHT 510 ;
TITLE 'Hello World!' ;
MAIN
USE TEST
GO TOP
DEFINE GRID Grid_1
ROW 10
COL 10
WIDTH 770
HEIGHT 440
HEADERS {'Column 1','Column 2','Column 3','Column 4','Column 5','Column 6'}
WIDTHS {140,140,140,100,100,100}
ROWSOURCE "Test"
COLUMNFIELDS { 'Code' , 'First' , 'Last' , 'Birth' , 'Married' , 'Bio' }
VALUE { 1 , 1 }
ON CHANGE (look ())
END GRID
END WINDOW
CENTER WINDOW Form_1
ACTIVATE WINDOW Form_1
Form_1.Grid_1.Setfocus
Return
FUNCTION look ()
* goto Form_1.Grid_1.recno
Msgbox ("Dataset pointer: " + alltrim(str (RECNO ())) + " Grid row: " + alltrim(STR (Form_1.Grid_1.recno)))
Return
Conversely, the a/m value is correctly updated ON CHANGing with the mouse.
If the the goto statement is uncommented the discrepancy seems to be fixed, however I feel uncomfortable with that.
Is it about a bug or... am I missing something?
Thanks in advance for your kind assistance
Carlo