From ea318d1431c89e647598c510c4245c6571aa5f46 Mon Sep 17 00:00:00 2001 From: Timothy Pearson Date: Thu, 26 Jan 2012 23:32:43 -0600 Subject: Update to latest tqt3 automated conversion --- doc/html/activeqt-dotnet.html | 32 ++++++++++++++++---------------- 1 file changed, 16 insertions(+), 16 deletions(-) (limited to 'doc/html/activeqt-dotnet.html') diff --git a/doc/html/activeqt-dotnet.html b/doc/html/activeqt-dotnet.html index e0cfa0d83..e5602e256 100644 --- a/doc/html/activeqt-dotnet.html +++ b/doc/html/activeqt-dotnet.html @@ -104,12 +104,12 @@ and is by Microsoft referred to as the "It Just Works" (IJW) feature. C++ code (that uses TQt) with managed .NET code. First, the manual way is presented, which includes using a thin MC++ wrapper class around the normal TQt/C++ class. Then, the automated way is presented, which -utilizes the ActiveTQt framework as a generic bridge. The advantage of +utilizes the ActiveTQt framework as a generic bridge. The advantage of the first method is that it gives the application developer full control, while the second method requires less coding and relieves the developer of dealing with the conversion between managed and normal data objects. -

The impatient reader, who right away wants to see a TQPushButton and a +

The impatient reader, who right away wants to see a TQPushButton and a custom TQt widget (TQAxWidget2) run in a .NET GUI application is referred to the example directory of ActiveTQt. It contains the result of this walkthrough using both C# and VB.NET, created with Visual Studio.NET (not 2003). @@ -130,23 +130,23 @@ managed programming language.

    // native TQt/C++ class
-    class Worker : public TQObject
+    class Worker : public TQObject
     {
         Q_OBJECT
         Q_PROPERTY(TQString statusString READ statusString WRITE setStatusString)
     public:
         Worker();
 
-        TQString statusString() const;
+        TQString statusString() const;
 
     public slots:
-        void setStatusString(const TQString &string);
+        void setStatusString(const TQString &string);
 
     signals:
-        void statusStringChanged(const TQString &string);
+        void statusStringChanged(const TQString &string);
 
     private:
-        TQString status;
+        TQString status;
     };
 

The TQt class has nothing unusual for TQt users, and as even the TQt @@ -180,7 +180,7 @@ function statusStringChanged(String*) (__event), the equivalent of the respective signal in the TQt class.

Before we can start implementing the wrapper class we need a way to convert TQt's datatypes (and potentionally your own) into .NET -datatypes, e.g. TQString objects need to be converted into objects +datatypes, e.g. TQString objects need to be converted into objects of type String*.

When operating on managed objects in normal C++ code, a little extra care must be taken because of the CLR's garbage collection. A normal @@ -201,16 +201,16 @@ to the String object, even if it has been moved by the garbage collector, and it can be used just like a normal pointer.

-

    #include <qstring.h>
+
    #include <ntqstring.h>
 
     #using <mscorlib.dll>
     #include <vcclr.h>
 
     using namespace System;
 
-    String *TQStringToString(const TQString &qstring)
+    String *TQStringToString(const TQString &qstring)
     {
-        return new String(qstring.ucs2());
+        return new String(qstring.ucs2());
     }
 

    TQString StringToTQString(String *string)
@@ -304,7 +304,7 @@ Visual Basic or any other programming language available for .NET.
 COM object and is generated by the CLR when a .NET Framework client 
 activates a COM object. This provides a generic way to reuse COM 
 objects in a .NET Framework project.
-

Making a TQObject class into a COM object is easily achieved with +

Making a TQObject class into a COM object is easily achieved with ActiveTQt and demonstrated in the examples. The walkthrough will use the TQt classes implemented in those examples, so the first thing to do is to make sure that those examples have been built correctly, e.g. by opening the demonstration pages in Internet @@ -331,12 +331,12 @@ will now be available from the toolbox as grey squares with their name next to it (4) .

Using TQt Widgets

-

We can now add an instance of TQAxWidget2 and a TQPushButton to +

We can now add an instance of TQAxWidget2 and a TQPushButton to the form. Visual Studio will automatically generate the RCW for the object servers. The TQAxWidget2 instance takes most of the upper part of the form, with the TQPushButton in the lower right corner.

In the property editor of Visual Studio we can modify the properties -of our controls - TQPushButton exposes the TQWidget API and has many +of our controls - TQPushButton exposes the TQWidget API and has many properties, while TQAxWidget2 has only the Visual Studio standard properties in addition to its own property "lineWidth" in the "Miscellaneous" category. The objects are named "axTQPushButton1" and @@ -370,7 +370,7 @@ the line width by one for every click: clicking on the widget in the form, but the default events for our widgets are right now not defined.

We will also implement an event handler for the clicked signal -emitted by TQPushButton. Add the event handler resetLineWidth to +emitted by TQPushButton. Add the event handler resetLineWidth to the clicked event, and implement the generated function:

                    private void resetLineWidth(object sender, System.EventArgs e)
                     {
@@ -399,7 +399,7 @@ thanks to the C++ extensions provided by Microsoft.
 

All the limitations when using ActiveTQt are implied when using this technique to interoperate with .NET, e.g. the datatypes we can use in the APIs can only be those supported by ActiveTQt and COM. However, -since this includes subclasses of TQObject and TQWidget we can wrap +since this includes subclasses of TQObject and TQWidget we can wrap any of our datatypes into a TQObject subclass to make its API available to .NET. This has the positive side effect that the same API is automatically available in TQSA, the cross platform -- cgit v1.2.1