Is this a bug ?

Moderator: Rathinagiri

User avatar
Roberto Lopez
HMG Founder
Posts: 4004
Joined: Wed Jul 30, 2008 6:43 pm

Re: Is this a bug ?

Post by Roberto Lopez »

esgici wrote: So I can say only : "Yes sir, you have already told me !"
:)
Regards/Saludos,

Roberto


(Veritas Filia Temporis)
User avatar
Roberto Lopez
HMG Founder
Posts: 4004
Joined: Wed Jul 30, 2008 6:43 pm

Re: Is this a bug ?

Post by Roberto Lopez »

You could make your original sample to work also making this change to _SetValue() function in h_controlmisc.prg HMG library code (you should replace the 'case T == "GRID"' section with the following):

Code: Select all

	case T == "GRID" 

		IF _HMG_SYSDATA [32] [ix] == .F.

			ListView_SetCursel ( c, value )
			ListView_EnsureVisible( C , VALUE )

		ELSE

			IF VALTYPE ( VALUE ) == 'A'

				IF VALUE [1] == 0 .OR. VALUE [2] == 0

					_HMG_SYSDATA [ 39 ] [ix] := 0
					_HMG_SYSDATA [ 15 ] [ix] := 0

					REDRAWWINDOW(C)

					_DoControlEventProcedure ( _HMG_SYSDATA [ 12 ] [ix] , ix )

				ELSE

					IF	_HMG_SYSDATA [ 39 ] [ix] <> value [1]	;
						.OR.					;
						_HMG_SYSDATA [ 15 ] [ix] <> value [2]	

						ListView_SetCursel ( c, value [1] )
						ListView_EnsureVisible( C , VALUE [1] )

						_HMG_SYSDATA [ 39 ] [ix] := value [1]
						_HMG_SYSDATA [ 15 ] [ix] := value [2]

						_DoControlEventProcedure ( _HMG_SYSDATA [ 12 ] [ix] , ix )

					ENDIF

				ENDIF

			ENDIF

		ENDIF

Basically, it allows the execution of the OnCgange procedure only if some of the cell coordinates are different from previous value.

Regards,

Roberto.
Regards/Saludos,

Roberto


(Veritas Filia Temporis)
User avatar
Rathinagiri
Posts: 5471
Joined: Tue Jul 29, 2008 6:30 pm
DBs Used: MariaDB, SQLite, SQLCipher and MySQL
Location: Sivakasi, India
Contact:

Re: Is this a bug ?

Post by Rathinagiri »

Thanks for the explanations and suggestions.

This is my long term doubt. When we change the value of a control through "form.control.value := x" statement, whether on change event would be fired or not? Whether it is fired only when an user changes the value of the control manually?
East or West HMG is the Best.
South or North HMG is worth.
...the possibilities are endless.
User avatar
sudip
Posts: 1454
Joined: Sat Mar 07, 2009 11:52 am
Location: Kolkata, WB, India

Re: Is this a bug ?

Post by sudip »

Thanks for the explanation.
I faced the same problem in my initial project One-to-Many form :)

With best regards.

Sudip
With best regards,
Sudip
User avatar
Roberto Lopez
HMG Founder
Posts: 4004
Joined: Wed Jul 30, 2008 6:43 pm

Re: Is this a bug ?

Post by Roberto Lopez »

rathinagiri wrote:Thanks for the explanations and suggestions.

This is my long term doubt. When we change the value of a control through "form.control.value := x" statement, whether on change event would be fired or not? Whether it is fired only when an user changes the value of the control manually?
Well...

When started HMG, 'OnChange' event behavior was completely inherited from WIN32.

This meant, that when the content of a control changes, the operating system sends a message that is 'picked up' by MiniGUI library that executes the procedure specified as 'OnChange' event.

When a report pointed that programmatic changes do not fired OnChange event procedure for a specific control, I've fixed that, since IMHO this is the reasonable and 'logical' behavior (Look at 2.6.2 changelog).

