Apr 112006

I’ve posted my new sample, Adding preferences to an extension to MDC. It includes a downloadable sample. This new example demonstrates how to add a preference dialog to an extension, as well as how to create and handle events for a popup menu.

Feel free to let me know if there’s anything that needs work. Or, you know, you could tweak the article itself. If the code needs fixing, let me know so I can get the downloadable sample fixed.

 Posted by at 7:51 PM

  7 Responses to “Preferences and menus”

  1. stockwatcher2.zip doesn’t wfm on Linux FC5/GNOME2.14.0

    stockwatcher.zip (example2) did show GOOG and stockdata in the statusbar as expected (nice example by the way), but stockwatcher2.zip doesn’t go beyond “Loading…”. Left clicking the “Loading…” field does nothing. The right click context menu also does nothing.

    Anyone else on Linux having trouble?

    Mozilla/5.0 (X11; U; Linux i686; en-US; rv: Gecko/20060124 Firefox/

  2. Hm. I don’t currently have a Linux setup here, so I can’t try it there at the moment. Does the JavaScript console show any error messages?

  3. The JS console is empty. The extension behave as if stockwatcher2.js is missing, cause renaming it and restarting Firefox doesn’t make a difference.

  4. There’s going to be a revision to this code sometime in the next day or so. I’ll blog when it’s up. I don’t know that the revision will help, but it may; we’re doing a redesign of how a few things are done. Looks like when I wrote the code, the material I was using as reference was using some deprecated stuff, so we’re modernizing a bit.

  5. I’ve got FC5 installed locally now and have tested the updated version of the code on it, and it’s working pretty well. It’s not quite ready to post yet, but should go up early next week. Thanks for the heads up on this!

  6. I can confirm, that the updated version fix the above problem I had on FC5.

    But now another issue has surfaced. The tooltip shows the text fine, but it also shows a unicode placeholder character at the end of the text, because the url ends in a newline or something. Stripping off the end of the url like this:

    fieldArray[8] = “” + parseInt(fieldArray[8]);

    makes the unicode placeholder go away, thereby improving the user experience on FC5.

    Alternatively one can change “output.length-1” to “output.length-2”.

    Thanks for a nice extension to play with. I plan to alter it slightly. Making it monitor my numerical computations.

  7. I’ll make the appropriate changes; thanks a lot for your feedback — the issue here is that Unixy OSes use CR/LF for line endings, while both Windows uses only LF and Mac OS X uses only CR; the result is that my code which worked fine on Windows and OS X doesn’t cut off both on Unix type systems.