Submit Hint Search The Forums LinksStatsPollsHeadlinesRSS
14,000 hints and counting!

10.4: Enable the decimal key in Calculator widget System 10.4
Tiger only hintOn non-English keyboards, the dot "." on the numeric pad does not work as a decimal point if you use it with the Calculator Dashboard widget. This is quite annoying, so here is a one-line hack to fix the problem...

Go to /Library/Widgets, and make a backup of the Calculator widget -- just Option-drag it elsewhere on the disk to make a copy. Control-click on "Rechner," "Calculator," or whatever the localized name is, and choose Show Package Contents ("Paketinhalt zeigen"). In the new window that opens, open Calculator.js in your favorite text editor. Go to line 66, in function "translateKey(e)", switch(e.charCode). The current line should be:
case 46: 
key = "decimal";
break;
Now just add case 44 as shown below:
case 44:
case 46:
key = "decimal";
break;
Now save, open Dashboard, remove the current Calculator, if it's open, add a new one and voila! You can now use the numeric keypad.
    •    
  • Currently 2.40 / 5
  You rated: 2 / 5 (5 votes cast)
 
[10,743 views]  

10.4: Enable the decimal key in Calculator widget | 9 comments | Create New Account
Click here to return to the '10.4: Enable the decimal key in Calculator widget' hint
The following comments are owned by whoever posted them. This site is not responsible for what they say.
10.4: Enable the decimal key in Calculator widget
Authored by: Akira on Jun 22, '05 11:54:26AM

case 44:
case 46:
key = "decimal";
break;
doesn't this create a statement with a nested "case 46:"-line?
(if case is not 44, but is 46, it will not assign "decimal" to key)

[ Reply to This | # ]
10.4: Enable the decimal key in Calculator widget
Authored by: 3mors on Jun 22, '05 12:08:42PM

no, as u can see in that switch, for example, equal is assigned to multiple keys in the same way.

---
-------
3mors



[ Reply to This | # ]
10.4: Enable the decimal key in Calculator widget
Authored by: fracai on Jun 22, '05 12:10:55PM

because there is no break after the first case statement this will match both 44 and 46 (ie. decimal will be used in case 44 and in case 46)

---
i am jack's amusing sig file



[ Reply to This | # ]
10.4: Enable the decimal key in Calculator widget
Authored by: poenn on Jun 22, '05 12:30:17PM

Na endlich, ich bin fast durchgedreht mit dem SCH... Punkt! :-)

Vielen Dank!



[ Reply to This | # ]
10.4: Enable the decimal key in Calculator widget
Authored by: Swordfish on Jun 22, '05 12:43:36PM
Thanks for this one! Anyone know how to replace the comma in thousands by a space?

replace this:
2,333
by this:
2 333


[ Reply to This | # ]
10.4: Enable the decimal key in Calculator widget
Authored by: mee-z on Jun 22, '05 03:47:38PM

Should be in Line 417 (Line 418 in case you added a line for the "case 44:" extra)

var delimiter = ",";
Just replace
","
with
" "
(space) or
"."
to display the character of your choice.

---

mee-z



[ Reply to This | # ]
10.4: Enable the decimal key in Calculator widget
Authored by: Swordfish on Jun 24, '05 02:11:53PM

Thank you!



[ Reply to This | # ]
10.4: Enable the decimal key in Calculator widget
Authored by: Anonymous on Jul 05, '05 01:07:14AM

Ok in spanish the number formating is like this: 1.234,56

I already know (from previous posts) how to display a dot to separate the thousands. Does anyone know how to display a comma to separate the decimals?

Thanx a lot



[ Reply to This | # ]
10.4: Enable the decimal key in Calculator widget
Authored by: KenaiTheMacFan on Jul 13, '05 09:07:08PM

You should not have to close/reopen the widget. Just refresh it. To refresh any widget click it and push Command-R.

---
Ian



[ Reply to This | # ]