Have the toolbar dispatch events, like "mainTBSave, mainTBDelete..

 

Listen for those events in each component that uses the toolbar, and
perform the specific action needed by that component+action

 

Tracy Spratt 
Lariat Services 

Flex development bandwidth available 

________________________________

From: [email protected] [mailto:[email protected]] On
Behalf Of markgoldin_2000
Sent: Monday, February 02, 2009 12:14 PM
To: [email protected]
Subject: [flexcoders] generic toolbar

 

I am putting together a form and a toolbar for basic data operations:
Save, New, Delete.

The toolbar is a separate mxml file (tempEmplMaintToolbar). A 
fragment of my form looks like this:
<mx:FormItem>
<tempEmplMaintToolbar id="toolbar">
</tempEmplMaintToolbar>
</mx:FormItem> 

The toolbar code (prototype):
<?xml version="1.0" encoding="utf-8"?>
<customToolbar xmlns="modulecode.*" 
xmlns:mx="http://www.adobe.com/2006/mxml
<http://www.adobe.com/2006/mxml> " 
width="100" height="300">
<mx:Script>
<![CDATA[
public function saveClick():void
{
} 
]]>
</mx:Script> 
<mx:Button width="16" height="15" id="newbtn" 
icon="@Embed(source='../assets/newsmall.png')" 
toolTip="New"> 
</mx:Button>
<mx:Button width="16" height="15" id="savebtn" 
click="saveClick()"
icon="@Embed(source='../assets/savesmall.png')" 
toolTip="Save"> 
</mx:Button> 
<mx:Button width="16" height="15" id="deletebtn"
icon="@Embed(source='../assets/delete.png')" 
toolTip="Delete"> 
</mx:Button>
</customToolbar>

How do I provide a custom code for toolbar's buttons clicks? Or is 
there a better approach for what I am doing?

Thanks

 

Reply via email to