Page 2 of 3

Re: Is this a bug ?

Posted: Mon Apr 20, 2009 11:17 pm
by Roberto Lopez
esgici wrote: So I can say only : "Yes sir, you have already told me !"
:)

Re: Is this a bug ?

Posted: Tue Apr 21, 2009 1:24 am
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.

Re: Is this a bug ?

Posted: Tue Apr 21, 2009 3:23 am
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?

Re: Is this a bug ?

Posted: Tue Apr 21, 2009 4:02 am
by sudip
Thanks for the explanation.
I faced the same problem in my initial project One-to-Many form :)

With best regards.

Sudip

Re: Is this a bug ?

Posted: Tue Apr 21, 2009 4:39 am
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.

Re: Is this a bug ?

Posted: Tue Apr 21, 2009 5:11 am
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.

Re: Is this a bug ?

Posted: Tue Apr 21, 2009 12:00 pm
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.

Re: Is this a bug ?

Posted: Tue Apr 21, 2009 12:04 pm
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

Re: Is this a bug ?

Posted: Tue Apr 21, 2009 3:08 pm
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.

Re: Is this a bug ?

Posted: Tue Apr 21, 2009 5:56 pm
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