PDA

View Full Version : Mathematical Widget, Difficult?


trevo
2006-09-27, 05:09
I would like to make a widget that divides two numbers and shows the answer. The problem I have is when it comes to javascript, can anyone give me a hand?

Fahrenheit
2006-09-27, 06:16
Is the calculator widget not sufficient for basic division?

trevo
2006-09-27, 06:55
Sorry my post was a bit vague.

This is what I've quickly made in Illustrator, now i just need help with the code!
http://idisk.mac.com/okeyes/Public/printsize.jpg

Horizontal Pixels is divided by the Output PPI that shows the answer in the first Image Area box. Same goes with the Vertical Pixels.

The 2nd lot to obtain an output PPI is just Horizontal Pixels divided by the Image Area. Same goes with the Vertical Pixels.

:)

MCQ
2006-09-27, 07:34
You should look through the Dashboard Tutorials on the ADC site.
http://developer.apple.com/documentation/AppleApplications/Dashboard-date.html#//apple_ref/doc/uid/TP30000440-TP30000418-TP40001366

I assume somewhere you'll have to script it. I don't know Javascript, but I'm guessing based on this page:
http://developer.apple.com/documentation/AppleApplications/Conceptual/Dashboard_ProgTopics/Articles/CommandLine.html#//apple_ref/doc/uid/TP40003050

Once you have it setup and know the names of your elements, you just have to make some calls like:


document.getElementById("result_item").value = document.getElementById("dividend_item").value / document.getElementById("divisor_item").value;

billybobsky
2006-09-27, 22:16
Is the calculator widget not sufficient for basic division?
This question still holds.