Sunday, January 2, 2011

CUSTOM_TI_EVENT enumeration of LinsUI Layout Manager 2.1

Specifies what kind of event the function is associated to. INITIALIZE, HELPBUTTON_CLICK, and UPDATE_COMMAND_UI are three LinsUI defined events. All the others are winform defined events.
§         ACCEPTS_TAB_CHANGED:           
Equal to AcceptsTabChanged event for TextBox.
§         CHECKED_CHANGED:                  
Equal to CheckedChanged event for Button and MenuItem.
§         CHECK_STATE_CHANGED:
Equal to CheckStateChanged event for Button and MenuItem.
§         CLICK:       
Equal to Click event for item.
§         BUTTON_CLICK:
Equal to ButtonClick event for SplitButton.
§         BUTTONDOUBLE_CLICK:               
Equal to ButtonDoubleClick event for SplitButton.
§         DROPDOWN:                                 
Equal to DropDown event for ComboBox.
§         DROPDOWN_CLOSED:                  
Equal to DropDownClosed event for MenuItem, DropDownButton, SplitButton, and ComboBox.
§         DROPDOWNITEM_CLICKED:          
Equal to DropDownItemClicked event for MenutItem, DropDownButton, SplitButton.
§         DROPDOWNITEM_OPENED:          
Equal to DropDownOpened event for MenutItem, DropDownButton, SplitButton.
§         DROPDOWNITEM_OPENING:         
Equal to DropDownOpening event for MenutItem, DropDownButton, SplitButton.
§         HELPBUTTON_CLICK:                    
Customized event. When click at the help button on Tooltip, this event will be fired.
§         HIDE_SELECTION_CHANGED:       
Equal to HideSelectionChanged event for TextBox.
§         INITIALIZE:                                     
Customized event. Initialize for all items.
§         KEY_DOWN:                                 
Equal to KeyDown event for ProgressBar, TextBox, and ComboBox.
§         KEY_PRESS:                                
Equal to KeyPress event for ProgressBar, TextBox, and ComboBox.
§         KEY_UP:                                       
Equal to KeyUp event for ProgressBar, TextBox, and ComboBox.
§         MODIFIED_CHANGED:                   
Equal to ModifiedChanged event for TextBox.
§         MOUSE_ENTER:                            
Equal to MouseEnter event for all items.
§         MOUSE_HOVER:                           
Equal to MouseHover event for all items.
§         MOUSE_LEAVE:                            
Equal to MouseLeave event for all items.
§         SELECTED_INDEX_CHANGED:      
Equal to SelectedIndexChanged event for ComboBox.
§         TEXT_CHANGED:                           
Equal to TextChanged event for all items.
§         TEXTBOX_TEXTALIGN_CHANGED:
Equal to TextAlignChanged event for TextBox.
§         TEXT_UPDATE:                              
Equal to TextUpdate event for ComboBox.
§         UPDATE_COMMAND_UI:                
Customized event. When the application is idle, it will raise the event for every tool/menu item to update their status.


The following example demonstrates how to specify and code the handler for the INITIALIZE event of a Dropdown control
Examples 1:
First define a unique ID for m_nColorsDropDownID in LinsResource class as following,
using LinsUI;
public static class LinsResource
{
 // The Category name
[CommandGroupNameAttribute("Colors"),              
 // Tell the application, it is a dropdown button
 CommandTypeAttribute(TSITEM_TYPEID.DROPDOWNBUTTON),  
 // Tooltip for the menu item  
 ToolTipAttribute("Select a color"),   
 // The detail description           
 DetailDescriptionAttribute("Select a color for the selected shapes.")]    
public const long m_nColorsDropDownID = FlexConstants.m_nUserDefinedControlStartID + 5;
}

Then assign the unique ID to the tag of the menu item, and define the handler function for the INITIALIZE event as following,

