Introduction To Using Dashcode 0


Introduction To Using Dashcode


While I have been working on a new widget for this site I have come across a very good website which details some “advance” Dashcode and dashboard tips that can really help anyone who wants to take their widget to the next level. I am currently improving and changing my widget so it displays more information and has more features. Since I am not that great with javascript it is a big learning curve. But Remy Sharp’s site has a couple of good pointers.

If you don’t want to go through the site it contains:

  • Getting Dashcode
  • Stability
  • Designing Widgets
  • Controls
  • Effects
  • Running System Commands
  • Ajax
  • Attributes
  • Inspectors
  • Gotchas

One point that I must say you can do better is the resizing effect he talks about. Instead of using:

window.resizeTo(x, y);

Which re-sizes the window, and looks a bit messy. You should use this one provided by Apple.

// Values you provide
var itemToResize = document.getElementById("elementID"); // replace with ID of element to resize
var newDimensions = {width: 100, height: 100}; // new CSS width and height values

// Resizing code
var oldWidth = parseInt(document.defaultView.getComputedStyle(itemToResize, null).getPropertyValue("width"));
var oldHeight = parseInt(document.defaultView.getComputedStyle(itemToResize, null).getPropertyValue("height"));
var startingRect = new AppleRect (0, 0, oldWidth, oldHeight);
var finishingRect = new AppleRect (0, 0, newDimensions.width, newDimensions.height);
var resizeHandler = function(rectAnimation, currentRect, startingRect, finishingRect)
{ = currentRect.right + "px"; = currentRect.bottom + "px";
var currentRectAnimation = new AppleRectAnimation( startingRect, finishingRect, resizeHandler );
var currentAnimator = new AppleAnimator (500, 13);

Its a lot more fluid, and looks a lot better. I have a couple of these animations in the new widget and it makes it look a lot better.

If you are interested in designing widgets and want to look at the official page check out Dashboard Programming Topics. It doesn’t have the most detailed topics but there are a couple of good bits which you can use in your widget.

If you know of any good Dashcode resource books or website please leave a comment below. I’m finding some advance aspects quite hard and need a bit more background information.

If you want to keep up with the latests post from Mac Tricks And Tips I recommend you subscribe to the RSS Feed.

Where To Next?

  • Subscribe To Mac Tricks And Tips