putprop error

Discussion in 'Cadence' started by SS, Mar 12, 2008.

  1. SS

    SS Guest

    I have the following callback function called everytime something
    changes in a toggle field.
    I am getting the following error


    *Error* putprop: first arg must be either symbol, list, defstruct or
    user type - nil

    Here is my callback procedure


    procedure( toggleCB(form field)
    let((fieldValue toggleValue lastValue)
    ;; get the current value of the field
    fieldValue = getq(get(form field) value)
    ;; obtain the toggle value, which is the last value in the list
    toggleValue = car(last(getq(get(form field) value)))
    ;; store a custom property on this field to mark the last value
    lastValue = putpropq(get(form field) !toggleValue storedValue)
    printf("I'm breaking in ToggleAll\n")
    ;; when the current toggle value is not the same as the stored
    value
    ;; set the values all on if the toggle is on, or all off otherwise
    when(toggleValue != lastValue
    if(toggleValue
    putpropq(get(form field) mapcar(lambda((x) x t) fieldValue)
    value)
    putpropq(get(form field) mapcar(lambda((x) x nil) fieldValue)
    value)
    ); if
    ); when
    ); let
    )

    It is erroring out in the putprop statements.

    Could you tell me what is that Iam doing is wrong
     
    SS, Mar 12, 2008
    #1
  2. SS wrote, on 03/12/08 13:31:
    Well, the error suggests that it's the putpropq statement. So most likely it's
    the get(form field) is returning nil, so it's likely to be related to what
    you're passing into the toggleCB function - without knowing that, it's hard to
    tell what's wrong!

    You've only given part of the code, and so if form is a variable containing the
    form data structure, and field is a symbol representing the field name, all
    should be OK, I think (from a quick read through the code - I didn't check it
    thoroughly).

    Regards,

    Andrew.
     
    Andrew Beckett, Apr 2, 2008
    #2
  3. SS

    SS Guest

    Thanks Andrew ,
    Fixed the issue.

    Sriram
     
    SS, Apr 2, 2008
    #3
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.