Page 1 of 1

How do I go about recalling a method from an event

Posted: Mon Nov 04, 2019 10:13 am
by pietro_72_
Hello
Sorry, I confess I have some difficulty with object-oriented programming

If instead of using the function:
     operativeModePres = function () {
         ......
I use the method:
     OrthogonalProjections.prototype.operativeModePres = function () {

As I have to do to recall this method from an event I tried a few ways but it does not go:
     // operativeMode ['currentIndexChanged (int)']. connect (function () {operativeModePres ();});
     // operativeMode ['currentIndexChanged (int)']. connect (function () {this.operativeModePres;});
     operativeMode ['currentIndexChanged (int)']. connect (function () {operativeModePres.call (operativeModePres);});

Re: How do I go about recalling a method from an event

Posted: Mon Nov 04, 2019 9:31 pm
by pietro_72_
Searching for solutions on https://github.com/qcad/qcad/ have managed to solve this problem as follows:

operativeMode ['currentIndexChanged (int)']. connect (this, "operativeModePres");

From here maybe I can solve the previous problem:
"Loss of script operation after using snaps"