Home AESAES Print dialogsPrint dialogs Event libraryEvent library

8.6 Editable object functions

This library makes functions available to undertake editing operations on an editable object.

edit_close Closes editable object
edit_create Creates a new editable object
edit_cursor Switches edit cursor on/off
edit_delete Removes editable object
edit_evnt Processes editable object
edit_get_buf Examines settings: Text buffer
edit_get_colour Examines settings: Colours
edit_get_cursor Examines settings: Absolute cursor position
edit_get_dirty Examines settings: Dirty flag
edit_get_font Examines settings: Font
edit_get_format Examines settings: Formating
edit_get_pos Examines settings: Position
edit_get_scrollinfo Examines settings: Scroll information
edit_get_sel Examines settings: Selected region
edit_open Opens editable object
edit_resized Alters settings: Object size
edit_scroll Alters settings: Scroll positions
edit_set_buf Alters settings: Text buffer
edit_set_colour Alters settings: Colours
edit_set_cursor Alters settings: Absolute positioning of cursor
edit_set_dirty Alters settings: Dirty flag
edit_set_font Alters settings: Font
edit_set_format Alters settings: Formating
edit_set_pos  

Hint: The editable object is available from MagiC 5.20 onwards. As it is implemented as part of the shared library (SLB or SharedLib), one only needs to open the library with:

Slbopen("EDITOBJC.SLB", NULL, 0L, &slb, &slbexec);

The library installs a new AES object-type G_EDIT.

See also: Using G_EDIT objects   AES   GEM   Object functions

8.6.1 edit_close

Name: »Edit Object Close« - Close editable object
 
Opcode: 212
 
Syntax: void edit_close ( OBJECT *tree, int16_t obj );
 
Description: The call edit_close closes size-dependent management structures of an object and releases the memory used. The descriptor itself, though, will be preserved. Text management is now no longer possible. The following apply:
 

Parameter Meaning
tree RSC-tree of object
obj Object index
Return value: The function does not return a result.
 
Availability: As of MagiC 5.20 by means of a shared library.
 
Group: Editable object functions
 
See also: Binding
 

8.6.1.1 Bindings for edit_close

C: void edit_close ( OBJECT *tree, int16_t obj );
 
Binding:
 
void edit_close ( OBJECT *tree, int16_t obj )
{
   int_in[0] = obj;

   addr_in[0] = tree;

   return ( crys_if(212) );
}
GEM-Arrays:
 

Address Element Contents
control control[0] 212 # Function opcode
control+2 control[1] 1 # Entry in int_in
control+4 control[2] 0 # Entry in int_out
control+6 control[3] 1 # Entry in addr_in
control+8 control[4] 0 # Entry in addr_out
int_in int_in[0] obj
addr_in addr_in[0] tree

8.6.2 edit_create

Name: »Edit Object Create« - Create editable object
 
Opcode: 210
 
Syntax: void *edit_create ( void )
 
Description: The call edit_create creates a corresponding descriptor (memory is reserved), but the editor will not be opened yet. One can now alter several settings with one of the edit_set_xxx functions. The default settings are:
 
System font, 10 pt
Black on white
No line wrap
Tabulator width 64 pixels
 
Return value: Returns a descriptor for any further actions, or NULL if an error has occurred (not enough memory). The descriptor must be entered as ob_spec into the object.
 
Availability: As of MagiC 5.20 by means of a shared library.
 
Group: Editable object functions
 
See also: Binding
 

8.6.2.1 Bindings for edit_create

C: void *edit_create ( void )
 
Binding:
 
void *edit_create ( void )
{
    crys_if(210);

    return ( addr_out[0] );
}
GEM-Arrays:
 

Address Element Contents
control control[0] 210 # Function opcode
control+2 control[1] 0 # Entry in int_in
control+4 control[2] 0 # Entry in int_out
control+6 control[3] 0 # Entry in addr_in
control+8 control[4] 1 # Entry in addr_out
addr_out addr_out[0] Return value

8.6.3 edit_cursor

Name: »Edit object cursor« - Edit cursor on/off.
 
Opcode: 214
 
Syntax: int16_t edit_cursor ( OBJECT *tree, int16_t obj, int16_t whdl, int16_t show );
 
Description:
 
Parameter Meaning
   
tree RSC-tree of object
obj Object index
whdl Window handle or -1
show The cursor is switched on (show == 1), switched off (show == 0) or examined (show == -1).

The call can be nested.
 
Return value: Return value is the cursor-off counter.
 
Availability: As of MagiC 5.20 by means of a shared library.
 
Group: Editable object functions
 
See also: Binding
 

8.6.3.1 Bindings for edit_cursor

C: int16_t edit_cursor ( OBJECT *tree, int16_t obj, int16_t whdl, int16_t show );
 
Binding:
 
int16_t edit_cursor ( OBJECT *tree, int16_t obj, int16_t whdl,
                   int16_t show )
{
   addr_in[0] = tree;

   int_in[0]  = obj;
   int_in[1]  = whdl;
   int_in[2]  = show;

   crys_if( 214 );

   return ( int_out[0] );
}
GEM-Arrays:
 

Address Element Contents
control control[0] 214 # Function opcode
control+2 control[1] 3 # Entry in int_in
control+4 control[2] 1 # Entry in int_out
control+6 control[3] 1 # Entry in addr_in
control+8 control[4] 0 # Entry in addr_out
int_in int_in[0] obj
int_in+2 int_in[1] whdl
int_in+2 int_in[2] show
addr_in addr_in[0] tree
int_out int_out[0] Return value

8.6.4 edit_delete

Name: »Edit Object Delete« - Remove editable object
 
Opcode: 213
 
Syntax: void edit_delete ( void *editinfo );
 
Description: The call edit_delete releases the descriptor editinfo. If the object is to be used further then the object type has to be placed back on G_BOX.
 
Return value: The function does not return a result.
 
Availability: As of MagiC 5.20 by means of a shared library.
 
Group: Editable object functions
 
See also: Binding
 

8.6.4.1 Bindings for edit_delete

C: void edit_delete ( void *editinfo );
 
Binding:
 
