Sunday, January 2, 2011

CommandImageAndTextRelationAttribute class of LinsUI Layout Manager 2.1

Specifies the position of the text and image relative to each other on the item.
Examples
using LinsUI;

public static class LinsResource
{
[CommandGroupNameAttribute("Main"), // The Category name
 // Command name
 CommandNameAttribute("Import"),
 // Tell the application, it is a menu item 
 CommandTypeAttribute(TSITEM_TYPEID.MENUITEM),
 // The Menu item Icon
 CommandImageAttribute("import2.ico"),    
 // Menu item display style                                      
 CommandAppearanceAttribute(ToolStripItemDisplayStyle.ImageAndText),
 // The Text and Icon relation
 CommandImageAndTextRelationAttribute(TextImageRelation.TextBeforeImage)],
public const long m_nColorID =  FlexConstants.m_nUserDefinedControlStartID + 1;

CommandIDAttribute class of LinsUI Layout Manager 2.1

This class works together with CommandEventAttribute to associate a function to a command.
Examples
using LinsUI;

// when the Color dropdown is created, this event will be fired and only fired once.
// The user can use this event to do initialization
// The command ID
[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);
}

CommandHelpFileAttribute class of LinsUI Layout Manager 2.1

Links help documentation with the command. This help documentation must be a Rich-Text-Format (RTF) file, and it must be stored under the directory defined by FlexUISettings. DefaultHelpFilePath.
If user clicks at the  icon on the tooltip, the system will pop up a dialog which will open the specified help file.
Examples
using LinsUI;

public static class LinsResource
{
[CommandGroupNameAttribute("Shapes and Pictures"), // The Category name
 // Command name
 CommandNameAttribute("Color"),
 // Tell the application, it is a combobox 
 CommandTypeAttribute(TSITEM_TYPEID.COMBOBOX),  
 // Tooltip for the combobox  
 ToolTipAttribute("Select a color for the shape"),
 // The detail description        
 CommandHelpFileAttribute("ColorHelp.rtf")]     
public const long m_nColorID =  FlexConstants.m_nUserDefinedControlStartID + 1;


CommandGroupNameAttribute class of LinsUI Layout Manager 2.1

Specifies which category the command belongs to.
The following code specifies that the command “Color” belongs to the “Shapes and Pictures” category.
Examples
using LinsUI;

public static class LinsResource
{
[CommandGroupNameAttribute("Shapes and Pictures"), // The Category name
 // Command name
 CommandNameAttribute("Color"),
 // Tell the application, it is a combobox 
 CommandTypeAttribute(TSITEM_TYPEID.COMBOBOX)]  
public const long m_nColorID =  FlexConstants.m_nUserDefinedControlStartID + 1;

CommandEventAttribute class of LinsUI Layout Manager 2.1

This class works together with CommandIDAttribute to associate a function to a command.
Examples
using LinsUI;

// 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;

CommandAppearanceAttribute class of LinsUI Layout Manager 2.1

Specifies what to render (image, text, or both) for this item.
Examples
using LinsUI;

public static class LinsResource
{
[CommandGroupNameAttribute("Main"), // The Category name
 // Command name
 CommandNameAttribute("Import"),
 // Tell the application, it is a menu item 
 CommandTypeAttribute(TSITEM_TYPEID.MENUITEM),
 // The Menu item Icon
 CommandImageAttribute("import2.ico"),    
 // Menu item display style                                      
 CommandAppearanceAttribute(ToolStripItemDisplayStyle.ImageAndText)]
public const long m_nColorID =  FlexConstants.m_nUserDefinedControlStartID + 1;

Troubleshooting for LinsUI Layout Manager 2.1

1.    Crashes when launch the application or import a layout setting file
a.    It may cause by the change of the unique ID of object. In the LinsUI Layout Manager, once an object is assigned to a unique ID, the ID should not be changed anymore. If it needs to be changed, then there are several ways to prevent the mess up.
1)    Open the AssemblyInfo.cs which resides at Properties folder of your project. Add the following to the file,
using LinsUI;
[assembly: FlexVersion(1)]
Every time you need to change a unique ID of an object, you need to increase the version number, such as, from 1 to 2. In that way the LinsUI Layout Manager will use the programmatic setting to avoid mess-up.
2)     Delete FlexUILayout.xml file which is located under the directory defined by FlexUISettings.AppSettingPath.

Download Free Trial,