get micron sign into a dialog menu

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

get micron sign into a dialog menu

Michael Doube
Hi all

Just a fiddly little question:  I want to get a menu into a macro dialog
that lists units, mm, µm, nm, px.  To get the µm, I have this code:

var microns = fromCharCode(181,109);
var units = newArray("mm", microns, "nm", "px");

Then put into a dialog menu like this:

Dialog.addChoice("Units: ", units);

but instead of µm I get NaN in my menu.

Any suggestions?

Mik
Reply | Threaded
Open this post in threaded view
|

Re: get micron sign into a dialog menu

Wayne Rasband
On Apr 14, 2008, at 8:52 AM, Michael Doube wrote:

> Hi all
>
> Just a fiddly little question:  I want to get a menu into a macro
> dialog that lists units, mm, µm, nm, px.  To get the µm, I have this
> code:
>
> var microns = fromCharCode(181,109);
> var units = newArray("mm", microns, "nm", "px");
>
> Then put into a dialog menu like this:
>
> Dialog.addChoice("Units: ", units);
>
> but instead of µm I get NaN in my menu.
>
> Any suggestions?

This problem is due to a bug in the newArray() macro function. This bug
is fixed in v1.40e, or you can work around it using

   microns = fromCharCode(181,109);
   units = newArray("mm", microns, "nm", "px");
   units[1] = microns;

-wayne
Reply | Threaded
Open this post in threaded view
|

Re: get micron sign into a dialog menu

Michael Doube
Thanks Wayne, for the amazingly fast bugfix!

Mike

Wayne Rasband wrote:

> On Apr 14, 2008, at 8:52 AM, Michael Doube wrote:
>
>> Hi all
>>
>> Just a fiddly little question:  I want to get a menu into a macro
>> dialog that lists units, mm, µm, nm, px.  To get the µm, I have this
>> code:
>>
>> var microns = fromCharCode(181,109);
>> var units = newArray("mm", microns, "nm", "px");
>>
>> Then put into a dialog menu like this:
>>
>> Dialog.addChoice("Units: ", units);
>>
>> but instead of µm I get NaN in my menu.
>>
>> Any suggestions?
>
> This problem is due to a bug in the newArray() macro function. This bug
> is fixed in v1.40e, or you can work around it using
>
>   microns = fromCharCode(181,109);
>   units = newArray("mm", microns, "nm", "px");
>   units[1] = microns;
>
> -wayne