void edit_delete ( void *editinfo )
{
   addr_in[0] = editinfo;

   crys_if( 213 );
}
GEM-Arrays:
 

Address Element Contents
control control[0] 213 # Function opcode
control+2 control[1] 0 # Entry in int_in
control+4 control[2] 0 # Entry in int_out
control+6 control[3] 1 # Entry in addr_in
control+8 control[4] 0 # Entry in addr_out
addr_in addr_in[0] editinfo

8.6.5 edit_evnt

Name: »Edit object event« - Process editable object
 
Opcode: 215
 
Syntax: int16_t edit_evnt ( OBJECT *tree, int16_t obj, int16_t whdl, EVNT *events, int32_t *errcode );
 
Description: The call edit_evnt causes events, i.e. mouse clicks and key presses, to be forwarded to the editable object and processed by it if appropriate. When an event has been processed, the corresponding bit in the EVENT structure is cleared. The following apply:
 
Parameter Meaning
   
tree RSC-tree of object
obj Object index
whdl Window handle or -1
events EVENT structure as for wdlg_evnt, fnts_evnt; the events are processed by the dialog if they are intended for the associated window
errcode Error code (-200 = text buffer full)
Return value: The function returns the value 0 in case of error. The exact error-code in this case is stored in the variable errcode.
 
Availability: As of MagiC 5.20 by means of a shared library.
 
Group: Editable object functions
 
See also: Binding   Keyboard codes
 

8.6.5.1 Bindings for edit_evnt

C: int16_t edit_evnt ( OBJECT *tree, int16_t obj, int16_t whdl, EVNT *events, int32_t *errcode );
 
Binding:
 
int16_t edit_evnt ( OBJECT *tree, int16_t obj, int16_t whdl,
                 EVNT *events, int32_t *errcode )
{
   int_in[0]  = obj;
   int_in[1]  = whdl;

   addr_in[0] = tree;
   addr_in[1] = events;

   int_out[1] = 0;          /* für alte SLB */
   int_out[2] = 0;          /* für alte SLB */

   crys_if( 215 )

   *errcode = int_out[1..2];


   return ( int_out[0] );
}
GEM-Arrays:
 

Address Element Contents
control control[0] 215 # Function opcode
control+2 control[1] 2 # Entry in int_in
control+4 control[2] 3 # Entry in int_out
control+6 control[3] 2 # Entry in addr_in
control+8 control[4] 0 # Entry in addr_out
int_in int_in[0] obj
int_in+2 int_in[1] whdl
addr_in addr_in[0] tree
addr_in+4 addr_in[1] events
int_out int_out[0] Return value
int_out+2 int_out[1..2] errcode

The error-code errcode is present only as of Version 7 of the SLB; the binding in MT_AES ensures that old SLB versions always return NULLs. Vice versa, the new SLB versions recognize via contrl[2] whether an error-code was requested.

8.6.6 edit_get_buf

Name: »Edit Object Get Buffer« - Examine settings: Text buffer
 
Opcode: 216 (sub-opcode 0)
 
Syntax: int16_t edit_get_buf ( OBJECT *tree, int16_t obj, int8_t **buf, int32_t *buflen, int32_t *txtlen );
 
Description: The call edit_get_buf obtains the settings of the text buffer. The following apply:
 

Parameter Meaning
tree RSC-tree of object
obj Object index
buf Address of buffer
buflen Buffer length
txtlen Current text length without EOS
Return value: 0 for error, else 1
 
Availability: As of MagiC 5.20 by means of a shared library.
 
Group: Editable object functions
 
See also: Binding
 

8.6.6.1 Bindings for edit_get_buf

C: int16_t edit_get_buf ( OBJECT *tree, int16_t obj, int8_t **buf, int32_t *buflen, int32_t *txtlen );
 
Binding:
 
int16_t edit_get_buf ( OBJECT *tree, int16_t obj,
                       int8_t **buf,
                       int32_t *buflen, int32_t *txtlen )
{
   int_in[0]  = obj;
   int_in[1]  = 0;      /* Sub-opcode for function */

   addr_in[0] = tree;

   crys_if( 216 );

   *buflen = int_out[1..2];
   *txtlen = int_out[3..4];

   *buf = addr_out[0];

   return ( int_out[0] );
}
GEM-Arrays:
 

Address Element Contents
control control[0] 216 # Function opcode
control+2 control[1] 2 # Entry in int_in
control+4 control[2] 5 # Entry in int_out
control+6 control[3] 1 # Entry in addr_in
control+8 control[4] 1 # Entry in addr_out
int_in int_in[0] obj
int_in+2 int_in[1] 0 # Sub-opcode
addr_in addr_in[0] tree
int_out int_out[0] Return value
int_out+2 int_out[1..2] buflen
int_out+6 int_out[3..4] txtlen
addr_out addr_out[0] buf

8.6.7 edit_get_colour

Name: »Edit Object Get Colour« - Examine settings: Colours
 
Opcode: 216 (sub-opcode 2)
 
Syntax: int16_t edit_get_colour ( OBJECT *tree, int16_t obj, int16_t *tcolour, int16_t *bcolour );
 
Description: The call edit_get_colour obtains the colour of an object. The following apply:
 

Parameter Meaning
tree RSC-tree of object
obj Object index
tcolour Text colour
bcolour Background colour
Return value: The function returns the value 1 on successful execution, else the value 0 in case of error.
 
Availability: As of MagiC 5.20 by means of a shared library.
 
Group: Editable object functions
 
See also: Binding
 

8.6.7.1 Bindings for edit_get_colour

C: int16_t edit_get_colour ( OBJECT *tree, int16_t obj, int16_t *tcolour, int16_t *bcolour );
 
Binding:
 
int16_t edit_get_colour ( OBJECT *tree, int16_t obj,
                          int16_t *tcolour, int16_t  *bcolour )
{
   int_in[0]  = obj;
   int_in[1]  = 2;      /* Sub-opcode for function */

   addr_in[0] = tree;

   crys_if( 216 );

   *tcolour = int_out[1];
   *bcolour = int_out[2];

   return ( int_out[0] );
}
GEM-Arrays:
 