Anyway, these fixes, are difficult decisions to make, because, since this behavior comes from the HMG beginnings, they could break lots of already written (working) applications.

In fact, 2.6.2 fix, caused HMG print preview to fail (it was corrected on 2.6.5).

Regards,

Roberto.
Regards/Saludos,

Roberto


(Veritas Filia Temporis)
User avatar
Rathinagiri
Posts: 5471
Joined: Tue Jul 29, 2008 6:30 pm
DBs Used: MariaDB, SQLite, SQLCipher and MySQL
Location: Sivakasi, India
Contact:

Re: Is this a bug ?

Post by Rathinagiri »

Oh. In my programmes, I had always called for the onchange procedure again, whenever I change the value of the control programmatic.

So, I need not do so, in future. That's nice. Thank you Roberto.
East or West HMG is the Best.
South or North HMG is worth.
...the possibilities are endless.
User avatar
Roberto Lopez
HMG Founder
Posts: 4004
Joined: Wed Jul 30, 2008 6:43 pm

Re: Is this a bug ?

Post by Roberto Lopez »

rathinagiri wrote:So, I need not do so, in future. That's nice. Thank you Roberto.
Please, if you find a control that not work so, report the problem.

Regards,

Roberto.
Regards/Saludos,

Roberto


(Veritas Filia Temporis)
User avatar
esgici
Posts: 4543
Joined: Wed Jul 30, 2008 9:17 pm
DBs Used: DBF
Location: iskenderun / Turkiye
Contact:

Re: Is this a bug ?

Post by esgici »

Hi Roberto
Roberto Lopez wrote:You could make your original sample to work also making this change to _SetValue() function in h_controlmisc.prg HMG library code
I applied, but sorry, can't run :(
HMG wrote:Error BASE/1003 Variable does not exist: VALUE

Called from _GETVALUE(253)
Called from GETPROPERTY(6775)
Called from (b)MAIN(107)
Called from _DOCONTROLEVENTPROCEDURE(4675)
Called from EVENTS(1407)
Called from SETSPINNERVALUE(0)
Called from _DEFINESPINNER(165)
Called from MAIN(109)
Best Regards

--

Esgici
Viva INTERNATIONAL HMG :D
User avatar
Roberto Lopez
HMG Founder
Posts: 4004
Joined: Wed Jul 30, 2008 6:43 pm

Re: Is this a bug ?

Post by Roberto Lopez »

esgici wrote:Hi Roberto
Roberto Lopez wrote:You could make your original sample to work also making this change to _SetValue() function in h_controlmisc.prg HMG library code
I applied, but sorry, can't run :(
HMG wrote:Error BASE/1003 Variable does not exist: VALUE

Called from _GETVALUE(253)
Called from GETPROPERTY(6775)
Called from (b)MAIN(107)
Called from _DOCONTROLEVENTPROCEDURE(4675)
Called from EVENTS(1407)
Called from SETSPINNERVALUE(0)
Called from _DEFINESPINNER(165)
Called from MAIN(109)
Best Regards

--

Esgici
I've took the code posted from my own h_controlmisc.prg (it is working for me). Perhaps you missed something...

Anyway, I've attached the entire file to this message.

Regards,

Roberto.
Attachments
h_controlmisc.rar
(28.98 KiB) Downloaded 500 times
Regards/Saludos,

Roberto


(Veritas Filia Temporis)
User avatar
esgici
Posts: 4543
Joined: Wed Jul 30, 2008 9:17 pm
DBs Used: DBF
Location: iskenderun / Turkiye
Contact:

Re: Is this a bug ?

Post by esgici »

Roberto Lopez wrote: ... Perhaps you missed something...
Anyway, I've attached the entire file to this message.
Yeah ! That's all ! :lol:

My defendant test prg now acquited :D

Un gran abrazo Roberto :)

Best Regards

--

Esgici
Viva INTERNATIONAL HMG :D
Post Reply