Is this a bug ?

Moderator: Rathinagiri

User avatar
Roberto Lopez
HMG Founder
Posts: 3900
Joined: Wed Jul 30, 2008 6:43 pm
Has thanked: 13 times
Been thanked: 136 times

Re: Is this a bug ?

Post by Roberto Lopez » Mon Apr 20, 2009 11:17 pm

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: 3900
Joined: Wed Jul 30, 2008 6:43 pm
Has thanked: 13 times
Been thanked: 136 times

Post by Roberto Lopez » Tue Apr 21, 2009 1:24 am

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: 5172
Joined: Tue Jul 29, 2008 6:30 pm
DBs Used: MariaDB, SQLite, SQLCipher and MySQL
Location: Sivakasi, India
Has thanked: 136 times
Been thanked: 131 times
Contact:

Post by Rathinagiri » Tue Apr 21, 2009 3:23 am

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: 1444
Joined: Sat Mar 07, 2009 11:52 am
Location: Kolkata, WB, India
Has thanked: 4 times

Post by sudip » Tue Apr 21, 2009 4:02 am

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: 3900
Joined: Wed Jul 30, 2008 6:43 pm
Has thanked: 13 times
Been thanked: 136 times

Post by Roberto Lopez » Tue Apr 21, 2009 4:39 am

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: 5172
Joined: Tue Jul 29, 2008 6:30 pm
DBs Used: MariaDB, SQLite, SQLCipher and MySQL
Location: Sivakasi, India
Has thanked: 136 times
Been thanked: 131 times
Contact:

Post by Rathinagiri » Tue Apr 21, 2009 5:11 am

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: 3900
Joined: Wed Jul 30, 2008 6:43 pm
Has thanked: 13 times
Been thanked: 136 times

Post by Roberto Lopez » Tue Apr 21, 2009 12:00 pm

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: 4345
Joined: Wed Jul 30, 2008 9:17 pm
DBs Used: DBF
Location: iskenderun / Turkiye
Has thanked: 232 times
Been thanked: 80 times
Contact:

Post by esgici » Tue Apr 21, 2009 12:04 pm

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: 3900
Joined: Wed Jul 30, 2008 6:43 pm
Has thanked: 13 times
Been thanked: 136 times

Post by Roberto Lopez » Tue Apr 21, 2009 3:08 pm

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 143 times
Regards/Saludos,

Roberto


(Veritas Filia Temporis)

User avatar
esgici
Posts: 4345
Joined: Wed Jul 30, 2008 9:17 pm
DBs Used: DBF
Location: iskenderun / Turkiye
Has thanked: 232 times
Been thanked: 80 times
Contact:

Post by esgici » Tue Apr 21, 2009 5:56 pm

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