Address Element Contents
control control[0] 216 # Function opcode
control+2 control[1] 2 # Entry in int_in
control+4 control[2] 3 # Entry in int_out
control+6 control[3] 1 # Entry in addr_in
control+8 control[4] 0 # Entry in addr_out
int_in int_in[0] obj
int_in+2 int_in[1] 2 # Sub-opcode
addr_in addr_in[0] tree
int_out int_out[0] Return value
int_out+2 int_out[1] tcolour
int_out+4 int_out[2] bcolour

8.6.8 edit_get_cursor

Name: »Edit Object Get Cursor« - Examine settings: Absolute cursor position
 
Opcode: 216 (sub-opcode 4)
 
Syntax: int16_t edit_get_cursor ( OBJECT *tree, int16_t obj, int8_t **cursorpos );
 
Description: The call edit_get_cursor obtains the absolute position of the cursor in the text of an editable object. The following apply:
 

Parameter Meaning
tree RSC-tree of object
obj Object index
cursorpos Cursor position in text
Return value: 0 for error, else 1
 
Availability: As of MagiC 5.20 by means of a shared library.
 
Group: Editable object functions
 
See also: Binding
 

8.6.8.1 Bindings for edit_get_cursor

C: int16_t edit_get_cursor ( OBJECT *tree, int16_t obj, int8_t **cursorpos );
 
Binding:
 
int16_t edit_get_cursor ( OBJECT *tree, int16_t obj,
                          int8_t **cursorpos )
{
   int_in[0]  = obj;
   int_in[1]  = 4;      /* Sub-opcode for function */

   addr_in[0] = tree;

   crys_if( 216 );

   *cursorpos = addr_out[0];

   return ( int_out[0] );
}
GEM-Arrays:
 

Address Element Contents
control control[0] 216 # Function Opcode
control+2 control[1] 2 # Entry in int_in
control+4 control[2] 1 # Entry in int_out
control+6 control[3] 1 # Entry in addr_in
control+8 control[4] 1 # Entry in addr_out
int_in int_in[0] obj
int_in+2 int_in[1] 4 # Sub-opcode
addr_in addr_in[0] tree
int_out int_out[0] Return value
addr_out addr_out[0] cursorpos

8.6.9 edit_get_dirty

Name: »Edit Object Get Dirtyflag« - Examine settings: Dirty flag
 
Opcode: 216 (sub-opcode 7)
 
Syntax: int16_t edit_get_dirty ( OBJECT *tree, int16_t obj );
 
Description: The call edit_get_dirty lets one ascertain whether the text was altered in the meantime. The flag can be cleared again with edit_set_dirty or edit_set_buf. The following apply:
 

Parameter Meaning
tree RSC-tree of object
obj Object index
Return value: The function returns the value 1 if the text was changed else 0.
 
Availability: As of MagiC 5.20 by means of a shared library.
 
Group: Editable object functions
 
See also: Binding
 

8.6.9.1 Bindings for edit_get_dirty

C: int16_t edit_get_dirty ( OBJECT *tree, int16_t obj );
 
Binding:
 
int16_t edit_get_dirty ( OBJECT *tree, int16_t obj )
{
   int_in[0]  = obj;
   int_in[1]  = 7;      /* Sub-opcode for function */

   addr_in[0] = tree;

   crys_if( 216 );

   return ( int_out[0] );
}
GEM-Arrays:
 

Address Element Contents
control control[0] 216 # Function opcode
control+2 control[1] 2 # Entry in int_in
control+4 control[2] 1 # Entry in int_out
control+6 control[3] 1 # Entry in addr_in
control+8 control[4] 0 # Entry in addr_out
int_in int_in[0] obj
int_in+2 int_in[1] 7 # Sub-opcode
addr_in addr_in[0] tree
int_out int_out[0] Return value

8.6.10 edit_get_font

Name: »Edit Object Get Font« - Examine settings: Font
 
Opcode: 216 (sub-opcode 3)
 
Syntax: int16_t edit_get_font ( OBJECT *tree, int16_t obj, int16_t *fontID, int16_t *fontH, int16_t *fontPix, int16_t *mono );
 
Description: The call edit_get_font obtains information about the ID, size and type of font used in an editable object. The following apply:
 
Parameter Meaning
   
tree RSC-tree of object
obj Object index
fontID Font ID
fontH Height for vst_point
fontPix 0=points, 1=pixels
(available as of version 8 (3.5.98) of the SLB)
mono Flag for equidistant font
Return value: The function returns the value 1 on successful execution, else the value 0 in case of error.
 
Availability: As of MagiC 5.20 by means of a shared library.
 
Group: Editable object functions
 
See also: Binding
 

8.6.10.1 Bindings for edit_get_font

C: int16_t edit_get_font ( OBJECT *tree, int16_t obj, int16_t *fontID, int16_t *fontH, int16_t *fontPix, int16_t *mono );
 
Binding:
 
int16_t edit_get_font ( OBJECT *tree, int16_t obj,
                        int16_t *fontID, int16_t *fontH,
                        int16_t *fontPix, int16_t *mono )
{
   int_in[0]  = obj;
   int_in[1]  = 3;      /* Sub-opcode for function */

   addr_in[0] = tree;

   int_out[4] = 0;      /* for old SLB         */

   crys_if( 216 );

   *fontID  = int_out[1];
   *fontH   = int_out[2];
   *mono    = int_out[3];
   *fontPix = int_out[4];

   return ( int_out[0] );
}
GEM-Arrays:
 

Address Element Contents
control control[0] 216 # Function opcode
control+2 control[1] 2 # Entry in int_in
control+4 control[2] 5 # Entry in int_out
control+6 control[3] 1 # Entry in addr_in
control+8 control[4] 0 # Entry in addr_out
int_in int_in[0] obj
int_in+2 int_in[1] 3 # Sub-opcode
addr_in addr_in[0] tree
int_out int_out[0] Return value
int_out+2 int_out[1] fontID
int_out+4 int_out[2] fontH
int_out+6 int_out[3] mono
int_out+8 int_out[4] fontPix

8.6.11 edit_get_format

