Tom Muck

Alpha Dog Blues Band
Home page
All articles | DWTeam | Flash Remoting | Basic-Ultradev | Community MX
All Extensions | Extension News | Extension FAQs | Customer Login
Books authored or co-authored by Tom Muck
Extensions, books, and other products | Customer Login
Your current cart contents
Tom-Muck.com Blog | CMXTraneous Blog | Flash Remoting Blog
About the site

Blog

Tom Muck's Blog: Blogs for Dreamweaver extension developersTom Muck's Blog

News and Views

Blogs for Dreamweaver extension developers

Friday, September 17, 2004 1:21:06 PM

For all you Dreamweaver extension developers, Paul Boon has come out of hiding and has been blogging like crazy on a multitude of extension building techniques, undocumented API calls, and other DW goodies. Check out his blog at http://www.communitymx.com/blog/index.cfm?blogger=35. Not to be outdone, Danilo Celic has also posted a bunch of cool items as well: http://www.communitymx.com/blog/index.cfm?blogger=12.

If you have my JavaScript Evaluation panel (available at Community MX, with an older version available on the CDROM for Dreamweaver MX 2004: The Complete Reference) you can test out many of these API calls. This one I thought was really cool: Using Popup Menus in Extensions (blogged by Paul at http://www.communitymx.com/blog/index.cfm?newsid=119). It is infinitely better than creating dynamic menus within the menus.xml file, which can be really tedious to code. A simple example of how you could use this in an extension is to open up a web address:

function popupMenu(a){
  var m = new PopupMenu();
  for(var i=0;i < a.length;i++){
    m.addItem(a[i]);
  }
  var s=m.popup();
  return s;
}

var myMenuItems=new Array('CommunityMX','tom-muck','DWFAQ','Flash-Remoting');
var response = popupMenu(myMenuItems);
if(response != '')
  dw.browseDocument("http://www." + response + ".com");

If you run this from the JavaScript eval window, you'll get a popup menu that will open up the site. Another use would be to get a list of currently open documents and full file paths to allow switching between them:

function popupMenu(a){
  var m = new PopupMenu();
  for(var i=0;i < a.length;i++){
    m.addItem(a[i]);
  }
  var s=m.popup();
  return s;
}

var fileDoms = dreamweaver.getDocumentList();
var currDom = dreamweaver.getActiveWindow();
var menuItems = new Array();
var fileName;
for(var i=0;i<fileDoms.length; i++) {
  fileName = (fileDoms[i].URL == "")?"(Unsaved Document)":MMNotes.localURLToFilePath(fileDoms[i].URL);
  if(fileDoms[i] == currDom) fileName = "* " + fileName;
  menuItems.push(fileName);
}
var response = popupMenu(menuItems);
if(response != '')
  dw.openDocument(response);

Category tags: Community MX, Dreamweaver

Before posting comments or trackbacks, please read the posting policy.

Full Blog Calendar

Pay me securely with your Visa, MasterCard, Discover, or American Express card through PayPal!
Pay me securely with your Visa, MasterCard, Discover, or American Express card through PayPal!
About | Privacy Policy | Contact | License Agreement | ©2002-2017 Tom Muck | Dreamweaver Extensions