<html>
<head>
<style><!--
.hmmessage P
{
margin:0px;
padding:0px
}
body.hmmessage
{
font-size: 10pt;
font-family:Tahoma
}
--></style></head>
<body class='hmmessage'><div dir='ltr'>
<br>Hello,<br><br>I'm new around the GeoExt great community, I have probably some pretty basic questions and hope some advanced users could help me to solve them. The thing is that I'd like to put the form print (http://api.geoext.org/1.1/examples/print-form.html) as an icon in my top tool bar, I have already the tbar in my map and the form print is there, however I want to put it inside an icon. Attached you can take a look at the map and how it is now with the form print and a printer icon. The code of the form print is as follows:<br><br>[CODE]<br><pre>// The printProvider that connects us to the print service
var printProvider = new GeoExt.data.PrintProvider({
method: "GET", // "POST" recommended for production use
capabilities: printCapabilities, // from the info.json script in the html
customParams: {
mapTitle: "Printing Demo"
}
});
// Our print page. Stores scale, center and rotation and gives us a page
// extent feature that we can add to a layer.
printPage = new GeoExt.data.PrintPage({
printProvider: printProvider
});
// A layer to display the print page extent
var pageLayer = new OpenLayers.Layer.Vector();
pageLayer.addFeatures(printPage.feature);
// The map we want to print
mapPanel = new GeoExt.MapPanel({
region: "center",
map: {
eventListeners: {
// recenter/resize page extent after pan/zoom
"moveend": function(){ printPage.fit(this, {mode: "screen"}); }
}
}<br>});
// The form with fields controlling the print output
var formPanel = new Ext.form.FormPanel({
region: "west",
width: 150,
bodyStyle: "padding:5px",
labelAlign: "top",
defaults: {anchor: "100%"},
items: [{
xtype: "textarea",
name: "comment",
value: "",
fieldLabel: "Comment",
plugins: new GeoExt.plugins.PrintPageField({
printPage: printPage
})
}, {
xtype: "combo",
store: printProvider.layouts,
displayField: "name",
fieldLabel: "Layout",
typeAhead: true,
mode: "local",
triggerAction: "all",
plugins: new GeoExt.plugins.PrintProviderField({
printProvider: printProvider
})
}, {
xtype: "combo",
store: printProvider.dpis,
displayField: "name",
fieldLabel: "Resolution",
tpl: '<tpl for="."><div class="x-combo-list-item">{name} dpi</div></tpl>',
typeAhead: true,
mode: "local",
triggerAction: "all",
plugins: new GeoExt.plugins.PrintProviderField({
printProvider: printProvider
}),
// the plugin will work even if we modify a combo value
setValue: function(v) {
v = parseInt(v) + " dpi";
Ext.form.ComboBox.prototype.setValue.apply(this, arguments);
}
}, {
xtype: "combo",
store: printProvider.scales,
displayField: "name",
fieldLabel: "Scale",
typeAhead: true,
mode: "local",
triggerAction: "all",
plugins: new GeoExt.plugins.PrintPageField({
printPage: printPage
})
}, {
xtype: "textfield",
name: "rotation",
fieldLabel: "Rotation",
plugins: new GeoExt.plugins.PrintPageField({
printPage: printPage
})
}],
buttons: [{
text: "Create PDF",
handler: function() {
printProvider.print(mapPanel, printPage);
}
}]<br></pre>[/CODE]<br><br>I did a pretty basic code with GeoExt.Action to load a printer icon, here is the code:<br><br>[CODE]<br>action = new GeoExt.Action(<br> {<br> control: new OpenLayers.Control.ZoomBox(),<br> map: map1,<br> //text: "print",<br> //-> button options<br> allowDepress: false,<br> tooltip: "print",<br> //-> check item options<br> iconCls: "print"<br> }<br> );<br> actions["print_icon"] = action;<br> toolbarItems.push(action);<br> toolbarItems.push("-");<br><br>[/CODE]<br><br>it actually doesn't call anything, I only used to load the printer icon.<br><br>Any help is really appreciated, thanks in advance.<br><br>Best regards,<br><br>Gery<br>                                            </div></body>
</html>