[Gtk-sharp-list] Toolbar.AppendItem is obsolete and has been
replaced by ToolItem API
Jeroen Zwartepoorte
jeroen.zwartepoorte at gmail.com
Tue Jun 21 02:38:40 EDT 2005
Even better is to use the new UIManager API (if you're using Gtk# >
1.0). See sample/Actions.cs for a concrete example.
Jeroen
On 6/21/05, Mario Carrión <mario.carrion at gmail.com> wrote:
> On Mon, 2005-06-20 at 19:01 -0400, Daniel Morgan wrote:
> > What is the ToolItem API?
> >
> > I get a warning CS0618: 'Gtk.Toolbar.AppendItem(string, string, string,
> > Gtk.Widget, Gtk.SignalFunc)' is obsolete: 'Replaced by ToolItem API'
> >
> > Here is the warning message I get:
> > sqlsharpgtk.cs(545) warning CS0618: 'Gtk.Toolbar.AppendItem(string,
> > string, string, Gtk.Widget, Gtk.SignalFunc)' is obsolete: 'Replaced by
> > ToolItem API'
> >
> > monodoc does not answer this online. I see where it mentions a function
> > is deprecated - but it does not mention what replaces it.
> >
> > Here is the source code I have:
> >
> > Toolbar toolbar = new Toolbar ();
> >
> > toolbar.ToolbarStyle = Gtk.ToolbarStyle.Icons;
> >
> > toolbar.AppendItem ("New SQL Editor",
> > "New SQL Editor", String.Empty,
> > new Gtk.Image (Stock.New, IconSize.LargeToolbar),
> > new Gtk.SignalFunc (OnToolbar_FileNew));
> >
> > toolbar.AppendItem ("Open SQL Editor",
> > "Open file into SQL Editor", String.Empty,
> > new Gtk.Image (Stock.Open, IconSize.LargeToolbar),
> > new Gtk.SignalFunc (OnToolbar_FileOpen));
> >
> > toolbar.AppendItem ("Save SQL Editor",
> > "Save file from SQL Editor", String.Empty,
> > new Gtk.Image (Stock.Save, IconSize.LargeToolbar),
> > new Gtk.SignalFunc (OnToolbar_FileSave));
> >
> > toolbar.AppendItem ("Close SQL Editor",
> > "Close SQL Editor", String.Empty,
> > new Gtk.Image (Stock.Close, IconSize.LargeToolbar),
> > new Gtk.SignalFunc (OnToolbar_FileClose));
> >
> > toolbar.AppendSpace ();
> >
> > toolbar.AppendItem ("Execute Command",
> > "Execute SQL Command.", String.Empty,
> > new Gtk.Image (Stock.Execute, IconSize.LargeToolbar),
> > new Gtk.SignalFunc (OnToolbar_ExecuteCommand));
> >
> > toolbar.AppendItem ("Execute Script",
> > "Execute SQL Script.", String.Empty,
> > new Gtk.Image (Stock.Execute, IconSize.LargeToolbar),
> > new Gtk.SignalFunc (OnToolbar_ExecuteScript));
> >
> > toolbar.AppendItem ("Output",
> > "Toggle Results to Grid or Log", String.Empty,
> > new Gtk.Image (Stock.GoDown, IconSize.LargeToolbar),
> > new Gtk.SignalFunc (OnToolbar_ToggleResultsOutput));
> >
> > toolbar.AppendItem ("Query Mode",
> > "Execute as Query or NonQuery", String.Empty,
> > new Gtk.Image (Stock.GoDown, IconSize.LargeToolbar),
> > new Gtk.SignalFunc (OnToolbar_ToggleQueryMode));
> >
> > combo = ComboBox.NewText();
> > combo.Changed += new EventHandler (OnDataSourceChanged);
> > toolbar.AppendWidget (combo, "Connected Data Source to send
> > SQL statements to execute", String.Empty);
> > combo.AppendText(NotConnected);
> > combo.Active = 0;
> Try using:
>
> Gtk.Tooltips tooltips = new Gtk.Tooltips ();
> Gtk.ToolButton button = new Gtk.ToolButton (Gtk.Stock.Ok);
> button.SetTooltip (_tooltips, "My tool button", "My nice tool button!");
> button.Clicked += SomeEventHandler;
> //This method replaces AppendWidget (and some others)
> toolbar.Insert (button, -1);
>
> --
> Cheers
> ---------
> Mario Carrión <mario.carrion at gmail.com>
> http://www.monouml.org
>
> _______________________________________________
> Gtk-sharp-list maillist - Gtk-sharp-list at lists.ximian.com
> http://lists.ximian.com/mailman/listinfo/gtk-sharp-list
>
More information about the Gtk-sharp-list
mailing list