Name: »Edit Object Get Format« - Examine settings: Formating
 
Opcode: 216 (sub-opcode 1)
 
Syntax: int16_t edit_get_format ( OBJECT *tree, int16_t obj, int16_t *tabwidth, int16_t *autowrap );
 
Description: The call edit_get_format obtains information about the formatting of text in an editable object. The following apply:
 
Parameter Meaning
   
tree RSC-tree of object
obj Object index
tabwidth Tabulator width
autowrap > 0: Pixel width for auto line wrap (generally == object width)
= 0: No wrapping, but horiz. scrolling
Return value: 0 for error, else 1
 
Availability: As of MagiC 5.20 by means of a shared library.
 
Group: Editable object functions
 
See also: Binding
 

8.6.11.1 Bindings for edit_get_format

C: int16_t edit_get_format ( OBJECT *tree, int16_t obj, int16_t *tabwidth, int16_t *autowrap );
 
Binding:
 
int16_t edit_get_format ( OBJECT *tree, int16_t obj,
                          int16_t *tabwidth,
                          int16_t *autowrap )
{
   int_in[0]  = obj;
   int_in[1]  = 1;      /* Sub-opcode für Funktion */

   addr_in[0] = tree;

   crys_if( 216 );

   *tabwidth  = int_out[1];
   *autowrap  = int_out[2];

   return ( int_out[0] );
}
GEM-Arrays:
 

Address Element Contents
control control[0] 216 # Function opcode
control+2 control[1] 2 # Entry in int_in
control+4 control[2] 3 # Entry in int_out
control+6 control[3] 1 # Entry in addr_in
control+8 control[4] 0 # Entry in addr_out
int_in int_in[0] obj
int_in+2 int_in[1] 1 # Sub-opcode
addr_in addr_in[0] tree
int_out int_out[0] Return value
int_out+2 int_out[1] tabwidth
int_out+4 int_out[2] autowrap

8.6.12 edit_get_pos

Name: »Edit Object Get ?« - Obtain important information about an editable object.?
 
Opcode: 216 (sub-opcode 5)
 
Syntax: void edit_get_pos ( OBJECT *tree, int16_t obj, int16_t *xscroll, int32_t *yscroll, int8_t **cyscroll, int8_t **cursorpos, int16_t *cx, int16_t *cy );
 
Description: Exactly what the function edit_get_pos does is not known, as it only turns up in the binding mt_edit.c. From the parameters it seems to obtain information about cursor position and scrolling functions in an editable object. The following apply:
 

Parameter Meaning
tree RSC-tree of object
obj Object index
xscroll  
yscroll  
cyscroll  
cursorpos  
cx  
cy  
Return value: The function does not return a result.
 
Availability: As of MagiC 5.20 by means of a shared library.
 
Group: Editable object functions
 
See also: Binding
 

8.6.12.1 Bindings for edit_get_pos

C: void edit_get_pos ( OBJECT *tree, int16_t obj, int16_t *xscroll, int32_t *yscroll, int8_t **cyscroll, int8_t **cursorpos, int16_t *cx, int16_t *cy );
 
Binding:
 
void edit_get_pos ( OBJECT *tree, int16_t obj,
                    int16_t *xscroll, int32_t *yscroll,
                    int8_t **cyscroll, int8_t **cursorpos,
                    int16_t *cx, int16_t *cy )
{
   int_in[0]  = obj;
   int_in[1]  = 5;      /* Sub-opcode for function */

   addr_in[0] = tree;

   crys_if( 216 );

   *xscroll = int_out[1];
   *yscroll = int_out[2..3];
   *cx      = int_out[4];
   *cy      = int_out[5];

   *cyscroll  = addr_out[0];
   *cursorpos = addr_out[1];

   return;
}
GEM-Arrays:
 

Address Element Contents
control control[0] 216 # Function opcode
control+2 control[1] 2 # Entry in int_in
control+4 control[2] 6 # Entry in int_out
control+6 control[3] 1 # Entry in addr_in
control+8 control[4] 2 # Entry in addr_out
int_in int_in[0] obj
int_in+2 int_in[1] 5 # Sub-opcode
addr_in addr_in[0] tree
int_out int_out[0] undefined
int_out+2 int_out[1] xscroll
int_out+4 int_out[2..3] yscroll
int_out+8 int_out[4] cx
int_out+10 int_out[5] cy
addr_out addr_out[0] cyscroll
addr_out+4 addr_out[1] cursorpos

8.6.13 edit_get_scrollinfo

Name: »Edit Object Get Scrollinformation« - Examine settings: Scroll information
 
Opcode: 216 (sub-opcode 9)
 
Syntax: void edit_get_scrollinfo ( OBJECT *tree, int16_t obj, int32_t *nlines, int32_t *yscroll, int16_t *yvis, int16_t *yval, int16_t *ncols, int16_t *xscroll, int16_t *xvis );
 
Description: The call edit_get_scrollinfo obtains information about scrollable text capabilities in an editable object. The following apply:
 
Parameter Meaning
   
tree RSC-tree of object
obj Object index
nlines Number of lines in text
yscroll First visible line
yvis Number of max. visible lines
yval Number of currently visible lines
ncols Number of columns, or -1 (unknown)
xscroll Horizontal scroll offset in pixels
xvis Number of visible columns (in pixels)

This information is required in order to set the horizontal and vertical scroll bars. As the editable object would have to make a vq_extend for each individual line, actually at each alteration of a line, the number of columns is currently not defined and the call returns -1.
MGEDIT here simply assumes a fixed width, in the same way as other programs e.g. VIEW.PRG and PC.PRG do as well. yval is always smaller or equal to yvis. If the text has fewer lines that yvis, then yval is always smaller.
 
Return value: The function does not return a result.
 
Availability: As of MagiC 5.20 by means of a shared library.
 
Group: Editable object functions
 
See also: Binding
 

8.6.13.1 Bindings for edit_get_scrollinfo

C: void edit_get_scrollinfo ( OBJECT *tree, int16_t obj, int32_t *nlines, int32_t *yscroll, int16_t *yvis, int16_t *yval, int16_t *ncols, int16_t *xscroll, int16_t *xvis );
 
