Page 1 of 1

How to force an event

Posted: Mon Sep 06, 2010 1:06 pm
by l3whmg
Hello to all friends,
is there a way or a trick to force the execution of the event ONCHANGE (I refer in particular to control GRID)?
Following the inclusion (but in this case the OnChange work fine without my trick) or editing a row, I have to calculate a value.

I tried this trick but does not seem to take effect

Code: Select all

SetProperty("myform", "gridname", "Value", 0)
SetProperty("myform", "gridname", "Value", 2)
0 and 2 are example in this case.

NB I used the notation "SetProperty" because the update of the grid is in a different program than where the grid resides.

Many thanks for the help.

Best regards

Re: How to force an event

Posted: Mon Sep 06, 2010 2:48 pm
by mol
I think, you should look in sources, where global array _HMG_SysData stores ONCHANGE property and call it.
_HMG_SYSDATA [ 12 ] [k] , where K is grid control index, contains ONCHANGE block code
so you can use it:

Code: Select all

	k := GetControlIndex(cGridlName, cFormName)
        &(_HMG_SYSDATA [ 12 ] [k])
Marek

Re: How to force an event

Posted: Mon Sep 06, 2010 3:58 pm
by l3whmg
Hi Marek,
you are great: it works :mrgreen:

But I've modified your code with
EVAL(_HMG_SYSDATA [ 12 ] [k])
because with
&(_HMG_SYSDATA [ 12 ] [k])
I get a crash.

Many, many thanks

Re: How to force an event

Posted: Mon Sep 06, 2010 8:44 pm
by mol
I'm happy it was helpful for you!

(I had no time to test my idea, so, excellent it was right way :))

You must remember, it will not work with new HMG.4

Re: How to force an event

Posted: Thu Sep 09, 2010 10:14 am
by l3whmg
Hi Marek,
at this moment I'm using 3 version, but it's important what you write about 4 and it's a (little) problem at this point.
I want start to try 4: I can be a stupid tester !
Best regards!