AddExec in compiled code

I am confused about the use of AddExec in compiled code.

In a gui a TMarker is drawn on the Canvas, it’s y coordinate is shown in a TGTextEntry. Changing the entry will change the position of the TMarker.
However, I am trying to implement that you can also drag and drop the marker to a new position directly on the canvas. This is then supposed to update the member variables for the coordinates, and write the new value for y into the TextEntry field.
However, everytime I assign a new value to a member variable (y in that case) from within the Event member function (“MarkerClicked” in my example) I receive a segfault.
As long as I only output the new position as a new local variable everything is fine.

How to use AddExec properly in this context?

Cheers,

Maurits

I attach a minimal version of my working code. The dubious line(s) are commented out.
guiLinkDef.h (36 Bytes)
all.txt (135 Bytes)
MyMain.cxx (1.83 KB)
MyMain.h (702 Bytes)
main.cxx (245 Bytes)

Hi,

Please use this format:

instead of:

Cheers,
Bertrand.

Hi Bertrand.

It works like a charm. Thanks. Would you care to elaborate on the solution?

Maurits

Hi Maurits,

No problem. Here are more details:
At run time, this line:

gives (e.g.) this string:

0x0017fde4 being the address of MyMainFrame “this” pointer. This is then equal to:

Allowing the interpreter to properly call the MyMainFrame::MarkerClicked() method.

Cheers,
Bertrand.

Hi Bertrand.

I see. Thanks for your help.

Maurits