Binding:
 
void edit_get_scrollinfo ( OBJECT *tree, int16_t obj,
                           int32_t *nlines, int32_t *yscroll,
                           int16_t *yvis, int16_t *yval,
                           int16_t *ncols, int16_t *xscroll,
                           int16_t *xvis )
{
   int_in[0]  = obj;
   int_in[1]  = 9;      /* Sub-opcode for function */

   addr_in[0] = tree;

   crys_if( 216 );

   *nlines   = int_out[1..2];
   *yscroll  = int_out[3..4];
   *yvis     = int_out[5];
   *yval     = int_out[6];
   *ncols    = int_out[7];
   *xscroll  = int_out[8];
   *xvis     = int_out[9];

   return;
}
GEM-Arrays:
 

Address Element Contents
control control[0] 216 # Function opcode
control+2 control[1] 2 # Entry in int_in
control+4 control[2] 10 # Entry in int_out
control+6 control[3] 1 # Entry in addr_in
control+8 control[4] 0 # Entry in addr_out
int_in int_in[0] obj
int_in+2 int_in[1] 9 # Sub-opcode
addr_in addr_in[0] tree
int_out int_out[0] undefined
int_out+2 int_out[1..2] nlines
int_out+6 int_out[3..4] yscroll
int_out+10 int_out[5] yvis
int_out+11 int_out[6] yval
int_out+12 int_out[7] ncols
int_out+13 int_out[8] xscroll
int_out+14 int_out[9] xvis

In mt_edit.c is control[2] set with 6 (?).
 

8.6.14 edit_get_sel

Name: »Edit Object Get Selection« - Examine settings: Selected region
 
Opcode: 216 (sub-opcode 8)
 
Syntax: void edit_get_sel ( OBJECT *tree, int16_t obj, int8_t **bsel, int8_t **esel );
 
Description: The call edit_get_sel obtains information about a selected region in an editable object. The following apply:
 
Parameter Meaning
   
tree RSC-tree of object
obj Object index
bsel Start of selected region
esel After the end of the selected region

If no region is selected then bsel == NULL.
 
Return value: The function returns the value 1 on successful execution, else the value 0 in case of error.
 
Availability: As of MagiC 5.20 by means of a shared library.
 
Group: Editable object functions
 
See also: Binding
 

8.6.14.1 Bindings for edit_get_sel

C: void edit_get_sel ( OBJECT *tree, int16_t obj, int8_t **bsel, int8_t **esel );
 
Binding:
 
void edit_get_sel ( OBJECT *tree, int16_t obj,
                    int8_t **bsel, int8_t **esel )
{
   int_in[0]  = obj;
   int_in[1]  = 8;      /* Sub-opcode for function */

   addr_in[0] = tree;

   crys_if( 216 );

   *bsel  = addr_out[0];
   *esel  = addr_out[1];

   return;
}
GEM-Arrays:
 

Address Element Contents
control control[0] 216 # Function opcode
control+2 control[1] 2 # Entry in int_in
control+4 control[2] 0 # Entry in int_out
control+6 control[3] 1 # Entry in addr_in
control+8 control[4] 2 # Entry in addr_out
int_in int_in[0] obj
int_in+2 int_in[1] 8 # Sub-opcode
addr_in addr_in[0] tree
addr_out addr_out[0] bsel
addr_out+4 addr_out[1] esel

In the original documentation this function is defined with an int16_t return value; however in mt_edit.c this is given as void.
 

8.6.15 edit_open

Name: »Edit Object Open« - Open editable object
 
Opcode: 211
 
Syntax: int16_t edit_open ( OBJECT *tree, int16_t obj );
 
Description: The call edit_open opens an editable object. The following apply:
 
Parameter Meaning
   
tree RSC-tree of object
obj Object index

The number of lines and columns of text visible for the object size is calculated, and corresponding pointers are created. Memory is then requested for it.
 
Return value: The function returns the value 1 on successfull execution, else the value 0 in case of error.
 
Availability: As of MagiC 5.20 by means of a shared library.
 
Group: Editable object functions
 
See also: Binding
 

8.6.15.1 Bindings for edit_open

C: int16_t edit_open ( OBJECT *tree, int16_t obj );
 
Binding:
 
int16_t edit_open ( OBJECT *tree, int16_t obj )
{
   int_in[0]  = obj;

   addr_in[0] = tree;

   crys_if( 211 );

   return ( int_out [0] );
}
GEM-Arrays:
 

Address Element Contents
control control[0] 211 # Function opcode
control+2 control[1] 1 # Entry in int_in
control+4 control[2] 1 # Entry in int_out
control+6 control[3] 1 # Entry in addr_in
control+8 control[4] 0 # Entry in addr_out
int_in int_in[0] obj
addr_in addr_in[0] tree
int_out int_out[0] Return value

8.6.16 edit_resized

Name: »Edit Object Resized« - Alter settings: Object size
 
Opcode: 217 (sub-opcode 6)
 
Syntax: int16_t edit_resized ( OBJECT *tree, int16_t obj, int16_t *oldrh, int16_t *newrh );
 
Description: The call edit_resized alters the height of an editable object. The following apply:
 
Parameter Meaning
   
tree RSC-tree of object
obj Object index
oldrh Old net height of object
newrh New net height of object

For changes of the object size the editable object must release and reserve memory. Thus it is possible that in extreme circumstances the operation fails due to a shortage of memory. In that case the return value is 0. So that the calling program can execute a correct redraw, the previous and new actual height is returned. In fact it means here the number of visible lines multiplied by the line height, i.e. the object height without the unused bottom white border.
 
Return value: 1 (OK) or 0 (error)
 
Availability: As of MagiC 5.20 by means of a shared library.
 
Group: Editable object functions
 
See also: Binding
 

8.6.16.1 Bindings for edit_resized

C: int16_t edit_resized ( OBJECT *tree, int16_t obj, int16_t *oldrh, int16_t *newrh );
 
Binding:
 
