Contents Previous Next Subchapters

Creating A New Editor Window
Syntax addeditor(captiongeometrycall backdata)
captiongeometrycall backdatastyle)
See Also geteditor , delwin , adddialog , controls , addtable , gaddwin

Creates an editor window with the specified caption and geometry within the main O-Matrix window. If the value of geometry is novalue the new window is sized and positioned automatically by the system. The command specified by call back is executed when the user attempts to close the editor from the caption bar. O-Matrix does not automatically close the editor in this case and the call back command should do so if that is appropriate. The character row vector data specifies the text to place in the editor when it is created. The character row vector style must have the value "normal" or "iconic". If style is "normal", the editor is initially displayed in normal mode; if style is "iconic", the editor is initially displayed as an icon but will have the specified geometry when normalized.

Editors created with this command can be saved using the O-Matrix menu commands "File | Save" and "File | Save As," but the caption does not change to reflect the specified file name. When the edit window is closed, the user is not automatically prompted to save the text contained within the editor (even if the editor's contents have been saved to a file previously).

The following program reads the file c:\omwin\autoexec.oms into a character row vector. It then creates an editor window that initially contains the contents of the file. The contents of the editor are printed in the Command window when the editor is deleted from its caption bar. (Warning: if you change the contents of this editor window and then use File | Save, you will change you autoexec file.)

file     = "c:\omwin\autoexec.oms"
enough   = 10000
data     = fill(" ", 1, enough)
idata    = 1
for i = 1 to nrows(file) begin
     line                = read(file, "byte")
     nc                  = coldim(line)
     data.col(idata, nc) = line
     idata               = idata + nc + 1
     data(idata -  1)    = NEW_LINE
data     = data.col(1, idata - 1)
caption  = "Example Editor"
geometry = [100, 100, 400, 400]
callback = "Done"
addeditor(caption, geometry, callback, data)
function Done() begin
     global caption
     data = geteditor(caption)
     write("screen", data)