SKILL Qn: Connecting a variable with a function

Discussion in 'Cadence' started by suresh j, Sep 25, 2003.

  1. suresh j

    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;
    Thanks and regards,
    Suresh J
     
    suresh j, Sep 25, 2003
    #1
  2. 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.
     
    Andrew Beckett, Sep 25, 2003
    #2
  3. suresh j

    suresh j Guest

    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
     
    suresh j, Sep 26, 2003
    #3
  4. 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.
     
    Andrew Beckett, Sep 26, 2003
    #4
Ask a Question

Want to reply to this thread or ask your own question?

You'll need to choose a username for the site, which only take a couple of moments (here). After that, you can post your question and our members will help you out.