int16_t edit_resized ( OBJECT *tree, int16_t obj,
                       int16_t *oldrh, int16_t *newrh )
{
   int_in[0]  = obj;
   int_in[1]  = 6;      /* Sub-opcode for function */

   addr_in[0] = tree;

   crys_if( 217 );

   *oldrh = int_out[1];
   *newrh = int_out[2];

   return ( int_out [0] );
}
GEM-Arrays:
 

Address Element Contents
control control[0] 217 # Function opcode
control+2 control[1] 2 # Entry in int_in
control+4 control[2] 3 # Entry in int_out
control+6 control[3] 1 # Entry in addr_in
control+8 control[4] 0 # Entry in addr_out
int_in int_in[0] obj
int_in+2 int_in[1] 6 # Sub-opcode
addr_in addr_in[0] tree
int_out int_out[0] Return value
int_out+2 int_out[1] oldrh
int_out+4 int_out[4] newrh

8.6.17 edit_scroll

Name: »Edit Object Scroll« - Alter settings: Scroll positions
 
Opcode: 217 (sub-opcode 9)
 
Syntax: int16_t edit_scroll ( OBJECT *tree, int16_t obj, int16_t whdl, int32_t yscroll, int16_t xscroll );
 
Description: The call edit_scroll is used for altering the scroll position in an editable object. The following apply:
 
Parameter Meaning
   
tree RSC-tree of object
obj Object index
whdl Window handle or -1
yscroll Vertical scroll offset in lines
xscroll Horizontal scroll offset in pixels

With this one scrolls horizontally and vertically absolutely. This call is required when a scroll bar or arrow has been clicked on. The window handle is required so that the rectangle list is taken into consideration during scrolling.
 
An error-code will be returned if the number of lines has been exceeded.
 
Return value: 1 (OK) or 0 (Error)
 
Availability: As of MagiC 5.20 by means of a shared library.
 
Group: Editable object functions
 
See also: Binding
 

8.6.17.1 Bindings for edit_scroll

C: int16_t edit_scroll ( OBJECT *tree, int16_t obj, int16_t whdl, int32_t yscroll, int16_t xscroll );
 
Binding:
 
int16_t edit_scroll ( OBJECT *tree, int16_t obj, int16_t whdl,
                      int32_t yscroll, int16_t xscroll )
{
   int_in[0]    = obj;
   int_in[1]    = 9;      /* Sub-opcode for function */
   int_in[2]    = whdl;
   int_in[3..4] = yscroll;
   int_in[5]    = xscroll;

   addr_in[0] = tree;

   crys_if( 217 );

   return ( int_out [0] );
}
GEM-Arrays:
 

Address Element Contents
control control[0] 217 # Function opcode
control+2 control[1] 6 # Entry in int_in
control+4 control[2] 1 # Entry in int_out
control+6 control[3] 1 # Entry in addr_in
control+8 control[4] 0 # Entry in addr_out
int_in int_in[0] obj
int_in+2 int_in[1] 9 # Sub-opcode
int_in+4 int_in[2] whdl
int_in+6 int_in[3..4] yscroll
int_in+10 int_in[5] xscroll
addr_in addr_in[0] tree
int_out int_out[0] Return value

8.6.18 edit_set_buf

Name: »Edit Object Set Buffer« - Alter settings: Text buffer
 
Opcode: 217 (sub-opcode 0)
 
Syntax: void edit_set_buf ( OBJECT *tree, int16_t obj, int8_t *buf, int32_t buflen );
 
Description: The call edit_set_buf is used to alter the settings of the text buffer for an editable object. The following apply:
 
Parameter Meaning
   
tree Object tree
obj Object index
buf Text buffer. The text is present in DOS format with CR/LF as line-end identifier and is terminated by a Nullbyte.
buflen Length of text buffer inclusive of closing Nullbyte.

The buffer is allocated to the text object, the number of lines are determined. The cursor is set to the start of the text. This call clears the Dirty flag.
 
Return value: The function does not return a result.
 
Availability: As of MagiC 5.20 by means of a shared library.
 
Group: Editable object functions
 
See also: Binding
 

8.6.18.1 Bindings for edit_set_buf

C: void edit_set_buf ( OBJECT *tree, int16_t obj, int8_t *buf, int32_t buflen );
 
Binding:
 
void edit_set_buf ( OBJECT *tree, int16_t obj, int8_t *buf,
                    int32_t buflen )
{
   int_in[0]    = obj;
   int_in[1]    = 0;      /* Sub-opcode for function */
   int_in[2..3] = buflen;

   addr_in[0] = tree;
   addr_in[1] = buf;

   crys_if( 217 );

   return;
}
GEM-Arrays:
 

Address Element Contents
control control[0] 217 # Function opcode
control+2 control[1] 4 # Entry in int_in
control+4 control[2] 0 # Entry in int_out
control+6 control[3] 2 # Entry in addr_in
control+8 control[4] 0 # Entry in addr_out
int_in int_in[0] obj
int_in+2 int_in[1] 0 # Sub-opcode
int_in+4 int_in[2..3] buflen
addr_in addr_in[0] tree
addr_in+4 addr_in[1] buf

8.6.19 edit_set_colour

Name: »Edit Object Set Colour« - Alter settings: Colours
 
Opcode: 217 (sub-opcode 2)
 
Syntax: void edit_set_colour ( OBJECT *tree, int16_t obj, int16_t tcolour, int16_t bcolour );
 
Description: The call edit_set_colour is used to alter the colours in an editable object. The following apply:
 
Parameter Meaning
   
tree Object tree
obj Object index
tcolour Text colour
bcolour Background colour

If one of the two attributes is to remain unchanged then -1 can be passed.
 
If the editable object was opened previously, then one should generally trigger a redraw when changing one of the attributes.
 
Return value: The function does not return a result.
 
Availability: As of MagiC 5.20 by means of a shared library.
 
Group: Editable object functions
 
See also: Binding
 

8.6.19.1 Bindings for edit_set_colour

C: void edit_set_colour ( OBJECT *tree, int16_t obj, int16_t tcolour, int16_t bcolour );
 
Binding:
 
