| |
This walkthrough contains two files:
- menus.ascx - Defines the menus on the button bar
- info.aspx - The main code page
Note that the info.aspx is mentioned in the appmenus.xml file so
we do not need any custom entry for it.
File: c:\program files\officeclip\7\officeclip\custom\api\walkthru1\menus.ascx
------------------------------------------------------------------------------------------------
<%@ Control Language="C#" %>
<%@ Register TagPrefix="OcTag" TagName="Menu" Src="~/UserControl/Framework/Buttonbar.ascx" %>
<OcTag:Menu ID="buttonBar" runat="server" />
<script language="C#" runat="server">
protected OfficeClip.Utils.OCResources ocr;
protected void Page_Init(object obj, EventArgs e)
{
ocr = new OfficeClip.Utils.OCResources();
buttonBar.Add(1, "Menu 1", ocr.ImagePath("buttonbar/list1.gif"),
ocr.AppPath("custom/API/Walkthru1/info.aspx?id=Menu1"));
buttonBar.Add(2, "Menu 2", ocr.ImagePath("buttonbar/new.gif"),
ocr.AppPath("custom/API/Walkthru1/info.aspx?id=Menu2"));
buttonBar.Add(3, "Menu 3", ocr.ImagePath("buttonbar/list2.gif"),
ocr.AppPath("custom/API/Walkthru1/info.aspx?id=Menu3"));
}
protected void Page_Load(object obj, EventArgs e)
{
}
public OfficeClip.BusinessLayer.Framework.ButtonbarItem GetMenuItem(int item)
{
return buttonBar.GetMenuItem(item);
}
public void Hide(int item)
{
buttonBar.Hide(item);
}
public void Show(int item)
{
buttonBar.Show(item);
}
public void Select(int item)
{
buttonBar.Select(item);
}
</script>
------------------------------------------------------------------------------------------------
More documentation on the methods are available from the
Developer API documentation.
File: c:\program files\officeclip\7\officeclip\custom\api\walkthru1\info.aspx
------------------------------------------------------------------------------------------------
<%@ Page Debug="True" MasterPageFile="~/general/site.master" Language="C#" %>
<%@ Register TagPrefix="OCTag" TagName="Menus" Src="menus.ascx" %>
<script language="C#" runat="server">
protected void Page_Init(object obj, EventArgs e)
{
}
protected void Page_Load(object obj, EventArgs e)
{
((OfficeClip.General.SiteMaster)Master).SetFramework(
OfficeClip.BusinessLayer.Framework.Constants.ToolbarType.Portal,
1001,
"OfficeClip Walkthrough 1", string.Empty
);
menuup.Select(1);
}
</script>
<asp:content id="contHome" runat="server" contentplaceholderid="a">
<table width="100%" border="0" cellspacing="0" cellpadding="0">
<tr>
<td colspan="2" class="buttonbar">
<OCTag:Menus ID="menuup" runat="server" />
</td>
</tr>
<tr><td colspan="2"> </td></tr>
<tr>
<td style="width:5px">
</td>
<td>
This is the walkthrough 1 application
<br />
<%= Request.QueryString["id"] %>
</td>
</tr>
</table>
</asp:content>
-----------------------------------------------------------------------------------------------
|