Let's get back to making our little application as annoying as possible by adding an icon and buttons! This can be done by adding a style for the icon, and modifying the config
object to have an icon
property, and an fn property which references a button handler function.
First, let's discuss the CSS we need. Add the following code into the head of the document, within a style tag:
milton-icon { background: url(milton-head-icon.png) no-repeat; }
Also, we will make some changes to our widgets configuration. The icon
property just needs our style name as the value, milton-icon
. We have also included a function to be executed when the user clicks on any of the buttons in the dialog. This function is created as an anonymous function, but the property could also reference a function that was defined elsewhere, possibly as part of a class. In this case, the function is merely used to alert the user which button was pressed, so we will keep it as an anonymous function:
Ext.Msg...