wx.NET Documentation
0.7.3
This document describes the API to wx.NET. This document is complete referring to the synopsis of classes and methods since it is generated directly from source code. Unfortunately, most of the classes and functions are not described. Remarks typically focus on specifics of the wx.NET environment.
Usually, wx.NET provides the same entities as wxWidgets does, for instance class wxWindow in wxWidgets is wrapped by a class wx.Window in wx.NET and method wx.Window.Show() wrapps method wxWindow.Show(). So, please consult the documentation of wxWidgets for the information missing in this document.
Refer to Building From Source for notes on how to build wx.NET.
- Instances of wx.Object (or inheritors) shall only be generated within constructors or methods. I don't know why, but construction of instances of member variables directly with the declaration of that member variable caused access violations on subsequent constructor calls.
- When using device contexts (e.g. wx.Object.PaintDC) you have to dispose the context explicitely immediately after using it. You may either use keyword
using to inform .NET to dispose the object immediately after leaving the block (this is equivalent to the standard behavious in C++) or you may call wx.Object.Dispose() explicitely on the device context.
- Applications often replace one control by another. For instance, one might have to add an editor into a static box depending on the type of the data to edit. In C++ implementations of such controls rely on the implicit call of wxWindow.Destroy() by the destructor. In .NET, destruction of objects will usually be deferred. So, wx.Window.Destroy() must be called explicitely to destroy a control that shall be replaced by another. As an examply refer to wx.HtmlWidgetCell that register themselves at the wx.HtmlWindow when they are inserted into that window. When a new page is loaded into that window, these widgets cells and the contained controls are no longer needed. The wx.HtmlWindow can destroy them automatically because they registered themselves.
- By default, wx.NET collects all generated wrappers into a static list of instances (with the exception of strings). Thus, you will have to release all instances of
wx.Object explicitely using wx.Object.Dispose() in order to avoid memory leaks, since the wrappers will live until the system is sure that wxWidgets will not need their letter in the further more. Refer to wx.Object.InstancesCount and wx.Object.SavedInstancesCount to test this.
- Use ColourDatabase.TheColourDatabase, PenList.ThePenList, BrushList.TheBruchList, and FontList.TheFontList whenever possible. Get pens, brushes, and fonts from a window only once and cache them in a member variable.
- Traditionally, wxWidgets often uses bit vectors represented by cardinal numbers to represent configurations and styles of controls. Unfortunately, most styles are not represented by a constant of a particular data type like an enumeration but as a general
uint. This practice unfortunately disables editor features like IntelliSence. Refer to files Defs.cs ans Window.cs for the most globally used styles and IDs. At some places, uint styles have been replaced by enumerations (refer to wx.ListCtrl). uint style arguments will be subject to further changes in the API. Please note, that C# in opposition to C++ provides expressions like bitwise AND, OR, and complement as type safe operators for enumerations.
- Sometimes, destructors are used in wxWidgets samples to replace on control by another. Refer to the samples on list boxes
wx.Samples.ListCtrlApp and wx.Samples.MyHtmlListBox. Since the .NET framework uses an automatic memory management, use method wx.Window.Destroy() to eliminate the old window before adding the new one.
- Refer to wx.Config.
Manual of the
(c) 2003-2007 the wx.NET project