SKILL Qn: Connecting a variable with a function

S

suresh j

Guest
Hi,
In skill is it possible to connect a function to a variable so that the
function will get called automatically whenever the variable's value is
changed.
e.g..
procedure( ABCprintAGotChanged(x)
let(()
printf("New value of a is : %L.\n", x)
)
)

a = 12;
connect(a, ABCprintAGotChanged(x));or connect('a, ABCprintAGotChanged(x))
a = 13;
>>New value of a is : 13
Thanks and regards,
Suresh J
 
There is no public way of doing this (there's a private function, but
no decision has been made about making it public, partly because of some
side effects).

Why do you need to do it? Almost certainly there's a better way of doing
whatever you're doing which doesn't rely on triggering from variables (I know
you can do this in Tcl say, but partly that's because of a lack of _real_
programming language capabilities in Tcl).

If you give an example of what you really are trying to do, I may be able to
suggest a better, public, alternative, which is a more structured way of doing
it?

Andrew.

On Thu, 25 Sep 2003 20:00:21 +0530, suresh j <sureshjeeva00@yahoo.com> wrote:

Hi,
In skill is it possible to connect a function to a variable so that the
function will get called automatically whenever the variable's value is
changed.
e.g..
procedure( ABCprintAGotChanged(x)
let(()
printf("New value of a is : %L.\n", x)
)
)

a = 12;
connect(a, ABCprintAGotChanged(x));or connect('a, ABCprintAGotChanged(x))
a = 13;
>>New value of a is : 13


Thanks and regards,
Suresh J
--
Andrew Beckett
Senior Technical Leader
Custom IC Solutions
Cadence Design Systems Ltd
 
Andrew,

The previous problem ( i.e. synchronizing the view area's of two layout
windows) itself could be written very easily if we had a way to connect
variable to function.
Say we have a property called viewBBox in windowId, and win1 and win2
are the two layout windows we want to synchronize.

procedure( onValueChanged(vbx)
let( ()
win2->viwBBox = vbx;
)
)
connect(win1->viewBBox->signalValueChanged 'onValueChanged);

will cause win2 to synchronize whenvever win1's view bBox property gets
changed, by zoomIn, zoomOut or geScroll.

I dont know Tcl but QT c++ gui toolkit does something like this.

Thanks a lot for the responces and the code given.

rgds,
Suresh J

Andrew Beckett wrote:
There is no public way of doing this (there's a private function, but
no decision has been made about making it public, partly because of some
side effects).

Why do you need to do it? Almost certainly there's a better way of doing
whatever you're doing which doesn't rely on triggering from variables (I know
you can do this in Tcl say, but partly that's because of a lack of _real_
programming language capabilities in Tcl).

If you give an example of what you really are trying to do, I may be able to
suggest a better, public, alternative, which is a more structured way of doing
it?

Andrew.

On Thu, 25 Sep 2003 20:00:21 +0530, suresh j <sureshjeeva00@yahoo.com> wrote:


Hi,
In skill is it possible to connect a function to a variable so that the
function will get called automatically whenever the variable's value is
changed.
e.g..
procedure( ABCprintAGotChanged(x)
let(()
printf("New value of a is : %L.\n", x)
)
)

a = 12;
connect(a, ABCprintAGotChanged(x));or connect('a, ABCprintAGotChanged(x))
a = 13;
>>New value of a is : 13


Thanks and regards,
Suresh J




--
Andrew Beckett
Senior Technical Leader
Custom IC Solutions
Cadence Design Systems Ltd
 
Suresh,

OK, In the case you describe the private function I alluded to
wouldn't work either since it is a window attribute that is being changed,
not a variable. In fact there's no attribute of a window which reflects the
bbox (I think) - it's supposed to be done by the API, and that information is
not accessable except via the API (and even if it is there, I don't think it
is documented).

You could rebind the zoomin and zoom out bindkeys and menu items to
call a function which keeps them in sync, but this is probably not worth the
effort.

Regards,

Andrew.

On Fri, 26 Sep 2003 15:03:11 +0530, suresh j <sureshjeeva00@yahoo.com> wrote:

Andrew,

The previous problem ( i.e. synchronizing the view area's of two layout
windows) itself could be written very easily if we had a way to connect
variable to function.
Say we have a property called viewBBox in windowId, and win1 and win2
are the two layout windows we want to synchronize.

procedure( onValueChanged(vbx)
let( ()
win2->viwBBox = vbx;
)
)
connect(win1->viewBBox->signalValueChanged 'onValueChanged);

will cause win2 to synchronize whenvever win1's view bBox property gets
changed, by zoomIn, zoomOut or geScroll.

I dont know Tcl but QT c++ gui toolkit does something like this.

Thanks a lot for the responces and the code given.

rgds,
Suresh J

Andrew Beckett wrote:
There is no public way of doing this (there's a private function, but
no decision has been made about making it public, partly because of some
side effects).

Why do you need to do it? Almost certainly there's a better way of doing
whatever you're doing which doesn't rely on triggering from variables (I know
you can do this in Tcl say, but partly that's because of a lack of _real_
programming language capabilities in Tcl).

If you give an example of what you really are trying to do, I may be able to
suggest a better, public, alternative, which is a more structured way of doing
it?

Andrew.

On Thu, 25 Sep 2003 20:00:21 +0530, suresh j <sureshjeeva00@yahoo.com> wrote:


Hi,
In skill is it possible to connect a function to a variable so that the
function will get called automatically whenever the variable's value is
changed.
e.g..
procedure( ABCprintAGotChanged(x)
let(()
printf("New value of a is : %L.\n", x)
)
)

a = 12;
connect(a, ABCprintAGotChanged(x));or connect('a, ABCprintAGotChanged(x))
a = 13;
>>New value of a is : 13


Thanks and regards,
Suresh J




--
Andrew Beckett
Senior Technical Leader
Custom IC Solutions
Cadence Design Systems Ltd
--
Andrew Beckett
Senior Technical Leader
Custom IC Solutions
Cadence Design Systems Ltd
 

Welcome to EDABoard.com

Sponsor

Back
Top