How to force an event

General Help regarding HMG, Compilation, Linking, Samples

Moderator: Rathinagiri

Post Reply
User avatar
l3whmg
Posts: 694
Joined: Mon Feb 23, 2009 8:46 pm
Location: Italy
Contact:

How to force an event

Post 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
Luigi from Italy
www.L3W.it
User avatar
mol
Posts: 3825
Joined: Thu Sep 11, 2008 5:31 am
Location: Myszków, Poland
Contact:

Re: How to force an event

Post 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
User avatar
l3whmg
Posts: 694
Joined: Mon Feb 23, 2009 8:46 pm
Location: Italy
Contact:

Re: How to force an event

Post 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
Luigi from Italy
www.L3W.it
User avatar
mol
Posts: 3825
Joined: Thu Sep 11, 2008 5:31 am
Location: Myszków, Poland
Contact:

Re: How to force an event

Post 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
User avatar
l3whmg
Posts: 694
Joined: Mon Feb 23, 2009 8:46 pm
Location: Italy
Contact:

Re: How to force an event

Post 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!
Luigi from Italy
www.L3W.it
Post Reply