public partial class ColorsMenu : LinsUI.LinsMenuStrip
{
private ToolStripMenuItem m_Colors;
public ColorsMenu()
{
InitializeComponent();
m_Colors = new ToolStripMenuItem();
// Assign an unique ID to the m_Colors menu dropdown item
m_Colors.Tag = LinsResource.m_nColorsDropDownID;
 }

// define the handler function for the INITIALIZE event
// when the Color dropdown is created, this event will be fired and only fired once.
// The user can use this event to do initialization
[CommandIDAttribute(LinsResource.m_nColorsDropDownID),
// The event type, here is an initialize event    
 CommandEventAttribute(CUSTOM_TI_EVENT.INITIALIZE)]
void ColorsInitialize(object sender, System.EventArgs e)
{
// Add all possible colors into the Color dropdown list
foreach (Color_Name pair in DemoManager.m_lsColorName)
{
this.m_Colors.DropDownItems.Add(pair.m_csName);
}
}
}

The following example demonstrates how to specify and code the handler for the UPDATE_COMMAND_UI event of a Dropdown control
Examples 2:
First define a unique ID for m_nColorsDropDownID in LinsResource class as following,
using LinsUI;
public static class LinsResource
{
 // The Category name
[CommandGroupNameAttribute("Colors"),              
 // Tell the application, it is a dropdown button
 CommandTypeAttribute(TSITEM_TYPEID.DROPDOWNBUTTON),  
 // Tooltip for the menu item  
 ToolTipAttribute("Select a color"),   
 // The detail description           
 DetailDescriptionAttribute("Select a color for the selected shapes.")]    
public const long m_nColorsDropDownID = FlexConstants.m_nUserDefinedControlStartID + 5;
}

Then assign the unique ID to the tag of the menu item, and define the handler function for the UPDATE_COMMAND_UI event as following,

public partial class ColorsMenu : LinsUI.LinsMenuStrip
private ToolStripMenuItem m_Colors;
public ColorsMenu()
{
InitializeComponent();
m_Colors = new ToolStripMenuItem();
// Assign an unique ID to the m_Colors menu dropdown item
m_Colors.Tag = LinsResource.m_nColorsDropDownID;
}

// define the handler function for the UPDATE_COMMAND_UI event 
// when system is on idle, this event will be fired, and
// user can use this to update the user interface for the Color dropdown
[CommandIDAttribute(LinsResource.m_nColorsDropDownID),
 CommandEventAttribute(CUSTOM_TI_EVENT.UPDATE_COMMAND_UI)]
public void OnUpdateUIColorDropDown(object sender, UpdateUIEventArgs ev)
{
ev.Enabled = true;
}
}


The following example demonstrates how to specify and code the handler for the HELPBUTTON_CLICK event of a Dropdown control
Examples 3:

First define a unique ID for m_nColorsDropDownID in LinsResource class as following,
using LinsUI;
public static class LinsResource
{
 // The Category name
[CommandGroupNameAttribute("Colors"),              
 // Tell the application, it is a dropdown button
 CommandTypeAttribute(TSITEM_TYPEID.DROPDOWNBUTTON),  
 // Tooltip for the menu item  
 ToolTipAttribute("Select a color")]   
public const long m_nColorsDropDownID = FlexConstants.m_nUserDefinedControlStartID + 5;
}

Then assign the unique ID to the tag of the menu item, and define the handler function for the HELPBUTTON_CLICK event as following,

public partial class ColorsMenu : LinsUI.LinsMenuStrip
{  
private ToolStripMenuItem m_Colors;
public ColorsMenu()
{
InitializeComponent();
m_Colors = new ToolStripMenuItem();
// Assign an unique ID to the m_Colors menu dropdown item
m_Colors.Tag = LinsResource.m_nColorsDropDownID;
}

// define the handler function for the HELPBUTTON_CLICK event 
// once user clicks at the help button on Tooltip, this event will be fired
// user can use this to link to the command’s help documentation
[CommandIDAttribute(LinsResource.m_nColorsDropDownID),
 CommandEventAttribute(CUSTOM_TI_EVENT.HELPBUTTON_CLICK)]
public void OnColorDropDownHelpButtonClick(object sender, HelpButtonEventArgs ev)
{
}

No comments:

Post a Comment