GoFiler Legato Script Reference
Legato v 1.5b Application v 5.24b
|
Table of Contents | < < Previous | Next >> |
Chapter Six — File Functions (continued)
Overview
The WriteSegment function will replace a region of text within a Mapped Text or Edit Object.
Syntax/Parameters
Syntax
int = WriteSegment ( handle hObject, string data, int sx, int sy, [int ex, int ey] );
int = WriteSegment ( handle hObject, string data );
Parameters
hObject
A handle to a Mapped Text or Edit Object. When using a Mapped Text Object, all parameters as shown must be provided.
data
A string with which to replace the selected region. Line endings must be represented by a single 0x0D (CR) character.
sx sy ex ey
A series of ints specifying the region to replace or insert. If omitted (only on an Edit Object), the selected area from the Edit Object is used. If the start position is provided without an end position, the write is considered an insert at the point sx and sy.
Return Value
Returns an int as ERROR_NONE or a formatted error code on failure.
Remarks
The WriteSegment and ReadSegment functions allow a file or edit object to be treated as a series of x/y positions. To insert text only, set the start and end positions to the same desired position. For example:
sx = GetCaretXPosition(hEdit);
sy = GetCaretYPosition(hEdit);
ex = sx; ey = sy;
rc = WriteSegment(hEdit, data, sx, sy, ex, ey);
Avoid lines larger than 1,048,575 bytes in size.
Example
In this example, an area of text to be placed has already been defined by the global values s_x, s_y, e_x and e_y. The routine is called within the related_function function. The net result is written to the edit object. This is a subroutine from a tool to help cross-link this reference manual.
int related_function(handle hEO, string f_name, string text) { string s1, s2; int rc; s2 = get_function_file(f_name); if (s2 == "") { MessageBox('x', "Unable to find function."); return ERROR_CANCEL; } s1 = "<P CLASS=\"related\">"; s1 += FormatString("<A CLASS=\"function\" HREF=\"%s\">", s2); s1 += f_name; s1 += "</A> — "; text = ANSITextToXML(text); s1 += text; rc = WriteSegment(hEO, s1, s_x, s_y, e_x, e_y); if (IsError(rc)) { MessageBox('x', "Failure to write string (0x%08X).", rc); return ERROR_CANCEL; } return ERROR_NONE; }
Related Functions
Platform Support
Go13, Go16, GoFiler Complete, GoFiler Corporate, GoFiler, GoFiler Lite, GoXBRL
Legato IDE, Legato Basic
Table of Contents | < < Previous | Next >> |
© 2012-2024 Novaworks, LLC. All rights reserved worldwide. Unauthorized use, duplication or transmission prohibited by law. Portions of the software are protected by US Patents 10,095,672, 10,706,221 and 11,210,456. GoFiler™ and Legato™ are trademarks of Novaworks, LLC. EDGAR® is a federally registered trademark of the U.S. Securities and Exchange Commission. Novaworks is not affiliated with or approved by the U.S. Securities and Exchange Commission. All other trademarks are property of their respective owners. Use of the features specified in this language are subject to terms, conditions and limitations of the Software License Agreement.