Hi Edward,

Thanks a lot for your reply. It really helped me.

Thanks & Regards,

-----Original Message-----
From: Edward A. Lee [mailto:[EMAIL PROTECTED] 
Sent: Thursday, June 26, 2008 6:49 PM
Cc: ptolemy-hackers@bennett.EECS.Berkeley.EDU
Subject: Re: How to change icon dynamically

An icon is an instance of ptolemy.vergil.icon.EditorIcon or a subclass that
is contained by the actor.  EditorIcon is a subclass of
ptolemy.kernel.util.Attribute, so it functions in the model like any other
actor parameter.
You can see explicitly in your model if you choose View->Tree View.

If you issue a ChangeRequest or MoMLChangeRequest that removes the previous
icon (setContainer(null)) and adds a new one, then the icon will change.

See the documentation for EditorIcon, ptolemy.moml.MoMLChangeRequest,

Hope this helps.


At 03:35 AM 6/26/2008, Sapan AGARWAL wrote:
>Hi ,
>I am working on Ptolemy II for last few months for one of our projects.I
had one query related to vergil and would really appreciate if you could
asnwer my query.
>We have defined our own actors in Ptolemy and we have also designed icons
for each of the actors. I know that the icon information is automatically
picked up from <actorNmae>Icon.xml. I want to change this icon at run time
based on some configuration parameter. So, for example, I take the case of
memory. If it is selected as DDR, I want to choose one icon and if it is
eSRAM I want to change the icon at run time. I was not able to find out a
way to do that.
>I tried using _attachText() but using that I cannot display the parameters
value on the icon just like the arraylength is displayed on the
ArrayToSequence actor. I even tried using MoMlParser but somehow could not
update the icon. May be I am missing something.
>Could you please let me know if there is a way to do that. I want to keep
two sets of files <actorNmae>Icon1.xml and <actorNmae>Icon2.xml and choose
between the two at run time.
>Thanks a lot for your help in advance.
>Thanks & Regards,
>Sapan Agarwal
>----- Posted to the ptolemy-hackers mailing list.  Please send 
>administrative mail for this list to: 

Edward A. Lee
Robert S. Pepper Distinguished Professor EECS Dept., 545Q Cory Hall, UC
Berkeley, Berkeley, CA 94720-1770
phone: 510-642-0253, fax: 510-642-2845

Posted to the ptolemy-hackers mailing list.  Please send administrative
mail for this list to: [EMAIL PROTECTED]

Reply via email to