How to add combo box list to parameters added ynamically

2 views
Skip to first unread message

Sapan AGARWAL

unread,
Jul 4, 2008, 12:20:15 AM7/4/08
to ptolemy...@bennett.eecs.berkeley.edu
Hi All,

I wanted to know the way to add list box to any parameter added dynamically
to an actor through the config dialog box.I know that this can be done in
the code if we use addChoice() method.But I could not find a way to do it
through config dialog box.

Is there any way to do this?

Thanks & Regards,
Sapan

-----Original Message-----
From: Edward A. Lee [mailto:e...@eecs.berkeley.edu]
Sent: Thursday, July 03, 2008 4:40 PM
To: Sapan AGARWAL
Cc: ptolemy...@bennett.EECS.Berkeley.EDU
Subject: Re: How to copy paste model in microsoft powerpoint


I use SangIt to put models into powerpoint.

Note that you only get screen resolution, which isn't good enough to use for
figures in papers. For the latter, I print to PDF using Acrobat, and then
use Acrobat Professional (not the free reader) to crop away the white space.
This can then be used in Latex documents...

Edward

At 12:03 AM 7/2/2008, Sapan AGARWAL wrote:
>Hi All,
>
>I wanted to know if there is a way to copy paste the entire model in
>the Microsoft powerpoint presentation ?
>
>Thanks & Regards,
>Sapan Agarwal
>
>
>-----------------------------------------------------------------------
>----- Posted to the ptolemy-hackers mailing list. Please send
>administrative mail for this list to:
>ptolemy-hac...@ptolemy.eecs.berkeley.edu

------------
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
e...@eecs.Berkeley.EDU,
http://www.eecs.berkeley.edu/Faculty/Homepages/lee.html

----------------------------------------------------------------------------
Posted to the ptolemy-hackers mailing list. Please send administrative
mail for this list to: ptolemy-hac...@ptolemy.eecs.berkeley.edu

Man-Kit Leung

unread,
Jul 7, 2008, 4:54:59 PM7/7/08
to Sapan AGARWAL, ptolemy...@bennett.eecs.berkeley.edu
The short answer to your question is "not supported yet". There are reasons why
this is not implemented. Why would you want to allow user to add configure
choices dynamically in the first place? A typical combo box doesn't allow that.
The proper definition of a combo box is "a combination of a drop-down list or
list box and a single-line textbox, allowing the user either to type a value
directly into the control or choose from the list of existing options". The
StringParameter accomplishes exactly that. But if you still thinks you need to
push on with this feature, you can read on the following:

The current interface to add a new Parameter is specified by the (NAME, CLASS)
pair. You can think of CLASS as the type of the parameter. There are two main
categories a Ptolemy parameter usually falls into: one is what we called
"attribute", and the other is "parameter". Within the two, there are more
sub-types you can pick from, i.e. StringAttribute, ColorAttribute,
FileAttribute, StringParameter, PortParameter, and etc. In your case, the combo
box you describe is of type StringParameter.

The configure dialog of these visible parameters are rendered by the
VisibleParameterEditorFactory class, which in turns uses a PtolemyQuery to
customizes the rendering for the diff parameters according to their types. The
parent class Query actually does most of the heavy lifting. It has a bunch of
add*Chooser() methods, which creates the user-controls.

Therefore, to accomplish what you want, you should first create a new class,
i.e. UserControlComboBoxParameter, that extends the StringParameter. Then, you
should implement your own addUserChoiceControl() method in the base class Query,
similar to the add*Chooser methods. Finally, modify
PtolemyQuery.addStyledEntry() by inserting code to look for any
UserControlComboBoxParameter. If found, then invoke the addUserChoiceControl()
method from the base class.

Good luck~

~mankit

Reply all
Reply to author
Forward
0 new messages