[Main]
Title=I tried to create a new window for the text editor, but it didn't work...

[Top]
<TABLE CELLPADDING="4"><TR><TD VALIGN="TOP"><B>Q:</B></TD><TD>
When I tried to create my own window to be used as a parent window for the text editor
(instead of the <A HREF="$$LINK(wingraph.h/DeskTop)">DeskTop</A> window), and when I passed
the address of my window to <A HREF="$$LINK(textedit.h/TE_open)">TE_open</A>, the editor went
blank (it did not display the file contents on the screen, although the editing seemed to
work). What is wrong?
</TD></TR><TR><TD VALIGN="TOP"><B>A:</B></TD><TD>
I was also very surprised when I noticed this. After some investigations,
I concluded that the window passed to <A HREF="$$LINK(textedit.h/TE_open)">TE_open</A> must not be
"dirty" (i.e. it must not have <A HREF="$$LINK(wingraph.h/WinFlags)">WF_DIRTY</A> flag set), but
windows created by <A HREF="$$LINK(wingraph.h/WinOpen)">WinOpen</A> are "dirty" by default. So, you
need to clear "dirty" flag manually before calling <A HREF="$$LINK(textedit.h/TE_open)">TE_open</A>.
This is straightforward. For example,
<PRE>WIN_RECT myRect = {0, 16, 159, 92};
WINDOW myWin;
TEXT_EDIT te;
...
WinOpen (&amp;myWin, &amp;myRect, WF_NOBORDER);
myWin.Flags &amp;= ~WF_DIRTY;
TE_open (&amp;te, &amp;myWin, &amp;myRect, ...);
</PRE>
Anyway, there is no strong reasons to use any windows other than <A HREF="$$LINK(wingraph.h/DeskTop)">DeskTop</A>
as a parent window, except if you want to use the whole screen for the editing area (the desktop
window is clipped in the toolbar area). But, note that using whole screen for editing is not so
good idea. The editor expects that the menu is on the top. So, if you press F1 etc. while doing
"full-screen" editing, your screen will be trashed, because the editor will open the menu, and
it will expect that the toolbar is at the top, etc. etc. Try to see. The solution? Disable all
keys like F1, etc. in the event handler (e.g. do not pass them to <A HREF="$$LINK(textedit.h/TE_handleEvent)">TE_handleEvent</A>)
if you really want to do full screen editing...
</TD></TR></TABLE>
