1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
194
195
196
197
198
199
200
201
202
203
204
205
206
207
208
209
210
211
212
213
214
215
216
217
218
219
220
221
222
223
224
225
226
227
228
229
230
231
232
233
234
235
236
237
238
239
240
241
242
243
244
245
246
247
248
249
250
|
<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.0 Transitional//EN">
<!-- /home/espenr/tmp/qt-3.3.8-espenr-2499/qt-x11-free-3.3.8/extensions/activeqt/container/qaxwidget.cpp:1336 -->
<html>
<head>
<meta http-equiv="Content-Type" content="text/html; charset=ISO-8859-1">
<title>TQAxWidget Class</title>
<style type="text/css"><!--
fn { margin-left: 1cm; text-indent: -1cm; }
a:link { color: #004faf; text-decoration: none }
a:visited { color: #672967; text-decoration: none }
body { background: #ffffff; color: black; }
--></style>
</head>
<body>
<table border="0" cellpadding="0" cellspacing="0" width="100%">
<tr bgcolor="#E5E5E5">
<td valign=center>
<a href="index.html">
<font color="#004faf">Home</font></a>
| <a href="classes.html">
<font color="#004faf">All Classes</font></a>
| <a href="mainclasses.html">
<font color="#004faf">Main Classes</font></a>
| <a href="annotated.html">
<font color="#004faf">Annotated</font></a>
| <a href="groups.html">
<font color="#004faf">Grouped Classes</font></a>
| <a href="functions.html">
<font color="#004faf">Functions</font></a>
</td>
<td align="right" valign="center"><img src="logo32.png" align="right" width="64" height="32" border="0"></td></tr></table><h1 align=center>TQAxWidget Class Reference<br><small>[<a href="qaxcontainer.html">TQAxContainer module</a>]</small></h1>
<p>The TQAxWidget class is a TQWidget that wraps an ActiveX control.
<a href="#details">More...</a>
<p>This class is part of the <b>TQt ActiveTQt Extension</b>.
<p><tt>#include <<a href="qaxwidget-h.html">qaxwidget.h</a>></tt>
<p>Inherits <a href="qwidget.html">TQWidget</a> and <a href="qaxbase.html">TQAxBase</a>.
<p><a href="qaxwidget-members.html">List of all member functions.</a>
<h2>Public Members</h2>
<ul>
<li class=fn><a href="#TQAxWidget"><b>TQAxWidget</b></a> ( TQWidget * parent = 0, const char * name = 0, WFlags f = 0 )</li>
<li class=fn><a href="#TQAxWidget-2"><b>TQAxWidget</b></a> ( const TQString & c, TQWidget * parent = 0, const char * name = 0, WFlags f = 0 )</li>
<li class=fn><a href="#TQAxWidget-3"><b>TQAxWidget</b></a> ( IUnknown * iface, TQWidget * parent = 0, const char * name = 0, WFlags f = 0 )</li>
<li class=fn><a href="#~TQAxWidget"><b>~TQAxWidget</b></a> ()</li>
</ul>
<h2>Important Inherited Members</h2>
<ul>
<li class=fn>TQVariant <a href="#dynamicCall"><b>dynamicCall</b></a> ( const TQCString & function, const TQVariant & var1 = TQVariant ( ), const TQVariant & var2 = TQVariant ( ), const TQVariant & var3 = TQVariant ( ), const TQVariant & var4 = TQVariant ( ), const TQVariant & var5 = TQVariant ( ), const TQVariant & var6 = TQVariant ( ), const TQVariant & var7 = TQVariant ( ), const TQVariant & var8 = TQVariant ( ) )</li>
<li class=fn>TQVariant <a href="#dynamicCall-2"><b>dynamicCall</b></a> ( const TQCString & function, TQValueList<TQVariant> & vars )</li>
<li class=fn>TQAxObject * <a href="#querySubObject"><b>querySubObject</b></a> ( const TQCString & name, const TQVariant & var1 = TQVariant ( ), const TQVariant & var2 = TQVariant ( ), const TQVariant & var3 = TQVariant ( ), const TQVariant & var4 = TQVariant ( ), const TQVariant & var5 = TQVariant ( ), const TQVariant & var6 = TQVariant ( ), const TQVariant & var7 = TQVariant ( ), const TQVariant & var8 = TQVariant ( ) )</li>
</ul>
<h2>Protected Members</h2>
<ul>
<li class=fn>virtual bool <a href="#createHostWindow"><b>createHostWindow</b></a> ( bool initialized )</li>
<li class=fn>virtual bool <a href="#translateKeyEvent"><b>translateKeyEvent</b></a> ( int message, int keycode ) const</li>
</ul>
<hr><a name="details"></a><h2>Detailed Description</h2>
<p> This class is defined in the <b>TQt <a href="activeqt.html#ActiveTQt">ActiveTQt</a> Extension</b>, which can be found in the <tt>qt/extensions</tt> directory. It is not included in the main TQt API.
<p>
The TQAxWidget class is a <a href="qwidget.html">TQWidget</a> that wraps an ActiveX control.
<p>
<p> A TQAxWidget can be instantiated as an empty object, with the name
of the ActiveX control it should wrap, or with an existing
interface pointer to the ActiveX control. The ActiveX control's
properties, methods and events which only use <a href="qaxbase.html">supported data types</a>, become available as TQt properties,
slots and signals. The base class <a href="qaxbase.html">TQAxBase</a> provides an API to
access the ActiveX directly through the IUnknown pointer.
<p> TQAxWidget is a TQWidget and can be used as such, e.g. it can be
organized in a widget hierarchy, receive events or act as an event
filter. Standard widget properties, e.g. <a href="qwidget.html#enabled-prop">enabled</a> are supported, but it depends on the ActiveX
control to implement support for ambient properties like e.g.
palette or font. TQAxWidget tries to provide the necessary hints.
<p> <b>Warning:</b>
You can subclass TQAxWidget, but you cannot use the <a href="metaobjects.html#Q_OBJECT">Q_OBJECT</a> macro
in the subclass (the generated <a href="moc.html#moc">moc</a>-file will not compile), so you
cannot add further signals, slots or properties. This limitation
is due to the metaobject information generated in runtime. To work
around this problem, aggregate the TQAxWidget as a member of the
<a href="qobject.html">TQObject</a> subclass.
<p>
<hr><h2>Member Function Documentation</h2>
<h3 class=fn><a name="TQAxWidget"></a>TQAxWidget::TQAxWidget ( <a href="qwidget.html">TQWidget</a> * parent = 0, const char * name = 0, WFlags f = 0 )
</h3>
Creates an empty TQAxWidget widget and propagates <em>parent</em>, <em>name</em> and <em>f</em> to the <a href="qwidget.html">TQWidget</a> constructor. To initialize a control,
call <a href="qaxbase.html#setControl">setControl</a>.
<h3 class=fn><a name="TQAxWidget-2"></a>TQAxWidget::TQAxWidget ( const <a href="qstring.html">TQString</a> & c, <a href="qwidget.html">TQWidget</a> * parent = 0, const char * name = 0, WFlags f = 0 )
</h3>
Creates an TQAxWidget widget and initializes the ActiveX control <em>c</em>.
<em>parent</em>, <em>name</em> and <em>f</em> are propagated to the <a href="qwidget.html">TQWidget</a> contructor.
<p> <p>See also <a href="qaxbase.html#control-prop">control</a>.
<h3 class=fn><a name="TQAxWidget-3"></a>TQAxWidget::TQAxWidget ( IUnknown * iface, <a href="qwidget.html">TQWidget</a> * parent = 0, const char * name = 0, WFlags f = 0 )
</h3>
Creates a TQAxWidget that wraps the COM object referenced by <em>iface</em>.
<em>parent</em>, <em>name</em> and <em>f</em> are propagated to the <a href="qwidget.html">TQWidget</a> contructor.
<h3 class=fn><a name="~TQAxWidget"></a>TQAxWidget::~TQAxWidget ()
</h3>
Shuts down the ActiveX control and destroys the TQAxWidget widget,
cleaning up all allocated resources.
<p> <p>See also <a href="qaxbase.html#clear">clear</a>().
<h3 class=fn>bool <a name="createHostWindow"></a>TQAxWidget::createHostWindow ( bool initialized )<tt> [virtual protected]</tt>
</h3>
Creates the client site for the ActiveX control, and returns TRUE if
the control could be embedded successfully, otherwise returns FALSE.
If <em>initialized</em> is TRUE the control has already been initialized.
<p> This function is called by <a href="qaxbase.html#initialize">initialize</a>(). If you reimplement initialize
to customize the actual control instantiation, call this function in your
reimplementation to have the control embedded by the default client side.
Creates the client site for the ActiveX control, and returns TRUE if
the control could be embedded successfully, otherwise returns FALSE.
<h3 class=fn><a href="qvariant.html">TQVariant</a> <a name="dynamicCall"></a>TQAxBase::dynamicCall ( const <a href="qcstring.html">TQCString</a> & function, const <a href="qvariant.html">TQVariant</a> & var1 = TQVariant ( ), const <a href="qvariant.html">TQVariant</a> & var2 = TQVariant ( ), const <a href="qvariant.html">TQVariant</a> & var3 = TQVariant ( ), const <a href="qvariant.html">TQVariant</a> & var4 = TQVariant ( ), const <a href="qvariant.html">TQVariant</a> & var5 = TQVariant ( ), const <a href="qvariant.html">TQVariant</a> & var6 = TQVariant ( ), const <a href="qvariant.html">TQVariant</a> & var7 = TQVariant ( ), const <a href="qvariant.html">TQVariant</a> & var8 = TQVariant ( ) )
</h3>
Calls the COM object's method <em>function</em>, passing the
parameters <em>var1</em>, <em>var1</em>, <em>var2</em>, <em>var3</em>, <em>var4</em>, <em>var5</em>,
<em>var6</em>, <em>var7</em> and <em>var8</em>, and returns the value returned by
the method, or an invalid <a href="qvariant.html">TQVariant</a> if the method does not return
a value or when the function call failed.
<p> If <em>function</em> is a method of the object the string must be provided
as the full prototype, for example as it would be written in a
<a href="qobject.html#connect">TQObject::connect</a>() call.
<pre>
activeX->dynamicCall( "Navigate(const <a href="qstring.html">TQString</a>&)", "www.trolltech.com" );
</pre>
<p> Alternatively a function can be called passing the parameters embedded
in the string, e.g. above function can also be invoked using
<pre>
activeX->dynamicCall("Navigate(\"www.trolltech.com\");
</pre>
All parameters are passed as strings; it depends on the control whether
they are interpreted correctly, and is slower than using the prototype
with correctly typed parameters.
<p> If <em>function</em> is a property the string has to be the name of the
property. The property setter is called when <em>var1</em> is a valid TQVariant,
otherwise the getter is called.
<pre>
activeX->dynamicCall( "Value", 5 );
<a href="qstring.html">TQString</a> text = activeX->dynamicCall( "Text" ).toString();
</pre>
Note that it is faster to get and set properties using
<a href="qobject.html#property">TQObject::property</a>() and <a href="qobject.html#setProperty">TQObject::setProperty</a>().
<p> It is only possible to call functions through <a href="qaxbase.html#dynamicCall">dynamicCall</a>() that
have parameters or return values of datatypes supported by
<a href="qvariant.html">TQVariant</a>. See the <a href="qaxbase.html">TQAxBase</a> class documentation for a list of
supported and unsupported datatypes. If you want to call functions
that have unsupported datatypes in the parameter list, use
<a href="qaxbase.html#queryInterface">queryInterface</a>() to retrieve the appropriate COM interface, and
use the function directly.
<p> <pre>
IWebBrowser2 *webBrowser = 0;
activeX->queryInterface( IID_IWebBrowser2, (void**)&webBrowser );
if ( webBrowser ) {
webBrowser->Navigate2( pvarURL );
webBrowser->Release();
}
</pre>
<p> This is also more efficient.
<p>Example: <a href="qaxcontainer-example-qutlook.html#x2720">qutlook/centralwidget.cpp</a>.
<h3 class=fn><a href="qvariant.html">TQVariant</a> <a name="dynamicCall-2"></a>TQAxBase::dynamicCall ( const <a href="qcstring.html">TQCString</a> & function, <a href="qvaluelist.html">TQValueList</a><TQVariant> & vars )
</h3>
This is an overloaded member function, provided for convenience. It behaves essentially like the above function.
<p> Calls the COM object's method <em>function</em>, passing the
parameters in <em>vars</em>, and returns the value returned by
the method. If the method does not return a value or when
the function call failed this function returns an invalid
<a href="qvariant.html">TQVariant</a> object.
<p> The TQVariant objects in <em>vars</em> are updated when the method has
out-parameters.
<h3 class=fn><a href="qaxobject.html">TQAxObject</a> * <a name="querySubObject"></a>TQAxBase::querySubObject ( const <a href="qcstring.html">TQCString</a> & name, const <a href="qvariant.html">TQVariant</a> & var1 = TQVariant ( ), const <a href="qvariant.html">TQVariant</a> & var2 = TQVariant ( ), const <a href="qvariant.html">TQVariant</a> & var3 = TQVariant ( ), const <a href="qvariant.html">TQVariant</a> & var4 = TQVariant ( ), const <a href="qvariant.html">TQVariant</a> & var5 = TQVariant ( ), const <a href="qvariant.html">TQVariant</a> & var6 = TQVariant ( ), const <a href="qvariant.html">TQVariant</a> & var7 = TQVariant ( ), const <a href="qvariant.html">TQVariant</a> & var8 = TQVariant ( ) )
</h3>
Returns a pointer to a <a href="qaxobject.html">TQAxObject</a> wrapping the COM object provided
by the method or property <em>name</em>, passing passing the parameters
<em>var1</em>, <em>var1</em>, <em>var2</em>, <em>var3</em>, <em>var4</em>, <em>var5</em>, <em>var6</em>,
<em>var7</em> and <em>var8</em>.
<p> If <em>name</em> is provided by a method the string must include the
full function prototype.
<p> If <em>name</em> is a property the string must be the name of the property,
and <em>var1</em>, ... <em>var8</em> are ignored.
<p> The returned TQAxObject is a child of this object (which is either of
type TQAxObject or TQAxWidget), and is deleted when this object is
deleted. It is however safe to delete the returned object yourself,
and you should do so when you iterate over lists of subobjects.
<p> COM enabled applications usually have an object model publishing
certain elements of the application as dispatch interfaces. Use
this method to navigate the hierarchy of the object model, e.g.
<p> <pre>
TQAxWidget outlook( "Outlook.Application" );
<a href="qaxobject.html">TQAxObject</a> *session = outlook.<a href="qaxbase.html#querySubObject">querySubObject</a>( "Session" );
if ( session ) {
<a href="qaxobject.html">TQAxObject</a> *defFolder = session-><a href="qaxbase.html#querySubObject">querySubObject</a>(
"GetDefaultFolder(OlDefaultFolders)",
"olFolderContacts" );
//...
}
</pre>
<p>Example: <a href="qaxcontainer-example-qutlook.html#x2721">qutlook/centralwidget.cpp</a>.
<h3 class=fn>bool <a name="translateKeyEvent"></a>TQAxWidget::translateKeyEvent ( int message, int keycode ) const<tt> [virtual protected]</tt>
</h3>
Reimplement this function to pass certain key events to the
ActiveX control. <em>message</em> is the Window message identifier
specifying the message type (ie. WM_KEYDOWN), and <em>keycode</em> is
the virtual keycode (ie. VK_TAB).
<p> If the function returns TRUE the key event is passed on to the
ActiveX control, which then either processes the event or passes
the event on to TQt.
<p> If the function returns FALSE the processing of the key event is
ignored by <a href="activeqt.html#ActiveTQt">ActiveTQt</a>, ie. the ActiveX control might handle it or
not.
<p> The default implementation returns TRUE for the following cases:
<p> <center><table cellpadding="4" cellspacing="2" border="0">
<tr bgcolor="#a2c511">
<th valign="top">WM_SYSKEYDOWN
<th valign="top">WM_SYSKEYUP
<th valign="top">WM_KEYDOWN
<tr bgcolor="#f0f0f0">
<td valign="top">All keycodes
<td valign="top">VK_MENU
<td valign="top">VK_TAB, VK_DELETE and all non-arrow-keys in combination with VK_SHIFT,
VK_CONTROL or VK_MENU
</table></center>
<p> This table is the result of experimenting with popular ActiveX controls,
ie. Internet Explorer and Microsoft Office applications, but for some
controls it might require modification.
<!-- eof -->
<hr><p>
This file is part of the <a href="index.html">TQt toolkit</a>.
Copyright © 1995-2007
<a href="http://www.trolltech.com/">Trolltech</a>. All Rights Reserved.<p><address><hr><div align=center>
<table width=100% cellspacing=0 border=0><tr>
<td>Copyright © 2007
<a href="troll.html">Trolltech</a><td align=center><a href="trademarks.html">Trademarks</a>
<td align=right><div align=right>TQt 3.3.8</div>
</table></div></address></body>
</html>
|