/* GUIBEGIN WINDOW , 76, 282, 249, 146, POPUP|CAPTION|SYSMENU|MINBOX|MAXBOX|THICK, , Console FONT 8, 400, MS Shell Dlg ENTRY 0, 0, 248, 144, MULTI|V_AUTO|H_AUTO|READONLY|BORDER, , CONSOLE DEND GUIEND */ LIBRARY rexxgui GuiErr = "SYNTAX" GuiHeading = 1 GuiCreateWindow('NORMAL') /* Initially nothing displayed in the console window */ ConsoleChars = 0 /* Arbitrarily set a limit of 10000 maximum chars displayed * in the console window before it clears. */ GuiSendMsg("CONSOLE", "LIMITTEXT", 10000) /* Output a few lines to the "CONSOLE" entry */ WriteConsoleText("This") WriteConsoleText(" is") WriteConsoleText(" line 1.", 1) WriteConsoleText("This is line 2.", 1) /* Set the position to the end of the ENTRY */ GuiSendMsg("CONSOLE", "SETSEL", -1, -1) Again: DO FOREVER GuiGetMsg() CATCH SYNTAX CONDITION('M') SIGNAL Again CATCH HALT FINALLY GuiDestroyWindow() END RETURN /* Called when the user resizes the main window */ WM_SIZE: DO /* Size the CONSOLE control to fill the window */ GuiSetCtlPlacement("CONSOLE",,,ARG(3),ARG(4)) CATCH SYNTAX END /* Don't let Rexx Gui process this event. */ RETURN "" /********** WriteConsoleText() ************* * Writes some text to the "CONSOLE" edit control. * * WriteConsoleText(text, eol) * * text = The text to write. * eol = 1 if the line should be ended. Omit this if not. */ WriteConsoleText: /* See if we've totally filled the ENTRY with text. If so, * we have to empty it out before we can display any more. */ ConsoleChars = ConsoleChars + LENGTH(ARG(1)) IF ConsoleChars > 10000 THEN DO ConsoleChars = LENGTH(ARG(1)) GuiSendMsg("CONSOLE", "SETSEL", 0, -1) GuiRemoveCtlText("CONSOLE", ARG(1)) END ELSE /* Output the text. NOTE: It's assumed that the character position * is already at the end. */ GuiAddCtlText("CONSOLE", ARG(1)) /* Set the character position to the end of the ENTRY */ GuiSendMsg("CONSOLE", "SETSEL", -1, -1) /* Does the caller want the end of a line inserted? */ IF ARG() \== 1 THEN DO GuiSendMsg("CONSOLE", "SETSEL", -1, -1) GuiAddCtlText("CONSOLE", "") ConsoleChars = ConsoleChars + 2 GuiSendMsg("CONSOLE", "SETSEL", -1, -1) END RETURN