Monday, November 08, 2010 at 12:00 AM.

system.verbs.apps.cardEditor.examples.newCancelButton

cardEditor.newObject (card.types.buttonType, "cancelButton", "Cancel", "card.close ()");
bundle { <<set up attributes of new object
	local (atts);
	new (tableType, @atts);
	bundle { <<set up atts.objectrect
		local (gridOn, gridVisible, gridUnits);
		cardEditor.getCardGrid (@gridOn, @gridVisible, @gridUnits);
		
		if cardEditor.objectExists ("okButton") {
			local (t, l, b, r);
			rectangle.get (cardEditor.getObjectRect ("okButton"), @t, @l, @b, @r);
			r = l - gridUnits;
			l = r - 60;
			atts.rect = rectangle.set (t, l, b, r)}
		else {
			local (width, height, t, l, b, r);
			cardEditor.getCardSize (@width, @height);
			r = width - gridUnits;
			b = height - gridUnits;
			l = r - 60; <<60 pixels wide
			t = b - 24; <<24 pixels high
			atts.rect = rectangle.set (t, l, b, r)}};
	atts.enab = true;
	atts.filc = rgb.set (-1, -1, -1);
	atts.txtc = rgb.set (0, 0, 0);
	atts.frmc = rgb.set (0, 0, 0);
	atts.flag = false; <<it's not the default button
	atts.font = "Chicago";
	atts.size = 12;
	atts.styl = 0;
	atts.fram = false;
	atts.just = 1;
	atts.sdwd = 0;
	atts.tran = false;
	atts.visi = true;
	cardEditor.setObjectAttributes ("cancelButton", @atts)}



This listing is for code that runs in the OPML Editor environment. I created these listings because I wanted the search engines to index it, so that when I want to look up something in my codebase I don't have to use the much slower search functionality in my object database. Dave Winer.