• Skip to main content
  • Skip to search
  • Skip to footer
Cadence Home
  • This search text may be transcribed, used, stored, or accessed by our third-party service providers per our Cookie Policy and Privacy Policy.

  1. Community Forums
  2. Custom IC SKILL
  3. How to update the List Box Field when its value has been...

Stats

  • Locked Locked
  • Replies 9
  • Subscribers 144
  • Views 17016
  • Members are here 0
This discussion has been locked.
You can no longer post new replies to this discussion. If you have a question you can start a new discussion

How to update the List Box Field when its value has been changed with another callback function

fatcat1206
fatcat1206 over 9 years ago

Hi All

I have created a "list box field" for a list of pin names, in a callback function of a form button, I have removed some items from the list, somehow the selection in the "list box field" does not change accordingly.

I check the value of "list box field", it has been changed, just the field itself has not been updated.

It's quite strange that when I assign the value of "list box field" in the CIW, the selection in the "list box field" dose change.

below is my callback fucntion, and "fPinInfoSel" is the listBoxField.

Does anyone knows where is wrong?

procedure(fFilterButtonCB(form)
let(
(
    DeSelPinKeyWordList           ;list of key words for deselected pin
    pinNameList                            ;an operation list
);local variable
    DeSelPinKeyWordList = parseString(SISpinInfoSelForm->fDeSelPinKeyWord->value)
    
    pinNameList = form->fPinInfoSel->value
    
    foreach(DeSelPinKeyWord DeSelPinKeyWordList
        foreach(pinName pinNameList
            when(rexMatchp(DeSelPinKeyWord pinName)
                remd(pinName pinNameList)
            );when
        );foreach pinName
    );foreach
    
    form->fPinInfoSel->value = pinNameList
    
);let
);proc

  • Cancel
Parents
  • Andrew Beckett
    Andrew Beckett over 9 years ago

    There is no bug here. 

    The original problem is caused by the use of remd(). There are two problems - one is that the return value of remd() is not being used - and whilst a destructive removal of an entry in a list is OK, if you remove the first entry in a list this way, it does not change the list contents, but instead returns a pointer to the new beginning of the list. For example:

    lst='(1 2 3 4 5)
    remd(2 lst) => (1 3 4 5)
    lst => (1 3 4 5)

    remd(1 lst) => (3 4 5)
    lst => (1 3 4 5)

    The reason for this is that the variable lst is pointing to the list cell containing 1 - and the remd() function has no idea what variables are pointing to the same list - all it can do is destructively remove entries within the list, and if it's the first, change what it returns the pointer to. So this is to be expected.

    As Lawrence said, you should use the return value of remd.

    However, a second issue is that using remd() interferes with the form - you're manipulating data that is used within the form, and what happens is that the selection itself doesn't notice the removal - because you removed it from the list on the form itself. This is just a side effect of using destructive operations on a list that is shared with the form - and so you're getting odd behaviour. Luckily it's easily solved - either use remove() instead of remd(), or continue to use remd() (using the return value as Lawrence suggested) but do it on a copy of the original list:

    procedure(fFilterButtonCB(form)
    let(
    (
        DeSelPinKeyWordList ;list of key words for deselected pin
        pinNameList ;an operation list
    );local variable
        DeSelPinKeyWordList = parseString(SISpinInfoSelForm->fDeSelPinKeyWord->value)

        pinNameList = copy(form->fPinInfoSel->value)

        foreach(DeSelPinKeyWord DeSelPinKeyWordList
            foreach(pinName pinNameList
                when(rexMatchp(DeSelPinKeyWord pinName)
                    pinNameList=remd(pinName pinNameList)
                );when
            );foreach pinName
        );foreach

        form->fPinInfoSel->value = pinNameList

    );let
    );proc

    As for the final issue with the loop, that's to be expected too.

    For a start, the code should be this:

    foreach(pinInfoString pinInfoStringList

      FORM1->fPinInfoSel->value = list(pinInfoString)

      printf("%s\n", pinInfoString)

    );foreach

    Once this is run, the UI only updates at the end - the code is still running and so you won't see the form refresh. So I'm not really sure what you're expecting it to do.

    So I'm not sure what long-standing issue Sjoerd was referring to - there's nothing wrong here.

    Regards,

    Andrew.

    • Cancel
    • Vote Up 0 Vote Down
    • Cancel
Reply
  • Andrew Beckett
    Andrew Beckett over 9 years ago

    There is no bug here. 

    The original problem is caused by the use of remd(). There are two problems - one is that the return value of remd() is not being used - and whilst a destructive removal of an entry in a list is OK, if you remove the first entry in a list this way, it does not change the list contents, but instead returns a pointer to the new beginning of the list. For example:

    lst='(1 2 3 4 5)
    remd(2 lst) => (1 3 4 5)
    lst => (1 3 4 5)

    remd(1 lst) => (3 4 5)
    lst => (1 3 4 5)

    The reason for this is that the variable lst is pointing to the list cell containing 1 - and the remd() function has no idea what variables are pointing to the same list - all it can do is destructively remove entries within the list, and if it's the first, change what it returns the pointer to. So this is to be expected.

    As Lawrence said, you should use the return value of remd.

    However, a second issue is that using remd() interferes with the form - you're manipulating data that is used within the form, and what happens is that the selection itself doesn't notice the removal - because you removed it from the list on the form itself. This is just a side effect of using destructive operations on a list that is shared with the form - and so you're getting odd behaviour. Luckily it's easily solved - either use remove() instead of remd(), or continue to use remd() (using the return value as Lawrence suggested) but do it on a copy of the original list:

    procedure(fFilterButtonCB(form)
    let(
    (
        DeSelPinKeyWordList ;list of key words for deselected pin
        pinNameList ;an operation list
    );local variable
        DeSelPinKeyWordList = parseString(SISpinInfoSelForm->fDeSelPinKeyWord->value)

        pinNameList = copy(form->fPinInfoSel->value)

        foreach(DeSelPinKeyWord DeSelPinKeyWordList
            foreach(pinName pinNameList
                when(rexMatchp(DeSelPinKeyWord pinName)
                    pinNameList=remd(pinName pinNameList)
                );when
            );foreach pinName
        );foreach

        form->fPinInfoSel->value = pinNameList

    );let
    );proc

    As for the final issue with the loop, that's to be expected too.

    For a start, the code should be this:

    foreach(pinInfoString pinInfoStringList

      FORM1->fPinInfoSel->value = list(pinInfoString)

      printf("%s\n", pinInfoString)

    );foreach

    Once this is run, the UI only updates at the end - the code is still running and so you won't see the form refresh. So I'm not really sure what you're expecting it to do.

    So I'm not sure what long-standing issue Sjoerd was referring to - there's nothing wrong here.

    Regards,

    Andrew.

    • Cancel
    • Vote Up 0 Vote Down
    • Cancel
Children
No Data

Community Guidelines

The Cadence Design Communities support Cadence users and technologists interacting to exchange ideas, news, technical information, and best practices to solve problems and get the most from Cadence technology. The community is open to everyone, and to provide the most value, we require participants to follow our Community Guidelines that facilitate a quality exchange of ideas and information. By accessing, contributing, using or downloading any materials from the site, you agree to be bound by the full Community Guidelines.

© 2025 Cadence Design Systems, Inc. All Rights Reserved.

  • Terms of Use
  • Privacy
  • Cookie Policy
  • US Trademarks
  • Do Not Sell or Share My Personal Information