summaryrefslogtreecommitdiffstats
path: root/doc/html/motif-walkthrough-2.html
blob: 3b44a6e1e3a686c612d8e9df0b1d3fa6a6c9b9a8 (plain)
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
<!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/motif/doc/walkthrough.doc:243 -->
<html>
<head>
<meta http-equiv="Content-Type" content="text/html; charset=ISO-8859-1">
<title>Preparing to Migrate the User Interface</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&nbsp;Classes</font></a>
 | <a href="mainclasses.html">
<font color="#004faf">Main&nbsp;Classes</font></a>
 | <a href="annotated.html">
<font color="#004faf">Annotated</font></a>
 | <a href="groups.html">
<font color="#004faf">Grouped&nbsp;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>Preparing to Migrate the User Interface</h1>



[ <a href="motif-walkthrough-1.html">Previous: Getting Started</a> ]
[ <a href="motif-walkthrough.html">Home</a> ]
[ <a href="motif-walkthrough-3.html">Next: Using TQt Standard Dialogs</a> ]
<p> We are ready to start migrating the user interface for our project.
As mentioned in the introduction, we do this in steps, ensuring that
our application is still usable at every step of the migration process.
<p> The user interface can be viewed as a hierarchy; each top-level window
and dialog depends upon a parent (which is another top-level window or
dialog). When using <a href="motif-extension.html#Motif">Motif</a> <tt>XmMainWindow</tt> widgets, these should be
viewed as two separate entities: the <em>Main Window</em> widget with the
popup-menu hierarchy and the <em>View</em> widget contained in the <em>Main Window</em> widget. The <em>View</em> widget depends on the <em>Main Window</em>
widget.
<p> We begin migrating the pieces that have no dependencies, and work our
way up the dependency tree until all the pieces have been migrated.
<p> The hierarchy for this project looks something like this:
<p> <center><img src="motif-todo.png" alt="Motif Todo Hierarchy"></center> 
<p> We will begin by migrating and replacing all of the dialogs, then the
<em>Main Window</em> widget with popup-menu hierarchy, and finally the <em>View</em> widget.
<p> However, we are not ready to begin just yet. The migration process can
be long, but it does not have to be difficult. The <em>Open</em>, <em>Save As</em>, <em>Page Delete</em> and <em>IO Error</em> dialogs use Motif <tt>XmFileSelectionBox</tt> and <tt>XmMessageBox</tt> dialogs. TQt provides similar
functionality with <a href="ntqfiledialog.html">TQFileDialog</a> and <a href="ntqmessagebox.html">TQMessageBox</a>, which we can begin
using immediately.
<p> The <em>Print</em> dialog is special, however. The <em>Print</em> dialog cannot be
replaced until after we have replaced the <em>View</em> widget. TQt provides
a complete printing mechanism with <a href="ntqprinter.html">TQPrinter</a>, but we cannot start using
it until we have replaced the <em>View</em> widget.
<p> <h2> Removing the <em>Help</em> Dialog
</h2>
<a name="1"></a><p> The <em>Help</em> dialog is also special.  Instead of replacing the <em>Help</em>
dialog with a custom <a href="ntqdialog.html">TQDialog</a>, we will use the <a href="helpsystem.html">TQt
Help System</a> classes to provide a more advanced online help.
However, we cannot start using classes like <a href="ntqtooltip.html">TQToolTip</a> and <a href="ntqwhatsthis.html">TQWhatsThis</a>
until we replace the <em>Main Window</em> and <em>View</em> widgets.
<p> The help text included with the original project is very small and
only contains information about the <tt>XmNoteBook</tt> widget.  The use of
tooltips and whats-this text will suffice for this example.  If your
migration project has a large online <a href="helpsystem.html#help-system">help system</a>, we recommend looking
at the <a href="helpviewer-example.html">Simple HTML Help Browser</a>
example for information on how to build an rich text help system with
hypertext navigation and full printing capabilities, or using <a href="assistant.html">TQt Assistant</a>.
<p> Removing the existing <em>Help</em> dialog is relatively simple.  We remove
the <tt>Xmd/Help.h</tt>, <tt>Xmd/HelpP.h</tt> and <tt>Xmd/Help.c</tt> files from our
project file and regenerate our <tt>Makefile</tt>.
<p> The code to create the <em>Help</em> menu and <em>Help</em> dialog is in <tt>todo.cpp</tt>.  We remove the <tt>Xmd/Help.h</tt> include, the <tt>*help_manager</tt>
resource string, the <tt>help_cb()</tt> function forward declaration and the
<tt>help_widget</tt> global variable.  We also need to remove the code that
creates the <em>Help</em> dialog.  We will also remove the code to create
the <em>Help</em> menu, since this menu is now empty.  Finally, we remove
the <tt>help_cb()</tt> function implementation.
<p> The <em>Help</em> dialog is now removed from our project.  We cannot add
<a href="ntqtooltip.html">TQToolTip</a> and <a href="ntqwhatsthis.html">TQWhatsThis</a> help at the moment, since we are still using
<tt>XmMainWindow</tt> for the <em>Main Window</em> widget.  Once we have
migrated the <em>Main Window</em> and the popup-menu hierarchy, we can
begin using TQToolTip and TQWhatsThis for online help.
<p> [ <a href="motif-walkthrough-1.html">Previous: Getting Started</a> ]
[ <a href="motif-walkthrough.html">Home</a> ]
[ <a href="motif-walkthrough-3.html">Next: Using TQt Standard Dialogs</a> ]
<p> 
<!-- eof -->
<p><address><hr><div align=center>
<table width=100% cellspacing=0 border=0><tr>
<td>Copyright &copy; 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>