Weirdness of data bound grid

Moderator: Rathinagiri

Post Reply
User avatar
cargom56
Posts: 9
Joined: Tue Nov 06, 2012 1:26 pm
Location: Rome, Italy

Weirdness of data bound grid

Post by cargom56 »

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

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
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
Leopoldo Blancas
Posts: 388
Joined: Wed Nov 21, 2012 7:14 pm
Location: México

Re: Weirdness of data bound grid

Post by Leopoldo Blancas »

Hola Carlo...

Entiendo cuando uno espera una respuesta pronta y no hay eco.... es frustrante!!!

Se que en el foro hay personas que saben mucho, pero por alguna u otra razón no contestan al llamado.... Yo solo puedo responder a las preguntas sencillas ya que se poco de HMG.

Y con referente a tu Post quiero decirte que cuando lo haces con el ratón el puntero tiene primero que entrar en la celda (para así obtener en donde hiciste CLICK) y es por eso que cuando navegas con las flechas detecta el cambio de celda por que ya salio en la anterior en donde se encontraba y es por eso que primero recurre a la función look.

Espero haber ayudado y sido claro...

Nota: Yo en muchas ocasiones subo toda mi rutina, prg's, dbf's, ntx's, cdx's... imagenes o hasta el exe. Para que asì sea más facil para los amigos probar mi aplicación y me puedan ayudar lo más pronto posible.

Saludos
Polo Desde México!!!
*-----------------------------------------------------------------------------------------------------------------------------------------------
Hi Carlo ...

I understand when one expects a prompt and no echo .... it's frustrating!

Forum is that there are people who know a lot, but for some reason or another do not answer the call .... I can only answer questions that are simple and some HMG.

And with regard to your post I want to say that when you do it with the mouse pointer must first enter the cell (so where did you get CLICK) and that's why when you browse with the arrows cell detects the change that and came in last in where he was and that is why the function uses first look.

I hope I have helped and been clear ...

Note: I often upload my whole routine, prg's, dbf's, ntx's, CDX's ... images or to the exe. For that to be more easy for friends to test my application and can help me as soon as possible.

regards
Polo From Mexico!
User avatar
cargom56
Posts: 9
Joined: Tue Nov 06, 2012 1:26 pm
Location: Rome, Italy

Re: Weirdness of data bound grid

Post by cargom56 »

Thank you Leopoldo, I noticed your reply only yesterday.
Post Reply