void edit_set_colour ( OBJECT *tree, int16_t obj,
                       int16_t tcolour, int16_t bcolour )
{
   int_in[0]  = obj;
   int_in[1]  = 2;      /* Sub-opcode for function */
   int_in[2]  = tcolour;
   int_in[3]  = bcolour;

   addr_in[0] = tree;

   crys_if( 217 );

   return;
}
GEM-Arrays:
 

Address Element Contents
control control[0] 217 # Function opcode
control+2 control[1] 4 # Entry in int_in
control+4 control[2] 0 # Entry in int_out
control+6 control[3] 1 # Entry in addr_in
control+8 control[4] 0 # Entry in addr_out
int_in int_in[0] obj
int_in+2 int_in[1] 2 # Sub-opcode
int_in+4 int_in[2] tcolour
int_in+6 int_in[3] bcolour
addr_in addr_in[0] tree

8.6.20 edit_set_cursor

Name: »Edit Object Set Cursor« - Alter settings: Absolute positioning of cursor
 
Opcode: 217 (sub-opcode 4)
 
Syntax: void edit_set_cursor ( OBJECT *tree, int16_t obj, int8_t *cursorpos );
 
Description: The call edit_set_cursor sets the absolute position of the cursor in an editable object. The following apply:
 
Parameter Meaning
   
tree Object tree
obj Object index
cursorpos Absolute cursor position
Return value: The function does not return a result.
 
Availability: As of MagiC 5.20 by means of a shared library.
 
Group: Editable object functions
 
See also: Binding
 

8.6.20.1 Bindings for edit_set_cursor

C: void edit_set_cursor ( OBJECT *tree, int16_t obj, int8_t *cursorpos );
 
Binding:
 
void edit_set_cursor ( OBJECT *tree, int16_t obj,
                       int8_t *cursorpos )
{
   int_in[0]  = obj;
   int_in[1]  = 4;      /* Sub-opcode for function */

   addr_in[0] = tree;
   addr_in[1] = cursorpos;

   crys_if( 217 );

   return;
}
GEM-Arrays:
 

Address Element Contents
control control[0] 217 # Function opcode
control+2 control[1] 2 # Entry in int_in
control+4 control[2] 0 # Entry in int_out
control+6 control[3] 2 # Entry in addr_in
control+8 control[4] 0 # Entry in addr_out
int_in int_in[0] obj
int_in+2 int_in[1] 4 # Sub-opcode
addr_in addr_in[0] tree
addr_in+4 addr_in[1] cursorpos

8.6.21 edit_set_dirty

Name: »Edit Object Set Dirtyflag« - Alter settings: Dirty flag
 
Opcode: 217 (sub-opcode 7)
 
Syntax: void edit_set_dirty ( OBJECT *tree, int16_t obj, int16_t dirty );
 
Description: The call edit_set_dirty changes the settings of the Dirty flag for an editable object. The following apply:
 
Parameter Meaning
   
tree RSC-tree of object
obj Object number
dirty 0 = clear, or 1 = set

With this one can clear the Dirty flag when the text has been saved.
 
Return value: The function does not return a result.
 
Availability: As of MagiC 5.20 by means of a shared library.
 
Group: Editable object functions
 
See also: Binding
 

8.6.21.1 Bindings for edit_set_dirty

C: void edit_set_dirty ( OBJECT *tree, int16_t obj, int16_t dirty );
 
Binding:
 
void edit_set_dirty ( OBJECT *tree, int16_t obj,
                      int16_t dirty )
{
   int_in[0]  = obj;
   int_in[1]  = 7;      /* Sub-opcode for function */
   int_in[2]  = dirty;

   addr_in[0] = tree;

   crys_if( 217 );

   return;
}
GEM-Arrays:
 

Address Element Contents
control control[0] 217 # Function opcode
control+2 control[1] 3 # Entry in int_in
control+4 control[2] 0 # Entry in int_out
control+6 control[3] 1 # Entry in addr_in
control+8 control[4] 0 # Entry in addr_out
int_in int_in[0] obj
int_in+2 int_in[1] 7 # Sub-opcode
int_in+4 int_in[4] dirty
addr_in addr_in[0] tree

8.6.22 edit_set_font

Name: »Edit Object Set Font« - Alter settings: Font
 
Opcode: 217 (sub-opcode 3)
 
Syntax: void edit_set_font ( OBJECT *tree, int16_t obj, int16_t fontID, int16_t fontH, int16_t fontPix, int16_t mono );
 
Description: The call edit_set_font sets the ID, size and type of font used in an editable object. The following apply:
 
Parameter Meaning
   
tree Object tree
obj Object index
fontID Font ID
fontH Character height in "points"
fontPix 0=points, 1=pixels (from 3.5.98 on)
mono 'Equidistant' flag

If the editable object was opened previously, then one should generally trigger a redraw when changing the font.
 
The mono flag is required to give the editable object the possibility to handle equidistant fonts (mono == 1) appreciably faster that proportional fonts (mono == 0).
 
fontPix is only available from version 8 of the SLB onwards. Older versions always assume fontPix=0, i.e. exclusively use vst_point() for setting the character height. The SLB recognises from contrl[1] whether fontPix was passed. If not then 0 will be asumed.
 
Return value: The function does not return a result.
 
Availability: As of MagiC 5.20 by means of a shared library.
 
Group: Editable object functions
 
See also: Binding
 

8.6.22.1 Bindings for edit_set_font

C: void edit_set_font ( OBJECT *tree, int16_t obj, int16_t fontID, int16_t fontH, int16_t fontPix, int16_t mono );
 
Binding:
 
void edit_set_font ( OBJECT *tree, int16_t obj,
                     int16_t fontID, int16_t fontH,
                     int16_t fontPix, int16_t mono )
{
   int_in[0]  = obj;
   int_in[1]  = 3;      /* Sub-opcode for function */
   int_in[2]  = fontID;
   int_in[3]  = fontH;
   int_in[4]  = mono;
   int_in[5]  = fontPix;

   addr_in[0] = tree;

   crys_if( 217 );

   return;
}
GEM-Arrays:
 

