mail-archives/gtk-sharp-list/2005-June/006017.html

153 строки
7.0 KiB
HTML

<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 3.2//EN">
<HTML>
<HEAD>
<TITLE> [Gtk-sharp-list] Toolbar.AppendItem is obsolete and has been
replaced by ToolItem API
</TITLE>
<LINK REL="Index" HREF="index.html" >
<LINK REL="made" HREF="mailto:gtk-sharp-list%40lists.ximian.com?Subject=%5BGtk-sharp-list%5D%20Toolbar.AppendItem%20is%20obsolete%20and%20has%20been%0A%09replaced%20by%20ToolItem%20API&In-Reply-To=42B74ADC.80807%40verizon.net">
<META NAME="robots" CONTENT="index,nofollow">
<META http-equiv="Content-Type" content="text/html; charset=us-ascii">
<LINK REL="Previous" HREF="006016.html">
<LINK REL="Next" HREF="006018.html">
</HEAD>
<BODY BGCOLOR="#ffffff">
<H1>[Gtk-sharp-list] Toolbar.AppendItem is obsolete and has been
replaced by ToolItem API</H1>
<B>Mario Carri&#243;n</B>
<A HREF="mailto:gtk-sharp-list%40lists.ximian.com?Subject=%5BGtk-sharp-list%5D%20Toolbar.AppendItem%20is%20obsolete%20and%20has%20been%0A%09replaced%20by%20ToolItem%20API&In-Reply-To=42B74ADC.80807%40verizon.net"
TITLE="[Gtk-sharp-list] Toolbar.AppendItem is obsolete and has been
replaced by ToolItem API">mario.carrion at gmail.com
</A><BR>
<I>Mon Jun 20 20:12:18 EDT 2005</I>
<P><UL>
<LI>Previous message: <A HREF="006016.html">[Gtk-sharp-list] Toolbar.AppendItem is obsolete and has been
replaced by ToolItem API
</A></li>
<LI>Next message: <A HREF="006018.html">[Gtk-sharp-list] Toolbar.AppendItem is obsolete and has been
replaced by ToolItem API
</A></li>
<LI> <B>Messages sorted by:</B>
<a href="date.html#6017">[ date ]</a>
<a href="thread.html#6017">[ thread ]</a>
<a href="subject.html#6017">[ subject ]</a>
<a href="author.html#6017">[ author ]</a>
</LI>
</UL>
<HR>
<!--beginarticle-->
<PRE>On Mon, 2005-06-20 at 19:01 -0400, Daniel Morgan wrote:
&gt;<i> What is the ToolItem API?
</I>&gt;<i>
</I>&gt;<i> I get a warning CS0618: 'Gtk.Toolbar.AppendItem(string, string, string,
</I>&gt;<i> Gtk.Widget, Gtk.SignalFunc)' is obsolete: 'Replaced by ToolItem API'
</I>&gt;<i>
</I>&gt;<i> Here is the warning message I get:
</I>&gt;<i> sqlsharpgtk.cs(545) warning CS0618: 'Gtk.Toolbar.AppendItem(string,
</I>&gt;<i> string, string, Gtk.Widget, Gtk.SignalFunc)' is obsolete: 'Replaced by
</I>&gt;<i> ToolItem API'
</I>&gt;<i>
</I>&gt;<i> monodoc does not answer this online. I see where it mentions a function
</I>&gt;<i> is deprecated - but it does not mention what replaces it.
</I>&gt;<i>
</I>&gt;<i> Here is the source code I have:
</I>&gt;<i>
</I>&gt;<i> Toolbar toolbar = new Toolbar ();
</I>&gt;<i>
</I>&gt;<i> toolbar.ToolbarStyle = Gtk.ToolbarStyle.Icons;
</I>&gt;<i>
</I>&gt;<i> toolbar.AppendItem (&quot;New SQL Editor&quot;,
</I>&gt;<i> &quot;New SQL Editor&quot;, String.Empty,
</I>&gt;<i> new Gtk.Image (Stock.New, IconSize.LargeToolbar),
</I>&gt;<i> new Gtk.SignalFunc (OnToolbar_FileNew));
</I>&gt;<i>
</I>&gt;<i> toolbar.AppendItem (&quot;Open SQL Editor&quot;,
</I>&gt;<i> &quot;Open file into SQL Editor&quot;, String.Empty,
</I>&gt;<i> new Gtk.Image (Stock.Open, IconSize.LargeToolbar),
</I>&gt;<i> new Gtk.SignalFunc (OnToolbar_FileOpen));
</I>&gt;<i>
</I>&gt;<i> toolbar.AppendItem (&quot;Save SQL Editor&quot;,
</I>&gt;<i> &quot;Save file from SQL Editor&quot;, String.Empty,
</I>&gt;<i> new Gtk.Image (Stock.Save, IconSize.LargeToolbar),
</I>&gt;<i> new Gtk.SignalFunc (OnToolbar_FileSave));
</I>&gt;<i>
</I>&gt;<i> toolbar.AppendItem (&quot;Close SQL Editor&quot;,
</I>&gt;<i> &quot;Close SQL Editor&quot;, String.Empty,
</I>&gt;<i> new Gtk.Image (Stock.Close, IconSize.LargeToolbar),
</I>&gt;<i> new Gtk.SignalFunc (OnToolbar_FileClose));
</I>&gt;<i>
</I>&gt;<i> toolbar.AppendSpace ();
</I>&gt;<i>
</I>&gt;<i> toolbar.AppendItem (&quot;Execute Command&quot;,
</I>&gt;<i> &quot;Execute SQL Command.&quot;, String.Empty,
</I>&gt;<i> new Gtk.Image (Stock.Execute, IconSize.LargeToolbar),
</I>&gt;<i> new Gtk.SignalFunc (OnToolbar_ExecuteCommand));
</I>&gt;<i>
</I>&gt;<i> toolbar.AppendItem (&quot;Execute Script&quot;,
</I>&gt;<i> &quot;Execute SQL Script.&quot;, String.Empty,
</I>&gt;<i> new Gtk.Image (Stock.Execute, IconSize.LargeToolbar),
</I>&gt;<i> new Gtk.SignalFunc (OnToolbar_ExecuteScript));
</I>&gt;<i>
</I>&gt;<i> toolbar.AppendItem (&quot;Output&quot;,
</I>&gt;<i> &quot;Toggle Results to Grid or Log&quot;, String.Empty,
</I>&gt;<i> new Gtk.Image (Stock.GoDown, IconSize.LargeToolbar),
</I>&gt;<i> new Gtk.SignalFunc (OnToolbar_ToggleResultsOutput));
</I>&gt;<i>
</I>&gt;<i> toolbar.AppendItem (&quot;Query Mode&quot;,
</I>&gt;<i> &quot;Execute as Query or NonQuery&quot;, String.Empty,
</I>&gt;<i> new Gtk.Image (Stock.GoDown, IconSize.LargeToolbar),
</I>&gt;<i> new Gtk.SignalFunc (OnToolbar_ToggleQueryMode));
</I>&gt;<i>
</I>&gt;<i> combo = ComboBox.NewText();
</I>&gt;<i> combo.Changed += new EventHandler (OnDataSourceChanged);
</I>&gt;<i> toolbar.AppendWidget (combo, &quot;Connected Data Source to send
</I>&gt;<i> SQL statements to execute&quot;, String.Empty);
</I>&gt;<i> combo.AppendText(NotConnected);
</I>&gt;<i> combo.Active = 0;
</I>Try using:
Gtk.Tooltips tooltips = new Gtk.Tooltips ();
Gtk.ToolButton button = new Gtk.ToolButton (Gtk.Stock.Ok);
button.SetTooltip (_tooltips, &quot;My tool button&quot;, &quot;My nice tool button!&quot;);
button.Clicked += SomeEventHandler;
//This method replaces AppendWidget (and some others)
toolbar.Insert (button, -1);
--
Cheers
---------
Mario Carri&#243;n &lt;<A HREF="http://lists.ximian.com/mailman/listinfo/gtk-sharp-list">mario.carrion at gmail.com</A>&gt;
<A HREF="http://www.monouml.org">http://www.monouml.org</A>
</PRE>
<!--endarticle-->
<HR>
<P><UL>
<!--threads-->
<LI>Previous message: <A HREF="006016.html">[Gtk-sharp-list] Toolbar.AppendItem is obsolete and has been
replaced by ToolItem API
</A></li>
<LI>Next message: <A HREF="006018.html">[Gtk-sharp-list] Toolbar.AppendItem is obsolete and has been
replaced by ToolItem API
</A></li>
<LI> <B>Messages sorted by:</B>
<a href="date.html#6017">[ date ]</a>
<a href="thread.html#6017">[ thread ]</a>
<a href="subject.html#6017">[ subject ]</a>
<a href="author.html#6017">[ author ]</a>
</LI>
</UL>
<hr>
<a href="http://lists.ximian.com/mailman/listinfo/gtk-sharp-list">More information about the Gtk-sharp-list
mailing list</a><br>
</body></html>