[Mono-osx] How to Create toolbar in MonoMac, Please?
roger_xiong
anson.tongbu at gmail.com
Wed Aug 17 12:18:58 EDT 2011
Hi there, I'm a fresh, seeking for some help. I'm encountering a couple of
problems when I create toolbar by using monomac.
I built a program in monomac and added a NSToolbar in interface builder.
Then I added an outlet called toolbar in MainWindowController. The outlet is
also related to NSToolbar.
But what next? I have no clue how to add ToolItem in MonoDevelop by code,
and how to access the ToolbarItem Click Events?
Many Thanks!
My Code:
-----------------------------
using System;
using System.Collections.Generic;
using System.Linq;
using MonoMac.Foundation;
using MonoMac.AppKit;
namespace ToolbarDemo
{
public partial class MainWindowController :
MonoMac.AppKit.NSWindowController
{
#region Constructors
// Called when created from unmanaged code
public MainWindowController (IntPtr handle) : base(handle)
{
Initialize ();
}
// Called when created directly from a XIB file
[Export("initWithCoder:")]
public MainWindowController (NSCoder coder) : base(coder)
{
Initialize ();
}
// Call to load from the XIB/NIB file
public MainWindowController () : base("MainWindow")
{
Initialize ();
}
// Shared initialization code
void Initialize ()
{
}
public override void AwakeFromNib ()
{
base.AwakeFromNib ();
toolbar.AllowsUserCustomization = true;
toolbar.AutosavesConfiguration = true;
toolbar.DisplayMode = NSToolbarDisplayMode.Icon;
}
#endregion
//strongly typed window accessor
public new MainWindow Window {
get { return (MainWindow)base.Window; }
}
}
}
--
View this message in context: http://mono.1490590.n4.nabble.com/How-to-Create-toolbar-in-MonoMac-Please-tp3750455p3750455.html
Sent from the Mono - OSX mailing list archive at Nabble.com.
More information about the Mono-osx
mailing list