1. Toolbar initialization steps
[1], Toolbar. FrameworkInitialize ()
All Tool instances are created here (but all their attributes are not initialized ).
[2], Toolbar. OnLoad ()
The AddToolItems () method is called to create a tool instance in Map. Tool bar
The tool class name is ToolbarItem, while the tool class name in Map is MapToolItem. The two are not the same.
AddToolItems:
(1) retrieve all toolbaritems (s) of the Toolbar)
(2) foreach (loop)
{
1. Call callToolbarItemInitialize () to further initialize ToolbarItem,
While callToolbarItemInitialize () calls LoadClassFromAssembly () internally
Create a ServerActionClass instance of ToolBarItem.
Hashtable files are saved to pair the ToolbarItem name with the Object name.
2. Create a MapToolItem instance based on ToolbarItem and add it to the internal worker of Map.
Centralized.
MapToolItem has a ServerToolAction attribute to save the corresponding
ServerActionClass instance.
}
[3], ToolbarBase. RenderContents ()-> RenderRuntime ()
This step is mainly used to generate the Client HTML code of tool bars and tool buttons
RenderRuntime ()
{
......
//
// Call the Render () method of ToolbarItem so that each ToolBarItem generates its own
// Corresponding method
//
Foreach (ToolbarItem item in this. ToolbarItems)
{
Item. Render (this, num2, num3, false, builder );
}
...
}
Tool. Redner () has a lot of work, but the most important thing is the following code:
Render ()
{
...
If (! InDesignMode &&! Base. Disabled)
{
Builder. append (string. format ("onMouseDown = \" ToolbarMouseDown ('{0}', '{1}', 'tool', event); \ "\ n", toolbar. clientID, this. name ));
Builder. append (string. format ("onMouseOver = \" ToolbarMouseOver ('{0}', '{1}'); \ "\ n", toolbar. clientID, this. name ));
Builder. append (string. format ("onMouseOut = \" ToolbarMouseOut ('{0}', '{1}'); \ "\ n", toolbar. clientID, this. name ));
}
...
}
This code means that if you click the button on the toolbar
Function ToolbarMouseDown.
This ToolbarMouseDown () appears in ESRI. ADF. UI. Toolbar. js.