128
Chapter 12: Basic Text Editing Facility
TI
-
89 / TI
-
92 Plus Developer Guide
Not for Distribution
Beta Version January 26, 2001
12.2. Simple Text Edit Example
This simple application displays a single menu on the menu bar with choices for
cut, copy, and paste. It responds to typing and cursor arrow keys.
File teappr.r:
#include "tiams.h"
TOOLBOX teappMenu, RC_NO_IDS, 0, 160 {
XR_Tools {
XR_CutO, CM_CUT
XR_CopyO, CM_COPY
XR_PasteO, CM_PASTE
}
}
File teapp.c:
#include "tiams.h"
#include "teappr.h"
void main(pFrame, Event *);
FRAME(teappFrame, OO_SYSTEM_FRAME, 0, OO_APP_FLAGS, 4)
ATTR(OO_APP_FLAGS, APP_INTERACTIVE)
ATTR(OO_APP_NAME, "Text Edit Demo")
ATTR(OO_APP_PROCESS_EVENT, &main)
ATTR(OO_APP_DEFAULT_MENU, &teappMenu)
ENDFRAME
pFrame TeappFrame = (pFrame)&teappFrame;
WINDOW myWindow;
TERecord myTE;
void main(pFrame self, Event *event)
{
WIN_RECT teRect;
HANDLE hText;
switch (event->command)
{
case CM_START:
WinOpen(&myWindow, event->info.startInfo.startRect, 0);
DrawWinBorder(&myWindow, &myWindow.Window);
WinClr(&myWindow);
/* Create an empty text edit field.
The text field occupies one line at the top of the window.
Text will scroll within the edit field if it is too long to
be displayed. Arrows appear at either end to indicate some
text has scrolled out of the edit field.
*/