Dialog naming restrictions for plugins/macros?

Previous Topic Next Topic
 
classic Classic list List threaded Threaded
3 messages Options
Reply | Threaded
Open this post in threaded view
|

Dialog naming restrictions for plugins/macros?

Joachim Wesner
Hi,

I recently came about one plugin programming issue that I did not yet read
see mentioned in the docs I browsed through (Sorry, if I missed some
obvious
pointers....)

It goes along this: Many plugins have dialog boxes that pop up each time
you call those manually, however this usually would preclude from using
those plugins in many macros (that repeatedly call those), because
execution would stop and the user would need to interact. However as it
seems, ImageJ has that smart capability to "remote-control" those dialog
boxes, as one can easily verify with the macro recorder. So far, so very
good!!

Nevertheless, it seems, to do this "remote controlling", the above
mechanism seems to use only the first non blank substring of the dialog
entry. Here comes the problem: When I have several entries, that start with
the same substring, I get a message "multiple entries" or similar and it
fails.

As an example, in a 2D phase unwrapping plugin I`m releasing I have several
entries

Quality mode (Selection)
Quality measure (Selection)
Quality map (Selection)

or

Show quality map (Checkbox)
Show residue map (Checkbox)

etc.

Where is this documented, also that "remote control" feature? Do I need to
rename the entries to avoid the same start of the string? Remove blanks?
Replace them by underscore? Can I use some trick to avoid all this?

Joachim


______________________________________________________________________
This email has been scanned by the MessageLabs Email Security System.
For more information please visit http://www.messagelabs.com/email 
______________________________________________________________________
Reply | Threaded
Open this post in threaded view
|

Re: Dialog naming restrictions for plugins/macros?

Wayne Rasband
To work with macros, the first word of each component label in a dialog
must be unique. If this is not the case, add underscores, which will be
converted to spaces when the dialog is displayed. For example, the
three labels

   "Quality mode (Selection)"
   "Quality measure (Selection)"
   "Quality map (Selection)"

should be changed to

   "Quality_mode (Selection)"
   "Quality_measure (Selection)"
   "Quality_map (Selection)"

-wayne

> I recently came about one plugin programming issue that I
> did not yet read see mentioned in the docs I browsed through
> (Sorry, if I missed some obvious pointers....)
>
> It goes along this: Many plugins have dialog boxes that pop
> up each time you call those manually, however this usually
> would preclude from using those plugins in many macros (that
> repeatedly call those), because execution would stop and the
> user would need to interact. However as it seems, ImageJ has
> that smart capability to "remote-control" those dialog
> boxes, as one can easily verify with the macro recorder. So
> far, so very good!!
>
> Nevertheless, it seems, to do this "remote controlling", the
> above mechanism seems to use only the first non blank
> substring of the dialog entry. Here comes the problem: When
> I have several entries, that start with the same substring,
> I get a message "multiple entries" or similar and it fails.
>
> As an example, in a 2D phase unwrapping plugin I`m releasing
> I have several entries
>
> Quality mode (Selection)
> Quality measure (Selection)
> Quality map (Selection)
>
> or
>
> Show quality map (Checkbox)
> Show residue map (Checkbox)
>
> etc.
>
> Where is this documented, also that "remote control"
> feature? Do I need to rename the entries to avoid the same
> start of the string? Remove blanks? Replace them by
> underscore? Can I use some trick to avoid all this?
>
> Joachim
>
> _____________________________________________________________________
> This email has been scanned by the MessageLabs Email Security System.
> For more information please visit http://www.messagelabs.com/email
> ______________________________________________________________________
>
Reply | Threaded
Open this post in threaded view
|

Again: Dialog naming restrictions for plugins/macros?

Joachim Wesner
Hi there,

some time ago, I asked how to work around the problem when using the macro
recorder with plugins
 that have dialog entries that are not unique in the first nonblank part.
The answer was

------------------

To work with macros, the first word of each component label in a dialog
must be unique. If this is not the case, add underscores, which will be
converted to spaces when the dialog is displayed. For example, the
three labels

   "Quality mode (Selection)"
   "Quality measure (Selection)"
   "Quality map (Selection)"

should be changed to

   "Quality_mode (Selection)"
   "Quality_measure (Selection)"
   "Quality_map (Selection)"

------------------

However, it just appears to me, that this works with gd.addNumericField()
but not
with gd.addChoice(), in the latter case the "_" is not converted to a
space!?

E.g. using

gd.addChoice("Input_domain (0..2pi)", scaleOpts, scaleOpts[scaleOpt]);
gd.addNumericField("User_value", userPhase, 4);
gd.addChoice("Quality_processing:", procOpts, procOpts[procOpt]);
gd.addChoice("Quality_measure:", qualOpts, qualOpts[qualOpt]);

I get

Input_domain
User value
Quality_processing
Quality_measure

(I would prefer to have all "_" converted!)

Am I missing something here?


Joachim Wesner


______________________________________________________________________
This email has been scanned by the MessageLabs Email Security System.
For more information please visit http://www.messagelabs.com/email 
______________________________________________________________________