Address Element Contents
control control[0] 217 # Function opcode
control+2 control[1] 6 # Entry in int_in
control+4 control[2] 0 # Entry in int_out
control+6 control[3] 1 # Entry in addr_in
control+8 control[4] 0 # Entry in addr_out
int_in int_in[0] obj
int_in+2 int_in[1] 3 # Sub-opcode
int_in+4 int_in[2] fontID
int_in+6 int_in[3] fontH
int_in+8 int_in[4] mono
int_in+10 int_in[5] fontPix
addr_in addr_in[0] tree

8.6.23 edit_set_format

Name: »Edit Object Set Format« - Alter settings: Formating
 
Opcode: 217 (sub-opcode 1)
 
Syntax: void edit_set_format ( OBJECT *tree, int16_t obj, int16_t tabwidth, int16_t autowrap );
 
Description: The call edit_set_format sets the formatting of text in an editable object. The following apply:
 
Parameter Meaning
   
tree Object tree
obj Object index
tabwidth 1 or tabulator width in pixels
autowrap  -1: Do not change
> 0: Pixel width for auto line wrap
     (generally == object width)
= 0: No wrapping, but horiz. scrolling

If one of the two attributes is to remain unchanged then -1 can be passed.
 
If the editable object was opened previously then one should generally trigger a redraw when changing one of the attributes. From version 9 of the SLB the number of lines is recalculated when the autowrap setting is altered. In older versions this only happens with edit_set_buf.
 
Return value: The function does not return a result.
 
Availability: As of MagiC 5.20 by means of a shared library.
 
Group: Editable object functions
 
See also: Binding
 

8.6.23.1 Bindings for edit_set_format

C: void edit_set_format ( OBJECT *tree, int16_t obj, int16_t tabwidth, int16_t autowrap );
 
Binding:
 
void edit_set_format ( OBJECT *tree, int16_t obj,
                       int16_t tabwidth, int16_t autowrap )
{
   int_in[0]  = obj;
   int_in[1]  = 1;      /* Sub-opcode for function */
   int_in[2]  = tabwidth;
   int_in[3]  = autowrap;

   addr_in[0] = tree;

   crys_if( 217 );

   return;
}
GEM-Arrays:
 

Address Element Contents
control control[0] 217 # Function opcode
control+2 control[1] 4 # Entry in int_in
control+4 control[2] 0 # Entry in int_out
control+6 control[3] 1 # Entry in addr_in
control+8 control[4] 0 # Entry in addr_out
int_in int_in[0] obj
int_in+2 int_in[1] 1 # Sub-opcode
int_in+4 int_in[2] tabwidth
int_in+6 int_in[3] autowrap
addr_in addr_in[0] tree

8.6.24 edit_set_pos

Name: »Edit object set ?« - Set important information ? of an editable object.
 
Opcode: 217 (sub-opcode 5)
 
Syntax: void edit_set_pos ( OBJECT *tree, int16_t obj, int16_t xscroll, int32_t yscroll, int8_t *cyscroll, int8_t *cursorpos, int16_t cx, int16_t cy );
 
Description: Exactly what the function edit_set_pos does is not known, as it only turns up in the binding mt_edit.c. From the parameters it seems to allow the setting of the cursor position and scrolling functions in an editable object. The following apply:
 

Parameter Meaning
tree RSC-tree of object
obj Object index
xscroll  
yscroll  
cyscroll  
cursorpos  
cx  
cy  
Return value: The function does not return a result.
 
Availability: As of MagiC 5.20 by means of a shared library.
 
Group: Editable object functions
 
See also: Binding
 

8.6.24.1 Bindings for edit_set_pos

C: void edit_set_pos ( OBJECT *tree, int16_t obj, int16_t xscroll, int32_t yscroll, int8_t *cyscroll, int8_t *cursorpos, int16_t cx, int16_t cy );
 
Binding:
 
void edit_set_pos ( OBJECT *tree, int16_t obj,
                    int16_t xscroll, int32_t yscroll,
                    int8_t *cyscroll, int8_t *cursorpos,
                    int16_t cx, int16_t cy )
{
   int_in[0]    = obj;
   int_in[1]    = 5;      /* Sub-opcode for function */
   int_in[2]    = xscroll;
   int_in[3..4] = yscroll;
   int_in[5]    = cx;
   int_in[6]    = cy;

   addr_in[0] = tree;
   addr_in[1] = cyscroll;
   addr_in[2] = cursorpos;

   crys_if( 217 );

   return;
}
GEM-Arrays:
 

Address Element Contents
control control[0] 217 # Function opcode
control+2 control[1] 7 # Entry in int_in
control+4 control[2] 0 # Entry in int_out
control+6 control[3] 3 # Entry in addr_in
control+8 control[4] 0 # Entry in addr_out
int_in int_in[0] obj
int_in+2 int_in[1] 5 # Sub-opcode
int_in+4 int_in[2] xscroll
int_in+6 int_in[3..4] yscroll
int_in+10 int_in[5] cx
int_in+12 int_in[6] cy
addr_in addr_in[0] tree
addr_in+4 addr_in[1] cyscroll
addr_in+8 addr_in[2] cursorpos

8.6.25 Using G_EDIT objects

See also: Keyboard codes for G_EDIT

8.6.26 Keyboard codes for G_EDIT

These keyboard codes are evaluated by G_EDIT:

Cursor Corresponding cursor movements
Ctrl-Cursor-up/down Scrolling
Ctrl-Cursor-left/right Move cursor word by word
Shift-Cursor-left/right Cursor to start/end of line
Esc Nothing (yet)
Insert Nothing (yet)
Shift-Insert Nothing (yet)
Backspace Delete character left of cursor
Delete Delete character right of cursor
Ctrl-Delete Nothing (yet)
Home Cursor to start of text
Ende (MF-2) and
Ende (Mac) and
Shift-Clr/Home End of text
PgUp (Mac) and
Shift-Cursor-up Cursor one page up
PgUp (Mac) and
Shift-Cursor-down Cursor one page down
^A Select all (from 27.1.98 on)
^C Copy block to clipboard (leave it in text)
^X Cut block to clipboard (delete it from text)
^V Insert clipboard contents at cursor position

Home AESAES Print dialogsPrint dialogs Event libraryEvent library