Cdf parameters: modifying the attributes?

B

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.
 
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.
 
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.
 
On 8¤ë5¤é, ¤ČŤe8:31, Riad KACED <riad.ka...@gmail.com> wrote:
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.
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 wrote, on 08/05/08 11:36:
On 8¤ë5¤é, ¤ČŤe8:31, Riad KACED <riad.ka...@gmail.com> wrote:
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.

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.
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.
 
On 8¤ë9¤é, ¤ČŤe1:13, Andrew Beckett <andr...@DcEaLdEeTnEcTe.HcIoSm> wrote:
bu-bu wrote, on 08/05/08 11:36:



On 8¤ë5¤é, ¤ČŤe8:31, Riad KACED <riad.ka...@gmail.com> wrote:
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.

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.

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.
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.
 
On Thursday, 31 July 2008 16:04:19 UTC+5:30, bu-bu wrote:
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.

Hi all,
Please help me how to use the buttton option.Please add a sample program of using ?type buttton
 

Welcome to EDABoard.com

Sponsor

Back
Top