Cdf parameters: modifying the attributes?

Discussion in 'Cadence' started by bu-bu, Jul 31, 2008.

  1. bu-bu

    bu-bu Guest

    Hi,

    I have a pcell with many CDF parameters definitions... maybe too many,
    but it's necessary.

    I have a cyclic button that allows me to choose some parameters. I
    would like to create a callback with this cyclic to hide (or make not
    editable ) the useless parameters.

    I created a .callback file, with the following contents:

    procedure(setFields()
    if(cdfgData->Type->value == "foo" then
    cdfgData->MyParam->editable = "nil"
    ....
    ....
    ....
    ....
    ))
    cdfgData is defined nowhere in my program. I picked it from CDFuser
    doc.
    I suppose it's an internal variable.

    when i try to modify the Type parameter by "Edit instance Properties"
    i get the error message in CIW:

    *WARNING* Can't modify attributes of effective CDF parameters.

    My questions are : Am i wrong with my callback?
    Or can't i modify the fields attributes by this way ? Or can't i
    modify the fields attribute at all ?

    thanks for your answers.
    regards,

    b.
     
    bu-bu, Jul 31, 2008
    #1
  2. bu-bu

    Riad KACED Guest

    Hi Bu-bu,

    The attribute 'editable' is not valid for the 'cyclic' type I'm
    afraid. Please cross-check in your CDF documentation. there is a table
    that shows you, for each type, which attributes are required,
    optional or unused. and BTW, I'm seeing in your attached code you're
    using :
    cdfgData->MyParam->editable = "nil"

    Please bear in mind that "nil" is actually a string and evaluates to
    true which is different altogether from the symbol nil.
    Try :
    CIW> null(nil)
    CIW> null('nil)
    CIW> null("nil")

    Cheers,
    Riad.
     
    Riad KACED, Aug 5, 2008
    #2
  3. bu-bu

    bu-bu Guest

    Hello Riad,

    thanks a lot for your answer.

    actually, my code is like this:

    cdfCreateParam( cdfId
    ?name "Type"
    ?prompt "Type of transistor"
    ?defValue "myvalue"
    ?type "cyclic"
    ?choices '( ... my choices ... )
    ?display "t"
    ?callback "Set()"
    )


    cdfCreateParam( cdfId
    ?name "namae"
    ?prompt "myprompt:"
    ?defValue defvalue
    ?type "float"
    ?editable "nil"
    ?display "t"
    )


    and my callback is:
    procedure(Set()

    if(cdfgData->Type->value == "namae" then
    cdfgForm->namae->editable = t
    cdfgForm->cdfModified = t
    ) ;; if
    ) ;; proc

    I need the editable field = t when the cyclic field choice is on
    "namae". I wrote the above code. Now i don't have error message
    anymore, but field is still not editable even if my type choice
    satisfy the if condition.

    If i write
    cdfgData->namae->editable = t

    error message in CIW is : *WARNING* Can't modify attributes of
    effective CDF parameters.

    if i write
    cdfgForm->namae->editable = t
    No error message but field is not editable.

    Regarding "namae" parameter, If i define:
    ?editable "nil"
    Then field is not editable by default , but i can not make it editable
    by callback

    If i define:
    ?editable nil
    Then field is editable by default, and i don't want that.

    Do you have an idea what is wrong with my code ?

    Thanks and regards,

    b.
     
    bu-bu, Aug 5, 2008
    #3
  4. bu-bu

    bu-bu Guest

    Hello Riad,

    thanks a lot for your answer.

    actually, my code is like this:

    cdfCreateParam( cdfId
    ?name "Type"
    ?prompt "Type of transistor"
    ?defValue "myvalue"
    ?type "cyclic"
    ?choices '( ... my choices ... )
    ?display "t"
    ?callback "Set()"
    )

    cdfCreateParam( cdfId
    ?name "namae"
    ?prompt "myprompt:"
    ?defValue defvalue
    ?type "float"
    ?editable "nil"
    ?display "t"
    )

    and my callback is:
    procedure(Set()

    if(cdfgData->Type->value == "namae" then
    cdfgForm->namae->editable = t
    cdfgForm->cdfModified = t
    ) ;; if
    ) ;; proc

    I need the editable field = t when the cyclic field choice is on
    "namae". I wrote the above code. Now i don't have error message
    anymore, but field is still not editable even if my type choice
    satisfy the if condition.

    If i write
    cdfgData->namae->editable = t

    error message in CIW is : *WARNING* Can't modify attributes of
    effective CDF parameters.

    if i write
    cdfgForm->namae->editable = t
    No error message but field is not editable.

    Regarding "namae" parameter, If i define:
    ?editable "nil"
    Then field is not editable by default , but i can not make it editable
    by callback

    If i define:
    ?editable "t"
    Then field is editable by default, and i don't want that.

    Do you have an idea what is wrong with my code ?

    Thanks and regards,

    b.
     
    bu-bu, Aug 5, 2008
    #4
  5. bu-bu wrote, on 08/05/08 11:36:
    Note that you cannot change the editable field in a callback. What you should do
    instead is to make the editable field a SKILL expression, which resolves to
    either t or nil. Effectively it's a callback - and it can then determine whether
    the field is editable or not by looking at the values of other fields.

    For example, in the CDF, you could make the editable field of namae be
    "cdfgData->Type->value!=\"namae\""

    This would immediately make the namae field uneditable if Type was set to namae.
    The expression (like other callbacks) can be whatever SKILL function you want -
    although it should be something fairly quick, ideally. If you need complex
    control, you could always defined a new parameter "namee_editable" which you
    could then update from your callback

    procedure(Set()

    if(cdfgData->Type->value == "namae" then
    cdfgData->namae_editable->value = t
    ) ;; if
    ) ;; proc

    and then have the "editable" callback of namae set to

    cdfgData->namae_editable->value

    (BTW, I assume you're not really calling your callback "Set" - it should have
    a sensible prefix to avoid it clashing with other functions).

    Regards,

    Andrew.
     
    Andrew Beckett, Aug 8, 2008
    #5
  6. bu-bu

    bu-bu Guest

    Hello Andrew,

    thanks for your answer. Actually, i gave up to make editable fields in
    a callback file ... I did what you said, and it works fine now.

    Thanks again ^^

    b.
     
    bu-bu, Aug 13, 2008
    #6
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.