Hello,
If you look at the example above, when you click a text field a color Palette comes up; is there an easy way to do this for a graphic (eclipse, triangle...) as well?
edit - Answer -
var myPalette = new ColorPalette({
palette: "7x10",
onChange: function(val){
if(grfx.geometry.type==="point")
{return;}
var result = /^#?([a-f\d]{2})([a-f\d]{2})([a-f\d]{2})$/i.exec(val);
var r = parseInt(result[1], 16)
var g = parseInt(result[2], 16)
var b = parseInt(result[3], 16)
var symbol = new SimpleFillSymbol(SimpleFillSymbol.STYLE_SOLID,
new SimpleLineSymbol(SimpleLineSymbol.STYLE_SOLID,
new Color([0,0,0]), 2),new Color([r,g,b,0.75]));
grfx.setSymbol(symbol);
}
}, "colorPal").startup();
On graphic click, I set the symbol to the color palette.
You have the reference to ColorPalette so the textbox probably uses the dojo widget. You could hide a <div> with the colorpalette widget, then on an event (edit a marker) it becomes visible and the color chosen updates the graphic.
Thanks for the reply. I actually started to do that, that's why there's a reference to colorPalette. If the reference is removed, it still shows up for the Text Box.
thanks, there were some cool stuff in there that I can see myself using.